Skip to content

Reader follow-ups for execution-graph: Codex session_meta fork/continuation, Claude system-event tool-result capture, Claude line-level fork/continuation #137

@willwashburn

Description

@willwashburn

Context

PR #77 landed the execution-graph substrate (#42). Subsequent granular PRs populated it:

PR #126 ("Complete passive execution graph coverage", recommended for close) attempted three pieces beyond what those granular PRs landed. This issue tracks porting those three pieces.

Proposal

A. Codex: fork / continuation rows from `session_meta`

In `packages/reader/src/codex.ts`, read `session_meta.payload` for:

  • `forkSessionId` → emit a `SessionRelationshipRecord` with `relationshipType: 'fork'` and `relatedSessionId` set.
  • `continuedFromSessionId` → emit a `SessionRelationshipRecord` with `relationshipType: 'continuation'` and `relatedSessionId` set.
  • `sourceSessionId` → populate the `sourceSessionId` field on emitted rows (mirror Claude's behavior in PR Emit fork and continuation relationships from Claude parser (#112) #122).
  • `cli_version` → populate `sourceVersion`.

PR #121 only emitted `root` + `subagent` for Codex. The `session_meta` payload is the only evidence channel Codex exposes for fork/continuation.

B. Claude: system-event tool-result capture

In `packages/reader/src/claude.ts`, capture `type: 'system'` records carrying `subagent_session_id` / `agent_id` / `parent_tool_use_id` as additional `ToolResultEventRecord` rows with `eventSource: 'subagent_notification'` (or similar — match the existing event-source vocabulary from PR #77).

PR #122 only handled `system` records for compaction boundaries and `/resume` markers — subagent system events were skipped.

C. Claude: line-level explicit fork / continuation

In `packages/reader/src/claude.ts`, in addition to the existing `parentUuid` cross-file detection + `/resume` markers from PR #122, read explicit `forkSessionId` / `continuedFromSessionId` fields from per-line user/assistant records (where present in the JSONL) and emit the corresponding `fork` / `continuation` rows directly. Should compose cleanly with the existing `reconcileClaudeSessionRelationships` pass.

Acceptance criteria

  • Codex fixtures with `session_meta.payload.forkSessionId` / `continuedFromSessionId` produce `fork` / `continuation` rows; `sourceVersion` is populated from `cli_version`.
  • Claude fixtures with `type: 'system'` records carrying subagent identifiers produce additional `ToolResultEventRecord`s without disturbing existing compaction / `/resume` handling.
  • Claude fixtures with explicit `forkSessionId` / `continuedFromSessionId` line-level fields produce the corresponding rows; reconciliation with cross-file inference stays idempotent.
  • Tests in `packages/reader/src/codex.test.ts` and `packages/reader/src/claude.test.ts` cover each path.

Out of scope

Refs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions