Scope resume --approve-for-me to the initial conversation (#63589)

## Why

An already-loaded conversation can ignore permission overrides sent with
a resume request. Applying the preset to the TUI's launch configuration
can also carry it into later conversations.

## What changed

Resolve the preset using the selected conversation's workspace and
managed requirements. Apply it only to the initial resume, so `/new`
and later resumes use the regular launch configuration.

If an already-loaded conversation needs a settings update, read back
its approval and sandbox settings before submitting the initial prompt.
Stop the resume when the server cannot confirm the requested settings
or when workspace or managed restrictions cannot be verified.

## Testing

Regression tests cover CLI flag precedence, updating an already-loaded
conversation, rejecting unverifiable restrictions, and keeping the
preset out of new and subsequently resumed conversations.

GitOrigin-RevId: 6a09097dfc64fdeb890c03cd3e56bb404e5199c8
This commit is contained in:
Eric Traut
2026-11-24 09:35:28 +00:00
committed by copyberry
parent 74f208237b
commit 7ce4437488
9 changed files with 424 additions and 43 deletions
+11
View File
@@ -6,6 +6,13 @@ use codex_utils_cli::ApprovalModeCliArg;
use codex_utils_cli::CliConfigOverrides;
use codex_utils_cli::SharedCliOptions;
/// Permission preset and its precedence on the first resume only.
#[derive(Clone, Debug)]
pub struct ResumeApprovalPreset {
pub config: CliConfigOverrides,
pub overrides_root_permissions: bool,
}
#[derive(Parser, Clone, Debug)]
#[command(version)]
pub struct Cli {
@@ -34,6 +41,10 @@ pub struct Cli {
#[clap(skip)]
pub resume_session_id: Option<String>,
/// Launch overrides including the approval preset, scoped to the initial resume.
#[clap(skip)]
pub resume_approval_preset: Option<ResumeApprovalPreset>,
/// Internal: show all sessions (disables cwd filtering and shows CWD column).
#[clap(skip)]
pub resume_show_all: bool,