feat(core): add conversational permission preset foundation

Add the opt-in `request_permission_preset` flow across `codex-core`, `codex-protocol`, and `codex-tools`, including preset definitions, request state, tool wiring, and focused regression coverage for preset-driven permission changes.

Validate preset responses against pending call ids before applying them, re-resolve accepted presets against the current session, and record turn-local overrides only after `update_settings` succeeds so stale or rejected replies cannot widen permissions.
This commit is contained in:
Felipe Coury
2026-04-12 21:08:51 -03:00
parent 46ab9974dc
commit ffa0ea303d
41 changed files with 1626 additions and 41 deletions

View File

@@ -97,6 +97,8 @@ pub enum Feature {
CodexHooks,
/// Expose the built-in request_permissions tool.
RequestPermissionsTool,
/// Expose the built-in request_permission_preset tool.
RequestPermissionPresetTool,
/// Allow the model to request web searches that fetch live content.
WebSearchRequest,
/// Allow the model to request web searches that fetch cached content.
@@ -706,8 +708,14 @@ pub const FEATURES: &[FeatureSpec] = &[
FeatureSpec {
id: Feature::RequestPermissionsTool,
key: "request_permissions_tool",
stage: Stage::UnderDevelopment,
default_enabled: false,
stage: Stage::Stable,
default_enabled: true,
},
FeatureSpec {
id: Feature::RequestPermissionPresetTool,
key: "request_permission_preset_tool",
stage: Stage::Stable,
default_enabled: true,
},
FeatureSpec {
id: Feature::UseLinuxSandboxBwrap,

View File

@@ -107,12 +107,15 @@ fn request_permissions_is_under_development() {
}
#[test]
fn request_permissions_tool_is_under_development() {
assert_eq!(
Feature::RequestPermissionsTool.stage(),
Stage::UnderDevelopment
);
assert_eq!(Feature::RequestPermissionsTool.default_enabled(), false);
fn request_permissions_tool_is_stable_and_enabled_by_default() {
assert_eq!(Feature::RequestPermissionsTool.stage(), Stage::Stable);
assert_eq!(Feature::RequestPermissionsTool.default_enabled(), true);
}
#[test]
fn request_permission_preset_tool_is_stable_and_enabled_by_default() {
assert_eq!(Feature::RequestPermissionPresetTool.stage(), Stage::Stable);
assert_eq!(Feature::RequestPermissionPresetTool.default_enabled(), true);
}
#[test]