Preserve saved permissions when resuming or forking remote tasks (#43330)

## Why

Local permission settings could overwrite a remote task's saved server settings when resuming or forking, including its named permission profile.

## What changed

- Omit permission overrides from remote resume requests and remote fork requests that inherit saved settings.
- Reject explicit permission overrides when resuming or forking remote tasks, including overrides from session flags and selected configuration profiles.
- Refresh restored runtime permission and approval overrides after a remote resume so settings from the previous task do not persist.
- Carry the selected fork permission mode through retries after unarchiving.

## Testing

Add regression coverage for restoring saved server permission profiles, approval policies, and approval reviewers across resume and fork; rejecting explicit remote resume overrides; and clearing stale restored runtime overrides.

GitOrigin-RevId: 465c0444df380553e50ddbeeceff9dc64e5bf9c1
This commit is contained in:
Eric Traut authored and copyberry committed 2026-09-07 02:28:25 +00:00
1 parent 112be0bd74
commit 1fb5158b34
11 files changed
+473 -19

No files matched your search

+10 -4
View File
@@ -4,6 +4,7 @@ use crate::app::AppExitInfo;
use crate::app::ExitReason;
use crate::app_server_session::AppServerSession;
use crate::app_server_session::AppServerStartedThread;
use crate::app_server_session::ForkPermissionMode;
use crate::app_server_session::ResumeModelSettings;
use crate::legacy_core::config::Config;
use crate::resume_picker::SessionTarget;
@@ -14,14 +15,14 @@ use color_eyre::eyre::WrapErr;
#[derive(Clone, Copy)]
pub(crate) enum SessionStartAction {
Resume(ResumeModelSettings),
Fork,
Fork(ForkPermissionMode),
}
impl SessionStartAction {
pub(crate) fn verb(self) -> &'static str {
match self {
Self::Resume(_) => "resume",
Self::Fork => "fork",
Self::Fork(_) => "fork",
}
}
@@ -38,9 +39,14 @@ impl SessionStartAction {
.resume_thread(&local_settings, config.clone(), target.thread_id, settings)
.await
}
Self::Fork => {
Self::Fork(permission_mode) => {
app_server
.fork_thread(&local_settings, config.clone(), target.thread_id)
.fork_thread_with_permission_mode(
&local_settings,
config.clone(),
target.thread_id,
permission_mode,
)
.await
}
}