tui: add named permission profile picker#21559
Conversation
fcoury-oai
left a comment
There was a problem hiding this comment.
I found a potential issue with the help of Codex:
When I switch to a different named profile mid-session, the TUI updates correctly and /status shows the new profile.
But then the already-running session does not fully adopt that profile’s runtime state.
It seems like switching from a profile with no managed network proxy to one with profile-specific network policy leaves the live thread on the old proxy/network behavior.
So the UI says “profile B is active,” but the current session can still behave like profile A until a fresh session/thread is started.
Repro
This is the exact repro steps I used to replicate this issue.
Setup in ~/.codex/config.toml:
default_permissions = "locked-down"
[permissions.locked-down.filesystem]
":minimal" = "read"
[permissions.web-enabled.filesystem]
":minimal" = "read"
[permissions.web-enabled.filesystem.":project_roots"]
"." = "write"
[permissions.web-enabled.network]
enabled = true
allow_local_binding = true
[permissions.web-enabled.network.domains]
"example.com" = "allow"Important shape of the two profiles:
locked-downhas no network stanza at allweb-enabledenables network and adds a profile-specific allowlist forexample.com
Steps
- Start a fresh Codex TUI session with
locked-downactive. - Send one trivial prompt so there is a live session/thread.
- Run
/debug-config.
Observed after step 3:
- no
Session runtimenetwork_proxyblock is shown
- Run
/permissionsand switch toweb-enabled. - Run
/status.
Observed after step 5:
/statusshowsPermissions: Profile web-enabled (...)
- Run
/debug-configagain, in the same session.
Observed after step 6:
- still no
Session runtimenetwork_proxyblock
- In that same session, ask Codex:
Use the shell tool to run 'curl -I https://openai.com'
Observed after step 7:
- the request goes out and reaches OpenAI
- I got a real HTTP response path, ending in a Cloudflare challenge (
HTTP/2 403,cf-mitigated: challenge), which means the outbound request was not blocked by the profile-specific allowlist
Expected
After switching to web-enabled, the live session should pick up the profile’s managed network policy. Since web-enabled only allows example.com, a shell-tool request to https://openai.com should be blocked.
Actual
The UI updates to web-enabled, but the live session does not appear to gain the managed proxy/runtime state for that profile:
/statusreflects the new profile/debug-configstill shows no sessionnetwork_proxy- shell-tool network behavior still allows
openai.com
Why this looks like the bug
This matches the code path concern that mid-session /permissions updates the TUI/app config copy, but the live-session override does not carry enough data to fully apply the selected named profile’s runtime network state. It reproduces specifically when switching from a profile with no managed proxy to one that requires a managed proxy.
|
Addressed the runtime proxy gap in b140e5f. What changed:
Local checks:
|
b8a0eec to
653089d
Compare
Co-authored-by: Codex noreply@openai.com
653089d to
71ea260
Compare
Why
Users who opt into named permission profiles through
default_permissionsor[permissions.*]should stay in named-profile semantics when they open/permissions. The legacy picker currently rewrites those users into anonymous preset state, which loses the active profile identity and hides custom configured profiles.What changed
/permissionsto a profile-aware picker when profile mode is active.:profile syntax, while still listing configured custom profiles.Stack
/permissionsTUI.UX impact
In profile mode,
/permissionsnow shows the same human-facing built-ins users already know:Selecting
locked-downkeepsactive_permission_profile = Some("locked-down"); selecting a built-in keeps the friendly label while switching to its named built-in profile.Screenshots
Live
$test-tuismoke screenshots uploaded through GitHub attachments:Profile mode with built-ins and custom profiles
Legacy mode remains anonymous preset picker
Verification
cargo test -p codex-tui profile_permissions_cargo test -p codex-tui apply_permission_profile_selection_ignores_legacy_harness_overrides/permissionsflows with$test-tui.cargo test -p codex-tuistill hits two existingstatus::tests::*full_disk_managed*failures on this machine because the local MDM requirements disallow synthesizingdanger-full-access; the new profile-picker tests pass.