Skip to content

[#33]: handle Codex v0.129.0 sessionId relocation to Thread object#41

Open
delexw wants to merge 1 commit intomainfrom
fix-issue-33
Open

[#33]: handle Codex v0.129.0 sessionId relocation to Thread object#41
delexw wants to merge 1 commit intomainfrom
fix-issue-33

Conversation

@delexw
Copy link
Copy Markdown
Contributor

@delexw delexw commented May 10, 2026

Fixes #33

Summary

Codex v0.129.0 (2026-05-07) restructured where session identity is surfaced:

  • PR #20437 added a session_id field to session data alongside the existing id field.
  • PR #21336 moved sessionId from a top-level position onto the Thread sub-object in the v2 API.

codex-trace was reading the session identifier exclusively from payload.id in session_meta entries. Sessions written by v0.129.0+ that omit id in favour of the new fields would produce an empty session identifier, silently breaking session correlation and grouping.

Changes

src-tauri/src/parser/entry.rs

  • Added extract_session_id(payload) — a shared helper that probes three paths in version order:
    1. payload.id — all pre-v0.129.0 sessions (unchanged behaviour)
    2. payload.session_id — v0.129.0+ (PR #20437)
    3. payload.thread.sessionId — v0.129.0+ v2 API path (PR #21336)

src-tauri/src/parser/session.rs

  • parse_session_meta_new: replaced str_field(payload, "id") with extract_session_id(payload).
  • session_file_id: updated the session_meta arm to use extract_session_id so worker-session lookup also handles v0.129.0+ files correctly.

src-tauri/src/parser/discover.rs

  • scan_session_file: replaced str_field(payload, "id") with extract_session_id(payload) so the lightweight discovery path is covered too.

Tests

9 new tests across the three touched modules:

Test Location Covers
extract_session_id_reads_id_field entry.rs Existing id path unchanged
extract_session_id_falls_back_to_session_id_field entry.rs v0.129.0 PR #20437 session_id field
extract_session_id_falls_back_to_thread_session_id entry.rs v0.129.0 PR #21336 thread.sessionId path
extract_session_id_prefers_id_over_session_id entry.rs Priority: id wins over session_id
extract_session_id_returns_empty_when_absent entry.rs Graceful empty result
parse_session_reads_id_from_session_id_field session.rs Full parse via session_id
parse_session_reads_id_from_thread_session_id session.rs Full parse via thread.sessionId
discover_sessions_reads_id_from_session_id_field discover.rs Discovery scan via session_id
discover_sessions_reads_id_from_thread_session_id discover.rs Discovery scan via thread.sessionId

Verification

cargo test --lib  →  68 passed, 0 failed
npx vitest run    → 122 passed, 0 failed
cargo clippy      →   0 warnings
cargo fmt         →   no changes

Codex v0.129.0 (PRs #20437 and #21336) moved the session identifier
in session_meta payloads: session_id was added as a new field (#20437)
and sessionId was relocated onto the Thread sub-object in the v2 API
(#21336). codex-trace was reading only payload.id, so sessions written
by v0.129.0+ would produce a missing/empty session identifier.

Add extract_session_id() in entry.rs that tries three paths in order:
  1. payload.id       — all pre-v0.129.0 sessions (unchanged)
  2. payload.session_id — v0.129.0+ (PR #20437)
  3. payload.thread.sessionId — v0.129.0+ v2 API path (PR #21336)

Use extract_session_id() in parse_session_meta_new(), session_file_id()
(session.rs), and scan_session_file() (discover.rs) so both full parse
and lightweight discovery paths are covered.

9 new tests verify all three extraction paths and priority ordering.
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.129.0: sessionId moved onto Thread object in v2 API

1 participant