Uh oh!
There was an error while loading. Please reload this page.
fix(core): read AgentRun ledgers written by any version - #1986
Merged
Conversation
Astro-Hanforce-pushed
the
fix/agent-run-accept-unknown-event-types
branch
from
August 3, 2026 12:07
0ed617e to
183fb5eCompareAstro-Hanforce-pushed
the
fix/agent-run-accept-unknown-event-types
branch
from
August 3, 2026 13:27
6550ad3 to
14adedeCompare`AGENT_RUN_EVENT_TYPES` was both the set this build writes and the set a reader accepts. The ledger is append-only and outlives the build that wrote it, so retiring a writer and deleting its entry in one commit (#1755) left the next build unable to decode records the previous one had persisted, and the desktop app failed to start (#1942). Only the write side can be a closed set. Reads take `type` as an open string with the envelope around it still validated, so a damaged record is still rejected; appends take `EmittedAgentRunEvent`, so a misspelled or retired type fails to compile at the call that would persist it. That makes retiring a writer safe, which is why `usage_recorded` is gone again: #1945 could only fix the crash by adding a type nothing writes back to the catalogue this build writes from. A copy drops an event this build does not emit rather than carrying its unrewritten source-owned ids into the target, since the rewriters cannot inspect a payload they do not know.
Astro-Hanforce-pushed
the
fix/agent-run-accept-unknown-event-types
branch
from
August 3, 2026 15:15
14adede to
71a1509CompareAstro-Han
marked this pull request as ready for review
August 3, 2026 15:25
Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
AGENT_RUN_EVENT_TYPESserved two roles at once: the set of event types this build writes, and the set a reader accepts. The AgentRun ledger is append-only and outlives the build that wrote it, so those cannot be the same set. #1755 retired theusage_recordedwriter and deleted its entry in one commit; the next build then could not decode records the previous one had already persisted, and the desktop app failed to start (#1942).Only the write side can be a closed set:
typeas an open string. The envelope around it is still validated exactly, so a damaged record is still rejected — tolerating an unknown type is not tolerating an unreadable one.EmittedAgentRunEvent, so a misspelled or retired type fails to compile at the call that would persist it.That is what makes retiring a writer safe, and it is why
usage_recordedis gone again. #1945 stopped the crash the only way the old shape allowed: by putting a type nothing writes back into the catalogue this build writes from. With the two contracts separated, the tombstone is unnecessary and the entry can be removed for real.A conversation copy now drops an event this build does not emit rather than carrying its unrewritten source-owned ids into the target — the rewriters cannot inspect a payload they do not know.
Closes#1942.
Verification
npm run lint,npm run format:check, fullnpm run build— clean.@maka/core753/753,@maka/headless1314/1314 pass.@maka/storageand@maka/runtime: the 7 storage (schema migration/backup) and 4 runtime (macOS/var→/private/varrealpath) failures reproduce identically onmain— verified by running the same suites in a cleanmaincheckout, where storage in fact fails 9.Mutation-tested every new assertion, each confirmed to go red:
decodeAgentRunEvent(i.e. reintroduce #1942)appendEventback toAgentRunEventTS2578: Unused '@ts-expect-error' directive— build failstypeguardconversation-copyRoot cause
A write-side catalogue was used as a read-side contract. Backward compatibility can be enforced by discipline at the writer; forward compatibility cannot, because the writing version does not exist yet when the reader ships. The reader must therefore be tolerant of
typeby construction, which is the only part of the record whose value space legitimately grows across versions.Review focus
harbor-cell.tsconstructs two records (trace_write_failed,event_corrupt) that are persisted to a benchmark artifact; both now carry the write contract, so a typo there is a compile error rather than a downstream "corrupt artifact" diagnostic that points at the wrong cause.