core-agent-ide/codex-rs/tui/src
Owen Lin 66450f0445
fix: implement 'Allow this session' for apply_patch approvals (#8451)
**Summary**
This PR makes “ApprovalDecision::AcceptForSession / don’t ask again this
session” actually work for `apply_patch` approvals by caching approvals
based on absolute file paths in codex-core, properly wiring it through
app-server v2, and exposing the choice in both TUI and TUI2.
- This brings `apply_patch` calls to be at feature-parity with general
shell commands, which also have a "Yes, and don't ask again" option.
- This also fixes VSCE's "Allow this session" button to actually work.

While we're at it, also split the app-server v2 protocol's
`ApprovalDecision` enum so execpolicy amendments are only available for
command execution approvals.

**Key changes**
- Core: per-session patch approval allowlist keyed by absolute file
paths
- Handles multi-file patches and renames/moves by recording both source
and destination paths for `Update { move_path: Some(...) }`.
- Extend the `Approvable` trait and `ApplyPatchRuntime` to work with
multiple keys, because an `apply_patch` tool call can modify multiple
files. For a request to be auto-approved, we will need to check that all
file paths have been approved previously.
- App-server v2: honor AcceptForSession for file changes
- File-change approval responses now map AcceptForSession to
ReviewDecision::ApprovedForSession (no longer downgraded to plain
Approved).
- Replace `ApprovalDecision` with two enums:
`CommandExecutionApprovalDecision` and `FileChangeApprovalDecision`
- TUI / TUI2: expose “don’t ask again for these files this session”
- Patch approval overlays now include a third option (“Yes, and don’t
ask again for these files this session (s)”).
    - Snapshot updates for the approval modal.

**Tests added/updated**
- Core:
- Integration test that proves ApprovedForSession on a patch skips the
next patch prompt for the same file
- App-server:
- v2 integration test verifying
FileChangeApprovalDecision::AcceptForSession works properly

**User-visible behavior**
- When the user approves a patch “for session”, future patches touching
only those previously approved file(s) will no longer prompt gain during
that session (both via app-server v2 and TUI/TUI2).

**Manual testing**
Tested both TUI and TUI2 - see screenshots below.

TUI:
<img width="1082" height="355" alt="image"
src="https://github.com/user-attachments/assets/adcf45ad-d428-498d-92fc-1a0a420878d9"
/>


TUI2:
<img width="1089" height="438" alt="image"
src="https://github.com/user-attachments/assets/dd768b1a-2f5f-4bd6-98fd-e52c1d3abd9e"
/>
2026-01-07 20:11:12 +00:00
..
bin replace tui_markdown with a custom markdown renderer (#3396) 2025-09-10 12:13:53 -07:00
bottom_pane fix: implement 'Allow this session' for apply_patch approvals (#8451) 2026-01-07 20:11:12 +00:00
chatwidget fix: implement 'Allow this session' for apply_patch approvals (#8451) 2026-01-07 20:11:12 +00:00
exec_cell Slightly better status display for unified exec (#7563) 2025-12-04 08:32:54 -08:00
notifications Fix toasts on Windows under WSL 2 (#7137) 2025-12-11 15:09:00 -08:00
onboarding [device-auth] Update login instruction for headless environments. (#8753) 2026-01-05 13:46:42 -08:00
public_widgets tui: refactor ChatWidget and BottomPane to use Renderables (#5565) 2025-11-05 09:50:40 -08:00
render tui: refactor ChatWidget and BottomPane to use Renderables (#5565) 2025-11-05 09:50:40 -08:00
snapshots Enable model upgrade popup even when selected model is no longer in picker (#8802) 2026-01-06 19:32:27 -08:00
status Merge Modelfamily into modelinfo (#8763) 2026-01-07 10:35:09 -08:00
streaming tui: drop citation rendering (#4855) 2025-10-20 21:08:19 +00:00
tui perf(tui): cap redraw scheduling to 60fps (#8499) 2025-12-23 19:10:15 -08:00
additional_dirs.rs feat: introduce ExternalSandbox policy (#8290) 2025-12-18 17:02:03 -08:00
app.rs Stop using AuthManager as the source of codex_home (#8846) 2026-01-07 18:56:20 +00:00
app_backtrack.rs chore: unify conversation with thread name (#8830) 2026-01-07 17:04:53 +00:00
app_event.rs feat: open prompt in configured external editor (#7606) 2025-12-22 15:12:23 -08:00
app_event_sender.rs tui: switch to using tokio + EventStream for processing crossterm events (#2489) 2025-08-20 17:11:09 +00:00
ascii_animation.rs chore: remove model upgrade popup (#4332) 2025-09-27 13:25:09 -07:00
chatwidget.rs remove unnecessary todos (#8842) 2026-01-07 10:43:10 -08:00
cli.rs tui: add branch to 'codex resume', filter by cwd (#6232) 2025-11-19 00:47:37 +00:00
clipboard_paste.rs FIX: WSL Paste image does not work (#6793) 2025-12-04 10:50:20 -08:00
color.rs update composer + user message styling (#4240) 2025-09-26 16:35:56 -07:00
custom_terminal.rs refactor(terminal): cleanup deprecated flush logic (#6373) 2025-11-07 15:54:07 -08:00
diff_render.rs fix: render cwd-relative paths in tui (#8771) 2026-01-06 03:17:40 +00:00
exec_command.rs fix(windows) shell_command on windows, minor parsing (#6811) 2025-11-17 22:23:53 -08:00
external_editor.rs feat: open prompt in configured external editor (#7606) 2025-12-22 15:12:23 -08:00
file_search.rs Bumped number of fuzzy search results from 8 to 20 (#7013) 2025-11-20 12:33:12 -08:00
frames.rs Login flow polish (#3632) 2025-09-15 00:42:53 -07:00
get_git_diff.rs Show progress indicator for /diff command (#2245) 2025-08-15 15:32:41 -07:00
history_cell.rs chore: rename unified exec sessions (#8822) 2026-01-07 16:12:47 +00:00
insert_history.rs fix(tui): propagate errors in insert_history_lines_to_writer (#4266) 2025-10-30 18:07:51 -07:00
key_hint.rs Add vim navigation keys to transcript pager (#7550) 2025-12-09 10:23:11 -08:00
lib.rs chore: unify conversation with thread name (#8830) 2026-01-07 17:04:53 +00:00
live_wrap.rs Stream model responses (#1810) 2025-08-05 04:23:22 +00:00
main.rs fix codex resume message at end of session (#3957) 2025-09-22 22:24:31 +00:00
markdown.rs tui: drop citation rendering (#4855) 2025-10-20 21:08:19 +00:00
markdown_render.rs Changed default wrap algorithm from OptimalFit to FirstFit (#7960) 2025-12-12 21:47:37 -08:00
markdown_render_tests.rs tui: centralize markdown styling and make inline code cyan (#7023) 2025-11-20 21:06:22 +00:00
markdown_stream.rs tui: drop citation rendering (#4855) 2025-10-20 21:08:19 +00:00
model_migration.rs splash screen (#8270) 2025-12-18 10:59:53 -08:00
oss_selection.rs LM Studio OSS Support (#2312) 2025-11-17 11:49:09 -08:00
pager_overlay.rs Add vim navigation keys to transcript pager (#7550) 2025-12-09 10:23:11 -08:00
resume_picker.rs chore: unify conversation with thread name (#8830) 2026-01-07 17:04:53 +00:00
selection_list.rs splash screen (#8270) 2025-12-18 10:59:53 -08:00
session_log.rs tui: bring the transcript closer to display mode (#4848) 2025-10-07 16:18:48 -07:00
shimmer.rs tui: hardcode xterm palette, shimmer blends between fg and bg (#4957) 2025-10-08 20:23:13 +00:00
slash_command.rs chore: un-ship undo (#8424) 2025-12-22 09:53:03 +01:00
status_indicator_widget.rs [tui] add optional details to TUI status header (#8293) 2025-12-23 12:40:40 -08:00
style.rs tui: hardcode xterm palette, shimmer blends between fg and bg (#4957) 2025-10-08 20:23:13 +00:00
terminal_palette.rs perf(tui2): cache transcript view rendering (#8693) 2026-01-03 11:44:27 -08:00
test_backend.rs feat: Constrain values for approval_policy (#7778) 2025-12-17 16:19:27 +00:00
text_formatting.rs [tui] add optional details to TUI status header (#8293) 2025-12-23 12:40:40 -08:00
tooltips.rs feat: forced tool tips (#8752) 2026-01-06 18:02:05 +00:00
tui.rs perf(tui): cap redraw scheduling to 60fps (#8499) 2025-12-23 19:10:15 -08:00
ui_consts.rs Fixes (#4458) 2025-09-30 00:10:04 +00:00
update_action.rs fix: update brew auto update version check (#6238) 2025-11-10 09:05:00 -08:00
update_prompt.rs fix: update brew auto update version check (#6238) 2025-11-10 09:05:00 -08:00
updates.rs Allow enterprises to skip upgrade checks and messages (#7213) 2025-11-24 15:04:49 -05:00
version.rs Added CLI version to /status output (#3223) 2025-09-05 16:27:31 -07:00
wrapping.rs Changed default wrap algorithm from OptimalFit to FirstFit (#7960) 2025-12-12 21:47:37 -08:00