Repository navigation
Carry native message identity, phases and outcomes from the CLIs into the transcript (CF-1) - #282
Conversation
Real stream-json output from Claude Code 2.1.302 (claude -p, Haiku 5.5) and app-server output from codex-cli 0.163.0: interleaved commentary and tools, an allowed and a denied command, a reasoning summary, reasoning with no text, and an interrupted turn. Plus the native enums from `codex app-server generate-json-schema`. sanitize.mjs removes local paths, account and inventory details and opaque thinking signatures. Refs #274 Coven-Harness: Claude Code / claude-opus-5-5
The captures replay through the real CodexBackend and ClaudeBackend and the runner. On 89c98f2 seven of the nine fail: assistant items carry no phase, origin or outcome, reasoning has no representation, a summary absorbs reasoning text ("Plan A.\n\nPlan B.\n\nraw step 1 raw step 2"), open work at a dropped connection has no outcome, and a credit-fallback retry lets the first attempt's sink write into the second ("fresh answer STALE FROM ATTEMPT ONE"). Split UTF-8/JSON lines and repeated tokens already pass; they stay as regression guards. Refs #274 Coven-Harness: Claude Code / claude-opus-5-5
shared/conversation-events.ts defines typed observations named by native identity (runtime generation, native thread/turn/item/part), Modex turn/attempt identity, message phase, reasoning representation and execution outcome, plus applyConversationEvent, a pure, serializable fold. Native ids are scoped so reuse never collides; events apply only to the turn's current running attempt; duplicates at or below an attempt's cursor change nothing; repeated text is never deduplicated. itemFacts reads items saved before the contract without inventing provenance. Transcript items gain optional origin/phase/outcome/ reasoning fields. The projector tests pass; the adapter and runner tests still fail. Refs #274 Coven-Harness: Claude Code / claude-opus-5-5
TurnSink loses delta/assistant/thinking*/tool* for observe(), and the runner folds each stamped observation into items with the projector. - Codex: native thread/turn/item ids, phase from MessagePhase, summary parts by summaryIndex and reasoning text by contentIndex as separate items, tool outcomes from native status (declined = denied), one runtime generation per app-server (so per account registration and per stale-auth restart). An unstreamed commentary message is now kept, labelled commentary, instead of dropped. - Claude: blocks named by message id and stream index (the k-th block of a message id is stream block k), line uuid as the event source, thinking text a summary only when thinking_display is "summarized", signature-only and redacted thinking unavailable and never read, a tool_result error denied only when Modex refused that tool_use_id. Messages without ids (older CLIs) are named at ingress. - Mock, Images fixture and scripted tests: LocalItems assigns ids at ingress. Agents report tool observations. Titles read observe(). - Runner: one attempt per backend run (Retry, credit fallback), each with its own sink; a superseded attempt's sink is inert in every method; a repeated CLI event id applies once; attempt.end settles open work as interrupted after a stop, otherwise unknown; a stale running item from an earlier process loads as unknown. Review notes from the #273 tracker session on #274 are covered by tests, on its synthetic Claude stream (imported, labelled synthetic) among them. Refs #274 Coven-Harness: Claude Code / claude-opus-5-5
A finished tool's label comes from its outcome (Done, Failed, Denied, Stopped, Status unavailable), so unknown work never reads "Done"; items saved before outcomes keep their old labels. A turn folds its work up to its typed final answer; turns without typed phases keep the last-reply heuristic. Compatibility only: richer rendering is CF-4. Refs #274 Coven-Harness: Claude Code / claude-opus-5-5
docs/conversation-events.md gives the exported signatures, the projector's rules, the runner's attempts, and the Codex 0.163.0 and Claude Code 2.1.302 mapping tables, for the issues that build on it. Refs #274 Coven-Harness: Claude Code / claude-opus-5-5
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
BunsDev
left a comment
There was a problem hiding this comment.
Review from the #273 tracker session, at head 2fe9488. I read the runner, contract, Claude adapter and renderer diffs, and ran nothing on this branch. Two findings with a renderer-compatibility cost, then notes. Nothing here blocks the contract shape.
1. Tools still open when an attempt ends now read as succeeded on older clients. okFor("unknown") and okFor("interrupted") return undefined (shared/conversation-events.ts:248), and attempt.end uses it for tools still running (:353).
- On
89c98f2the runner'sfinallysetok: falseon those tools. - A renderer from before this PR reads
ok, notoutcome. It showsok: undefinedas Done, and itsisWork(item.ok !== false) folds the tool away with completed work. - So a paired desktop on an older build (Store client or desktop host pairing during a version skew) now shows an interrupted or unknown tool as quietly successful. Before this PR it showed as failed and stayed visible.
- The tracker's done list asks that unsupported clients keep a safe readable fallback.
Suggestion: keep ok: false as the legacy fallback for unknown and interrupted. The new renderer reads outcome, so its "Status unavailable" / "Stopped" labels are unaffected, and old readers never see a success that did not happen. slot()'s restart path (runner.ts:196) has the same okFor("unknown").
2. toolFoldsAsWork folds unknown outcomes away (shared/tool-summary.ts:33).
- #277's acceptance asks that unresolved work stay visible when successful work collapses.
- An
unknowntool is unresolved by definition: the stream ended before it reported. - I think this is paired with mapping every Codex
webSearchtounknown. Those would otherwise never fold.
I'd untangle the two:
- A
webSearchitem/completedwith noerroris the provider's own completion signal for an item type that has no status field, so it maps tosucceeded; one with anerrormaps tofailed. unknownthen stays visible.
If you'd rather keep web search at unknown, I'd still not fold unknown, and say in #277 that CF-4 decides how status-less items fold.
Notes, all fine as is:
${uuid}#${part}keeps one CLI line from collapsing two observations (claude.ts:261). Good.- An attempt's sink stays active until the next
beginAttempt, but the projector applies events only to the current running attempt, so a late event betweenattempt.endand the fallback's start is inert. Worth one test if there isn't one. runOn'scatchends the attempt asfailedon a thrown backend error. When the throw comes after work has started,unknownwould be the more accurate claim. Minor.- The iPhone shows a checkmark for every finished tool and ignores
ok(CompanionViews.swift:769). That predates this PR; I'll note it for CF-6 (#279).
Once you've decided on 1 and 2, I'll build CF-4's semantic slice on finalAnswerIndex / itemFacts as exported here.
Code coverage overviewLanguages: TypeScript TypeScript / code-coverage-agent
View coverage of the 10 most impacted files.
ℹ️ Calculations represent line coverage. Results may change as calculations are updated. Updated |
The paired-iPhone fixture is plain JavaScript, so typecheck missed that its scripted backend still called the removed sink.assistant(); every reply failed and the "Follow-up received" assertion timed out in the iPhone companion job. It now replies through LocalItems like the other scripted backends. A repo-wide search found no other untyped caller. Refs #274 Coven-Harness: Claude Code / claude-opus-5-5
Coven-Harness: Claude Code / claude-opus-5-5
CF-1 replaced TurnSink's delta, assistant, tool and thinking calls with observe(observation) and scopes every sink to its attempt. CF-2's additions sit on that contract unchanged: - the approval withdrawal signal; - TurnResult.stop; - the approval item's withdrawn reason; - Stop, drain and escalation in runTurn. ClaudeBackend's line handler, which CF-2 had moved into onLine, now makes CF-1's observations: the session id, the per-line uuid source, and native refs scoped to the process's runtime. The CF-2 runner case that expected Stop's leftover tool row to read failed now sees CF-1's interrupted outcome with ok absent. The next commit settles that row from the CLI's own rejection. Refs #275, #274 Coven-Harness: Claude Code / claude-opus-5-5
event-journal.md gains how typed items travel, merge and replay, how work left running at a restart is settled for every client, and what the phone receives; conversation-events.md records the CF-6 half that rests on #274. Status moves the merged CF-1 (#282) and CF-4 (#284) entries and this change into one "On main, unreleased" entry. Refs #279 Coven-Harness: Claude Code / claude-opus-5-5
… phone (CF-6, first half) (#285) * Share the captured-stream test helpers between test files The fixture loader and the Codex and Claude stream players move from conversation-events.test.ts to test/conversation-fixtures.ts, so the journal tests can replay the same captures without re-running those tests. No behaviour changes. Refs #279 Coven-Harness: Claude Code / claude-opus-5-5 * Replay journal items as upserts and give the phone typed items replayItems appended an item event even when that item was already there, so a frame delivered twice doubled the item and left a stale copy; it now upserts by id as the renderer and phone do. A typed Codex capture converges across the runner, the saved snapshot, journal replay, a duplicated replay and the phone's full and delta snapshots. The phone gets phase, outcome and reasoning; a phone that reads only title and status sees how a finished tool that did not succeed ended in its title ("· Denied", "· Failed", "· Stopped", "· Status unavailable"). Refs #279 Coven-Harness: Claude Code / claude-opus-5-5 * Settle work a dead process left running in the snapshot and the journal The runner already read a running item from an earlier process as unknown (and a running agent as status unavailable), but only in memory: the saved transcript kept "running", and a paired desktop or phone resuming from the journal kept a spinner forever. Loading a thread now saves the settled items once and sends them as item updates, so the journal and every client agree. Nothing is run again. Old transcripts and journals load, replay and project unchanged. Refs #279 Coven-Harness: Claude Code / claude-opus-5-5 * Document typed conversation state in the event journal event-journal.md gains how typed items travel, merge and replay, how work left running at a restart is settled for every client, and what the phone receives; conversation-events.md records the CF-6 half that rests on #274. Status moves the merged CF-1 (#282) and CF-4 (#284) entries and this change into one "On main, unreleased" entry. Refs #279 Coven-Harness: Claude Code / claude-opus-5-5
Val decided on #290. The signed v0.2.0 tag passed release run 39100984341 on 2026-10-18. It covered signing, notarization and stapling, the packaged E2E suite, all three signed native updater scenarios and the Windows and Linux installers. The entry still listed the packaged E2E and the updater scenarios as remaining. It now records the run and the draft's assets. What is left: the download checks, publication, the banner upgrade on the release Mac and the Companion build 7 upload. The entry also said the release ships everything under "On main, unreleased". That stopped being true when the conversation-fidelity slices from #282 landed after the tag. It now says the tag is on 01b1b8a (#272) and that those slices are not in it. Every item it lists is in the tag. Coven-Harness: Claude Code / claude-opus-5-5
Since #284, a tool whose outcome is unknown stays in view when its turn finishes. codexOutcome (from #282) read every Codex web search as unknown, because codex-cli 0.163.0's webSearch item has neither a status nor an error field, so every search stayed unfolded in every finished Codex turn. A web search's item/completed is the only report it makes, so a completed search is now succeeded. Unknown keeps meaning work that never reported. The contract doc's mapping table says so. Part of #277; follows #282 and #284. Coven-Harness: Claude Code / claude-opus-5-5
Closes #274. Part of #273 (CF-1, the contract the other seven issues build on).
What changes
Backends reported a turn through untyped callbacks (
delta,assistant,thinkingDelta,toolStart…) and the runner kept one streaming buffer. Now every backend reports assistant text, reasoning and tool work through one typed path,TurnSink.observe(observation). Each observation names the native item and part it belongs to. The runner stamps it with the Modex turn and attempt and folds it into transcript items with a pure projector,applyConversationEvent. Coding still runs only throughcodex app-serverandclaude -p; nothing here executes, replays or calls a provider.apps/desktop/src/shared/conversation-events.tsholds the types, the projector,parseConversationEvent, the legacy adapteritemFactsandfinalAnswerIndex. docs/conversation-events.md gives the exported signatures and the native mapping tables.commentary,final,unspecified), reasoning representation (summary,provider-text,unavailable) and outcome (running,succeeded,failed,denied,interrupted,unknown). These are Modex design values, mapped from Codex 0.163.0 and Claude Code 2.1.302 native values; anything unmapped stays unspecified or unknown.LocalItems), sub-agents (AgentTracker) and account-bound Codex (one runtime per registration's app-server) all report throughobserve. The title generator reads it too.uuid) applies once.attempt.endsettles open work:interruptedafter a stop,unknownotherwise; idle or a dropped connection never means success.itemFacts, with no invented provenance. The journal, journal-disabled mode, the phone's item projection and the Store client are unchanged. The only renderer changes are compatibility ones: a finished tool's label comes from its outcome, so an unknown never reads "Done"; a turn folds work up to its typed final answer, keeping the last-reply heuristic for untyped and legacy turns.Behavior that changed on purpose
89c98f2a delta after a tool start split a message into a fragment plus a duplicated copy.unknownwith nook, instead ofok: false; it reads "Status unavailable", not "Failed" or "Done".unknownrather than an inferred success.summaryonly when the CLI saysthinking_display: "summarized"; otherwiseprovider-text. Signature-only andredacted_thinkingblocks areunavailable; signatures and redacted data are never read or stored.Evidence
Base
89c98f280292b13fd9b1c7af1bf2fe65cd2fa0d1.Fixtures: sanitized live captures under
apps/desktop/test/fixtures/conversation/:redacted_thinkingFixtures say how those CLI versions behaved on 2026-10-18; they are not live-provider acceptance.
Red before green:
4d156e6adds the fixture tests alone. On89c98f2, 7 of 9 fail. Among them:"Plan A.\n\nPlan B.\n\nraw step 1 raw step 2": a summary absorbed reasoning text."fresh answer STALE FROM ATTEMPT ONE": a credit-fallback attempt was written into by the first.The later tests were each seen failing before their fix:
uuid(checked by switching the dedupe off in the build)The resume-handle assertion added beside that notice is covered by the same guard but was not seen failing on its own.
Checks run locally on macOS (Apple Silicon) with Node v24.18.1 and pnpm 10.34.5, at a load average of about 190–250 (other sessions were building and testing).
pnpm typecheck(main + renderer): passed.pnpm teston2fe9488: passed on a clean tree. First stage: 1,514 tests, 1,498 passed, 0 failed, 16 skipped (skips that already exist onmain). Second stage: 21 of 21.2fe9488, coveringapp,sources,agents,event-journal,approvalsandstore-demo: 28 of 28 passed.store-demofirst failed its precondition, "The Store client is not built", and both of its tests passed afterpnpm --filter @modex/store-desktop build.unit + e2e (macOS)CI job on this PR.2fe9488:unit + e2e (macOS)passed. The iPhone companion job failed atCompanionFlowTests.swift:334, where "Follow-up received: …" never appeared (job).apps/ios/ModexCompanion/Scripts/fixture.mjsis plain JavaScript, so typecheck missed that it still called the removedsink.assistant().2773107: it now replies throughLocalItems. A local probe confirmed the reply reaches the transcript, and a repo-wide search found no other untyped caller.Not covered here
parseConversationEventand the deterministic projector are ready for CF-6, but events are not persisted yet.provider-textrows render as Thinking rows, the same as summaries, until CF-4.