[#33]: handle Codex v0.129.0 sessionId relocation to Thread object#41
Open
[#33]: handle Codex v0.129.0 sessionId relocation to Thread object#41
Conversation
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.
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.
Fixes #33
Summary
Codex v0.129.0 (2026-05-07) restructured where session identity is surfaced:
session_idfield to session data alongside the existingidfield.sessionIdfrom a top-level position onto theThreadsub-object in the v2 API.codex-trace was reading the session identifier exclusively from
payload.idinsession_metaentries. Sessions written by v0.129.0+ that omitidin favour of the new fields would produce an empty session identifier, silently breaking session correlation and grouping.Changes
src-tauri/src/parser/entry.rsextract_session_id(payload)— a shared helper that probes three paths in version order:payload.id— all pre-v0.129.0 sessions (unchanged behaviour)payload.session_id— v0.129.0+ (PR #20437)payload.thread.sessionId— v0.129.0+ v2 API path (PR #21336)src-tauri/src/parser/session.rsparse_session_meta_new: replacedstr_field(payload, "id")withextract_session_id(payload).session_file_id: updated thesession_metaarm to useextract_session_idso worker-session lookup also handles v0.129.0+ files correctly.src-tauri/src/parser/discover.rsscan_session_file: replacedstr_field(payload, "id")withextract_session_id(payload)so the lightweight discovery path is covered too.Tests
9 new tests across the three touched modules:
extract_session_id_reads_id_fieldidpath unchangedextract_session_id_falls_back_to_session_id_fieldsession_idfieldextract_session_id_falls_back_to_thread_session_idthread.sessionIdpathextract_session_id_prefers_id_over_session_ididwins oversession_idextract_session_id_returns_empty_when_absentparse_session_reads_id_from_session_id_fieldsession_idparse_session_reads_id_from_thread_session_idthread.sessionIddiscover_sessions_reads_id_from_session_id_fieldsession_iddiscover_sessions_reads_id_from_thread_session_idthread.sessionIdVerification