Populate TurnRecord.fidelity from Codex parser (#84)#115
Merged
willwashburn merged 2 commits intomainfrom Apr 26, 2026
Merged
Conversation
Both parseCodexSession and parseCodexSessionIncremental now stamp every emitted turn with `fidelity` at `granularity: 'per-turn'`, mirroring the Claude parser's `buildClaudeFidelity` helper. Coverage flags follow the rollout source: usage flags (`hasInputTokens` / `hasOutputTokens` / `hasReasoningTokens` / `hasCacheReadTokens`) flip to true only when a `token_count` event with `total_token_usage` arrived between task_started and task_complete, so turns missing usage land in `class: 'partial'` rather than silently reporting zeros as full fidelity. Tool-call / tool-result / raw-content flags are treated as capability not presence. `hasCacheCreateTokens` and `hasSessionRelationships` remain false — Codex rollouts have no cache-create or parent-tracking concept (the latter waits on #42 / #63). Closes #84. Refs #41, #76.
# Conflicts: # packages/reader/CHANGELOG.md
This was referenced Apr 26, 2026
Open
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
parseCodexSessionandparseCodexSessionIncrementalnow stamp every emittedTurnRecordwithfidelityatgranularity: 'per-turn', mirroring the Claude parser'sbuildClaudeFidelityhelper. Resolves the "0 vs unknown" ambiguity Coverage and fidelity metadata: distinguish missing, zero, aggregate-only, and partial usage #41 was filed to fix for Codex sessions —summarizeFidelitywill now bucket Codex turns byclassinstead of dumping them inunknown.hasInputTokens/hasOutputTokens/hasReasoningTokens/hasCacheReadTokens) flip totrueonly when atoken_countevent withtotal_token_usagearrived betweentask_startedandtask_complete. Turns whose source omitted token counts now reportclass: 'partial'rather than silently reporting zero usage as full fidelity. The numericusagefields still default to 0 (preserving existing behavior); the coverage flag is the honest signal.hasToolCalls/hasToolResultEvents/hasRawContentare treated as capability (true on every turn) not presence, matching the Claude pattern.hasCacheCreateTokensstaysfalse— Codex rollouts have no ephemeral cache-create concept.hasSessionRelationshipsstaysfalseuntil the spawn-tagging substrate lands (out of scope per Parity approach: Codex and OpenCode spawn-tagging + incremental ingest without native hooks #63 / Execution graph for passive readers: session relationships and tool-result event chronology #42).Test plan
pnpm run buildpassespnpm run test:ts— 457 tests pass (5 new underparseCodexSession fidelity (issue #84)):token_countis presentclass === 'partial'whentoken_countis absent for a turntruewhen bothfunction_callandfunction_call_outputare presentfidelity(thesummarizeFidelityunknown === 0requirement)Refs
Closes #84. Refs #41, #76.