Skip to content

[#86]: feat(parser): add trace_id, forked_from_thread_id, compaction_meta fields (Codex v0.134.0/v0.135.0)#94

Open
delexw wants to merge 1 commit into
mainfrom
fix-issue-86
Open

[#86]: feat(parser): add trace_id, forked_from_thread_id, compaction_meta fields (Codex v0.134.0/v0.135.0)#94
delexw wants to merge 1 commit into
mainfrom
fix-issue-86

Conversation

@delexw
Copy link
Copy Markdown
Contributor

@delexw delexw commented May 31, 2026

Adds three new optional fields to the turn event parser for Codex v0.134.0/v0.135.0 compatibility.

Changes

Rust (src-tauri/src/parser/turn.rs)

  • trace_id (Option<String>) — extracted from task_started event payload. Added in Codex v0.134.0 (PR #23980) for OTel correlation.
  • forked_from_thread_id (Option<String>) — extracted from task_started event payload. Added in Codex v0.135.0 (PR #24160) for session-tree reconstruction; forked sessions are visible as branches rather than independent roots.
  • CompactionMeta struct + compaction_meta (Option<CompactionMeta>) — extracted from the compaction key in task_started payloads. Added in Codex v0.135.0 (PR #24368) for accurate context-window accounting. Fields: tokens_before, tokens_after, summary.

All three fields are None for older sessions (backward compatible).

TypeScript (shared/types.ts)

  • Added CompactionMeta interface mirroring the Rust struct.
  • Added trace_id: string | null, forked_from_thread_id: string | null, compaction_meta: CompactionMeta | null to CodexTurn.

Tests

  • 7 new Rust regression tests covering presence, absence, and combined-field cases for all three fields.
  • Updated 4 frontend test fixtures (TurnDetail.test.tsx, TurnList.test.tsx, ToolCallItem.test.tsx, WorkerPanel.test.tsx) to satisfy the updated CodexTurn type.

Verification

  • cargo test: 138/138 pass
  • npx tsc --noEmit: clean
  • cargo clippy -- -D warnings: clean
  • HTTP API (POST /api/sessions): OK
  • npx vitest run: pre-existing failures unrelated to this change (missing test setup for @testing-library/jest-dom); all previously-passing tests still pass

Fixes #86

…elds (Codex v0.134.0/v0.135.0)

Implements compat for two Codex CLI releases:

- v0.134.0 PR #23980: trace_id added to TurnStartedEvent. Exposed as
  CodexTurn.trace_id (Option<String> / string | null) for OTel correlation.

- v0.135.0 PR #24160: forked_from_thread_id added to turn metadata.
  Exposed as CodexTurn.forked_from_thread_id so forked sessions are
  visible as branches rather than independent roots.

- v0.135.0 PR #24368: compaction metadata added to turn headers.
  Adds CompactionMeta struct (tokens_before, tokens_after, summary)
  and CodexTurn.compaction_meta for accurate context-window accounting.

All three fields are optional (null for older sessions). Adds 7 new
regression tests covering presence, absence, and combined field cases.
Updates shared/types.ts and four frontend test fixtures.

Fixes #86
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Compat] Codex v0.134.0: trace_id added to TurnStartedEvent; v0.135.0 adds forked_from_thread_id to turn metadata

1 participant