Populate execution-graph records from Codex parser (#87)#121
Merged
willwashburn merged 4 commits intomainfrom Apr 26, 2026
Merged
Populate execution-graph records from Codex parser (#87)#121willwashburn merged 4 commits intomainfrom
willwashburn merged 4 commits intomainfrom
Conversation
The Codex passive reader now mirrors Claude's PR #77 substrate: every function_call_output / custom_tool_call_output produces a ToolResultEventRecord, spawn_agent function calls produce a subagent SessionRelationshipRecord, and each session emits exactly one root row. Status on tool-result events is patched from exec_command_end / patch_apply_end at task_complete time so errored calls surface with status: 'errored' and isError: true. Subagent terminal notifications (event_msg payloads matching subagent_*_complete / _done / _finished / _terminated) surface with eventSource: 'subagent_notification'. eventIndex, per-call_id callIndex counters, and the root-emitted flag are persisted in CodexResumeState (and propagated through CodexCursor) so resumed parses produce session-monotonic ids without double-emitting any (sessionId, toolUseId, eventIndex) tuple. Both the `burn ingest` codex path and the `burn codex` runtime wrapper now persist the new records via appendRelationships / appendToolResultEvents. Closes #87. Refs #42, #77. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…graph-87 # Conflicts: # packages/cli/CHANGELOG.md # packages/cli/src/ingest.test.ts # packages/cli/src/ingest.ts # packages/ledger/CHANGELOG.md # packages/reader/CHANGELOG.md # packages/reader/src/codex.test.ts # packages/reader/src/codex.ts
- packages/cli/src/commands/codex.ts: destructure and persist `userTurns` from `parseCodexSession` via `appendUserTurns`, matching the Claude wrapper. Without this, user-turn records emitted by the Codex parser (#94) are silently dropped from `burn codex` runs until `burn ingest` re-processes the session. - packages/reader/src/codex.ts: flip `hasSessionRelationships` to `true` in `buildCodexFidelity`. The flag tracks capability, not presence — with #87 the parser now emits root/subagent relationship rows, so the Codex column of FULL_REQUIRED is satisfied. Token-complete Codex turns now classify as `full` instead of `usage-only`. - packages/reader/src/codex.test.ts: update the two affected fidelity assertions to expect `class: 'full'` and `hasSessionRelationships: true`.
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 free
to 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
parseCodexSession/parseCodexSessionIncremental) now returnsrelationshipsandtoolResultEventsalongside the existingturns/content/userTurnsarrays — mirroring the Claude population PR Execution graph substrate: SessionRelationshipRecord + ToolResultEventRecord (#42) #77 landed for Execution graph for passive readers: session relationships and tool-result event chronology #42.function_call_output/custom_tool_call_outputpayloads becomeToolResultEventRecords witheventSource: 'function_call_output'. Status is patched fromexec_command_end.exit_code/patch_apply_end.successattask_completetime so errored calls surface withstatus: 'errored'andisError: true. Subagent terminal notifications (event_msgtypes matchingsubagent_*_complete/_done/_finished/_terminated) surface asToolResultEventRecords witheventSource: 'subagent_notification'.spawn_agentfunction calls produce asubagentSessionRelationshipRecordjoining the spawned agent id (resolved from the call's args, thefunction_call_outputpayload, or the terminal notification — first hit wins, deduped) back to the spawningcall_idviaparentToolUseId. Each Codex session emits exactly onerootrow.eventIndex, per-call_idcallIndexcounters, and the root-emitted flag are persisted inCodexResumeStateand propagated throughCodexCursorso resumed parses produce session-monotonic ids without double-emitting any(sessionId, toolUseId, eventIndex)tuple. Defers emission pastcommittedEndOffsetso an open turn's events stay buffered until itstask_completecommits.packages/cli/src/ingest.ts(Codex path) and theburn codexruntime wrapper inpackages/cli/src/commands/codex.tsintoappendRelationships/appendToolResultEvents.Test plan
pnpm run buildpasses.pnpm run test:tspasses (465 tests, +13 new).parseCodexSession execution graph (#42 / #87)suite covers: exactly one root row per session; oneToolResultEventRecordper function-call output; monotonic uniqueeventIndex;erroredstatus +isError: truefrom non-zero exec exit;completedstatus from successfulpatch_apply_end;subagentrelationship row withparentToolUseId/agentId/subagentType/descriptionpopulated from aspawn_agentfixture;subagent_notificationevent joined back bytoolUseId; uncommitted-turn rows deferred.parseCodexSessionIncremental execution graph dedup (#87)suite covers re-parse + resume invariants — no duplicate(sessionId, toolUseId, eventIndex)tuples and exactly one root row across two passes split at atask_completeboundary.ingestCodexSessions execution graph passthrough (#87)suite verifies end-to-end that the writer appends both kinds of records to~/.relayburn/ledger.jsonlfor a Codex session with aspawn_agentcall, and that a second ingest pass doesn't duplicate them.tests/fixtures/codex/with-spawn-agent.jsonl.Refs
🤖 Generated with Claude Code