mirror of
https://github.com/openai/codex.git
synced 2026-12-02 00:31:03 +00:00
Fix granular approval defaults at projectless TUI startup (#65086)
## Why An `approval_policy` in the client's config could suppress the granular default when starting a projectless session with server-owned defaults. ## What changed Make the granular default available at startup so the launch code can apply it when the invocation leaves the policy unset and the server allows it. ## Testing Extend the server-defaults startup test to set the client's policy to `never` and verify that `thread/start` still requests granular approval. GitOrigin-RevId: 770aa978e2372e1e30fe778b670ea25f9c3c1cd0
This commit is contained in:
@@ -346,7 +346,10 @@ async fn local_projectless_defaults_respect_trust_scope_and_explicit_settings()
|
||||
&EnvironmentManager::default_for_tests(),
|
||||
);
|
||||
if expected_approval.is_some() {
|
||||
assert_eq!(startup.approval_policy, None);
|
||||
assert!(matches!(
|
||||
startup.approval_policy,
|
||||
Some(Approval::Granular(_))
|
||||
));
|
||||
}
|
||||
assert_eq!(
|
||||
startup.prompt_windows_sandbox,
|
||||
|
||||
@@ -919,7 +919,7 @@ async fn startup_with_server_defaults() -> Result<()> {
|
||||
let projectless_cwd = tempdir()?;
|
||||
std::fs::write(
|
||||
client_home.path().join("config.toml"),
|
||||
"model = \"client-model\"\nmodel_reasoning_effort = \"low\"\n",
|
||||
"model = \"client-model\"\nmodel_reasoning_effort = \"low\"\napproval_policy = \"never\"\n",
|
||||
)?;
|
||||
std::fs::write(
|
||||
server_home.path().join("config.toml"),
|
||||
|
||||
@@ -76,9 +76,13 @@ pub(crate) fn apply_defaults(
|
||||
request_permissions: true,
|
||||
mcp_elicitations: true,
|
||||
});
|
||||
// Fresh startup checks invocation choices and server requirements separately.
|
||||
// Directory transitions still use the scoped config below.
|
||||
let mut applied = AppliedDefaults::default();
|
||||
if defaults.approval_policy.is_none() {
|
||||
applied.approval_policy = Some(granular);
|
||||
}
|
||||
if overrides.approval_policy.is_none() && effective.get("approval_policy").is_none() {
|
||||
applied.approval_policy = defaults.approval_policy.is_none().then_some(granular);
|
||||
let granular = defaults
|
||||
.approval_policy
|
||||
.as_ref()
|
||||
|
||||
Reference in New Issue
Block a user