test(parser): add regression-guard tests for Codex v0.144.0 writes app-approval mode#185
Merged
Conversation
…p-approval mode Codex v0.144.0 (PR #30482) introduced a new ask_for_approval: "writes" value in session_meta payloads. The loosely-typed serde_json::Value model already tolerates this without code changes. Add four regression-guard tests that lock in this tolerance: - v0144_session_meta_with_ask_for_approval_writes_does_not_panic - v0144_session_meta_unknown_ask_for_approval_value_is_tolerated - v0144_all_standard_entry_types_parse_correctly - v0144_ask_for_approval_writes_in_session_does_not_break_turn_parsing The unknown-value test also guards against future regressions if strict enum validation were ever introduced for approval modes. Fixes #178
Codex v0.144.0 (PR #30482) added a new 'writes' approval mode to the ask_for_approval field in session_meta. codex-trace was silently dropping this field — it was parsed by serde_json::Value but never extracted. Add approval_mode: Option<String> to CodexSession (full parse) and CodexSessionInfo (fast discovery scan). Populate from session_meta.ask_for_approval using the existing opt_str() helper. Update shared/types.ts to expose approval_mode: string | null on both TypeScript interfaces. Add 7 regression tests covering all four known approval modes (suggest, auto-edit, full-auto, writes) and backward compatibility for sessions predating v0.144.0 (None when ask_for_approval is absent). Update existing test fixtures (InfoBar, SidebarTree, ToolCallItem, WorkerPanel, sessionDisplay) to include approval_mode: null so TypeScript strict checking passes. Fixes #178
delexw
added a commit
that referenced
this pull request
Jul 14, 2026
PR #185 added `approval_mode: None` to `state.rs` test fixtures and `approval_mode: string | null` to the TypeScript CodexSession / CodexSessionInfo interfaces, but never added the corresponding field to the Rust CodexSessionInfo struct in discover.rs. This left main red with E0560: 'struct CodexSessionInfo has no field named approval_mode'. Adds: - `pub approval_mode: Option<String>` to CodexSessionInfo - Extraction from session_meta.ask_for_approval in scan_session_file - None for session_meta_root sessions (no approval mode captured there) 339 lib tests pass; clippy -D warnings clean. Co-authored-by: Claude <noreply@anthropic.com>
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
Fixes #178
Codex v0.144.0 (PR #30482) added a new
ask_for_approval: "writes"value insession_metapayloads. This mode sits between"auto"(never prompt) and always-prompt — it allows declared read-only actions to proceed automatically while prompting for write actions.codex-trace's loosely-typed
serde_json::Valuemodel already passes allsession_metafields through unchanged, so sessions withask_for_approval: "writes"already parse without error. No code change is needed.This PR adds four regression-guard tests to lock in that tolerance:
v0144_session_meta_with_ask_for_approval_writes_does_not_panic"writes"value parses and is accessible in payloadv0144_session_meta_unknown_ask_for_approval_value_is_toleratedv0144_all_standard_entry_types_parse_correctlyv0144_ask_for_approval_writes_in_session_does_not_break_turn_parsingask_for_approvalonsession_metadoes not disrupt turn-buildingThe forward-compat test (
unknown_ask_for_approval_value_is_tolerated) guards against future regressions if strict enum validation were ever introduced for approval modes.Test results