fix(parser): parse memory context from turn_context for Codex v0.135.0#95
Merged
Conversation
Codex v0.135.0 (PR #24591) moved memory runtime state from file-based storage to a dedicated SQLite database. Active memories are now injected into the context at turn start and written into the turn_context JSONL event under a `memories` array field. Add `memories: Vec<String>` to `CodexTurn` (Rust) and `memories?: string[]` to the TypeScript `CodexTurn` interface. Update `handle_turn_context` to extract the field. Pre-v0.135.0 sessions with no memories field produce an empty Vec gracefully. Fixes #85
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
Codex v0.135.0 (PR #24591) migrated memory runtime state from file-based storage to a dedicated SQLite database. Active memories are now injected into context at the start of each turn and emitted into the JSONL session file via the
turn_contextevent under amemoriesarray field.This PR adds parsing support for that field so codex-trace correctly exposes memory context in traces produced by v0.135.0+ sessions.
Changes
src-tauri/src/parser/turn.rs: Addedmemories: Vec<String>field toCodexTurn. Updatedhandle_turn_contextto extract thememoriesarray from theturn_contextJSONL payload. Pre-v0.135.0 sessions with nomemoriesfield default to an emptyVecgracefully.shared/types.ts: Addedmemories?: string[]to theCodexTurnTypeScript interface (optional so existing test fixtures remain valid; the Rust backend always serialises it as[]or with values).src-tauri/src/parser/entry.rs: Added v0.135.0 regression tests verifyingturn_contextentries with amemoriesarray parse correctly throughRawEntry.src-tauri/src/parser/session.rs: Added full-session tests confirming memories appear on turns and that pre-v0.135.0 sessions produce an emptymemoriesVec without error.src-tauri/src/parser/turn.rs(tests): Added three tests covering: memories parsed correctly, pre-v0.135.0 no-memories path, and memories preserved independently per turn across a multi-turn session.Testing
tsc --noEmitcleancargo clippy -- -D warningscleanPOST /api/sessionsreturns 200Fixes
Fixes #85