[#143]: fix(parser): handle external-agent import item types for Codex v0.140.0/v0.141.0 compat#151
Open
delexw wants to merge 1 commit into
Open
[#143]: fix(parser): handle external-agent import item types for Codex v0.140.0/v0.141.0 compat#151delexw wants to merge 1 commit into
delexw wants to merge 1 commit into
Conversation
…x v0.140.0/v0.141.0 compat
Codex v0.140.0 (PRs #27070, #27071, #27703) added the /import command,
which writes new event_msg lifecycle entries (agent_context_imported,
external_agent_imported, etc.) into session transcripts before the first
task_started. Codex v0.141.0 (PR #28008) added external_agent_import_result,
an accounting-type response_item for imported agent context.
Add explicit named handlers in handle_event_msg for the import lifecycle
event_msg types and in handle_response_item for external_agent_import_result.
Both are treated as pass-through no-ops — the loosely-typed serde_json::Value
model already prevents hard errors, and the catch-all _ => {} handles any
additional undocumented variants. The explicit arms document the known types
for future readers.
Add 6 tests:
- entry.rs: v0.140.0 import event_msg and v0.141.0 external_agent_import_result
response_item parse correctly without panicking; full v0.140.0 session guard.
- turn.rs: import events before first task_started do not create spurious
synthetic turns; external_agent_import_result inside a turn does not corrupt
tool calls or agent messages; full turn integrity regression guard.
Fixes #143
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
Adds compatibility handling for Codex v0.140.0/v0.141.0 external-agent import item types introduced by the
/importcommand.Background
Codex v0.140.0 (PRs #27070, #27071, #27703) added the
/importcommand, which imports setup, project config, and recent chats from external agents (e.g. Claude Code). When used, the import flow writes newevent_msglifecycle entries into session transcripts — including entries that appear before the firsttask_startedevent. Codex v0.141.0 (PR #28008) addedexternal_agent_import_result, a new accounting-typeresponse_itemthat records token/cost totals for imported agent context.Changes
src-tauri/src/parser/turn.rshandle_event_msgfor/importlifecycle event_msg types (agent_context_import_started,agent_context_imported,external_agent_import_started,external_agent_imported). These are treated as pass-through no-ops with version/PR documentation.handle_response_itemforexternal_agent_import_result(v0.141.0 accounting type). Treated as pass-through.v0140_import_event_before_first_turn_does_not_corrupt_turns— import events beforetask_startedmust not create spurious synthetic turnsv0141_external_agent_import_result_inside_turn_does_not_corrupt_turn— accounting item inside a turn must not break tool calls or agent messagesv0140_all_standard_entry_types_plus_import_items_build_correct_turns— full turn integrity regression guard for v0.140.0 sessions with import itemssrc-tauri/src/parser/entry.rsv0140_agent_context_import_event_msg_parses_correctly— import lifecycle event_msg parses without panickingv0141_external_agent_import_result_response_item_parses_correctly— accounting response_item parses correctlyv0140_all_standard_entry_types_plus_import_items_parse_correctly— full v0.140.0 session regression guardWhy no structural parser changes?
The
RawEntryparser already uses a loosely-typedserde_json::Valuemodel, so new entry types flow through without hard errors. The existing_ => {}catch-alls inhandle_event_msgandhandle_response_itemalready silently ignored these types. This PR adds explicit named arms for the known import types to document the intended behaviour for future readers, plus tests to lock in that sessions with imported context parse cleanly.Verification
All 267 Rust tests pass (
cargo test --manifest-path src-tauri/Cargo.toml), all 135 frontend tests pass (npx vitest run),cargo clippy -- -D warningsis clean, andoxlint/oxfmtreport no issues.Fixes #143