mirror of
https://github.com/openai/codex.git
synced 2026-11-16 06:54:36 +00:00
Preserve environment configuration ownership (#38678)
## Why Environment attachments can either inherit configuration from their thread or provide their own. Later thread setting updates must refresh inherited configuration without overwriting attachment-owned permissions and capability roots. ## What changed - Resolve each attachment's configuration when it is selected and retain whether it came from the thread or the attachment owner. - Apply subsequent thread configuration updates only to thread-owned attachments, while preserving ownership across snapshots and child threads. - Keep the resolved configuration with the environment selection so runtime consumers use a single canonical value. ## Testing - Extend remote-environment coverage to verify that thread-owned permissions follow thread updates while owner-provided read-only permissions remain in effect. - Cover configuration inheritance, attachment replacement, and owner-configured capability roots. GitOrigin-RevId: fe70c4be5f151432b69bf4b141e316faa89036ae
This commit is contained in:
1 parent
233739e76a
commit
22bf16a37e
23 files changed
+343
-192
No files matched your search
@@ -1057,18 +1057,22 @@ async fn run_review_on_session(
|
||||
.permissions
|
||||
.permission_profile_state()
|
||||
.snapshot();
|
||||
let mut parent_turn_environments = params.parent_context.environments().to_selections();
|
||||
// FromThread inherits the Guardian profile below. Once Core normalizes FromThread
|
||||
// to Ready(config), every selection will carry explicit config and this conditional can be
|
||||
// removed.
|
||||
for selection in &mut parent_turn_environments {
|
||||
if let EnvironmentConfigState::Ready(config) = &mut selection.config {
|
||||
// Guardian must receive read-only permissions for every inherited environment.
|
||||
let parent_turn_environments = params
|
||||
.parent_context
|
||||
.environments()
|
||||
.turn_environments()
|
||||
.map(|environment| {
|
||||
let mut selection = environment.selection();
|
||||
let mut config = environment.config().clone();
|
||||
config.permission_profile =
|
||||
PermissionProfileSnapshot::legacy(read_only_guardian_permission_profile(
|
||||
config.permission_profile.permission_profile(),
|
||||
));
|
||||
}
|
||||
}
|
||||
selection.config = EnvironmentConfigState::Ready(config);
|
||||
selection
|
||||
})
|
||||
.collect();
|
||||
// TODO(anp): Migrate guardian review thread settings to a PathUri fallback cwd so foreign
|
||||
// parent environments do not fall back to the host-native config cwd.
|
||||
let parent_turn_legacy_fallback_cwd = params
|
||||
|
||||
@@ -628,7 +628,7 @@ async fn build_guardian_prompt_includes_parent_turn_denied_reads() -> anyhow::Re
|
||||
let TurnEnvironmentState::Ready(environment) = &mut turn.environments.environments[0] else {
|
||||
panic!("parent environment should be ready");
|
||||
};
|
||||
environment.config.permission_profile =
|
||||
environment.config_mut().permission_profile =
|
||||
PermissionProfileSnapshot::legacy(environment_permission_profile);
|
||||
environment.selection.workspace_roots = vec![
|
||||
PathUri::from_abs_path(&workspace_root),
|
||||
|
||||
Reference in new issue
Block a user