Skip to content

test(parser): add regression-guard tests for Codex v0.144.0 writes app-approval mode#185

Merged
delexw merged 3 commits into
mainfrom
fix-issue-178
Jul 14, 2026
Merged

test(parser): add regression-guard tests for Codex v0.144.0 writes app-approval mode#185
delexw merged 3 commits into
mainfrom
fix-issue-178

Conversation

@delexw

@delexw delexw commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #178

Codex v0.144.0 (PR #30482) added a new ask_for_approval: "writes" value in session_meta payloads. 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::Value model already passes all session_meta fields through unchanged, so sessions with ask_for_approval: "writes" already parse without error. No code change is needed.

This PR adds four regression-guard tests to lock in that tolerance:

Test What it verifies
v0144_session_meta_with_ask_for_approval_writes_does_not_panic "writes" value parses and is accessible in payload
v0144_session_meta_unknown_ask_for_approval_value_is_tolerated Any future unknown approval-mode value also passes through
v0144_all_standard_entry_types_parse_correctly All five JSONL entry types parse correctly in a v0.144.0 session
v0144_ask_for_approval_writes_in_session_does_not_break_turn_parsing ask_for_approval on session_meta does not disrupt turn-building

The 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

  • vitest: 143 passed
  • cargo test: 325 passed (all 4 new v0144 tests pass)
  • cargo clippy -D warnings: clean
  • cargo fmt: clean

delexw added 2 commits July 12, 2026 11:05
…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
delexw merged commit 62b7895 into main Jul 14, 2026
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>
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.144.0: new writes app-approval mode added

2 participants