core: refresh active permission profiles at runtime#22931
Merged
Conversation
This was referenced May 16, 2026
7335c4a to
a48a30d
Compare
96866bc to
5efda09
Compare
viyatb-oai
added a commit
that referenced
this pull request
May 19, 2026
## Why The `/permissions` picker needs a config-level way to distinguish legacy anonymous presets from named permission-profile mode. That signal cannot be inferred reliably in the TUI, especially for the edge case where `default_permissions = ":workspace"` is present without a `[permissions]` table. ## What changed - Expose whether the merged config is explicitly in permission-profile mode. - Expose the configured custom permission profile IDs alongside the built-in profile semantics. - Add regression coverage for profile mode detection and custom profile metadata, including the `default_permissions = ":workspace"` case. - Update the thread-manager sample config literal to match the expanded config shape. ## Stack 1. **This PR**: config metadata needed by downstream permission-profile consumers. 2. [#22931](#22931): refresh active permission profiles through runtime/session/network state. 3. [#21559](#21559): switch `/permissions` to the profile-aware TUI picker. ## Verification - `cargo check -p codex-thread-manager-sample` - `cargo test -p codex-core default_permissions_can_select_builtin_profile_without_permissions_table` - `cargo test -p codex-core permissions_profiles_allow_direct_write_roots_outside_workspace_root`
98b8aab to
6d4a8df
Compare
etraut-openai
approved these changes
May 20, 2026
Collaborator
etraut-openai
left a comment
There was a problem hiding this comment.
Overall code looks good. I left one question, and there's one codex-caught issue below.
I built and manually tested affected code paths in TUI using a test config file.
I ran a local code review with codex, and it spotted one potential problem that may be worth looking at. In turn_context.rs line 566, it performs an equality check to compare two PermissionProfiles. Two named profiles can compile to the same PermissionProfile while having different network proxy URLs/domains, so selecting the second profile rebuilds session config but skips the live proxy refresh.
Example config for repro:
[permissions.web-a.filesystem]
":minimal" = "read"
[permissions.web-a.network]
enabled = true
proxy_url = "http://127.0.0.1:1111"
[permissions.web-b.filesystem]
":minimal" = "read"
[permissions.web-b.network]
enabled = true
proxy_url = "http://127.0.0.1:2222"e0764d3 to
923b79d
Compare
Co-authored-by: Codex noreply@openai.com
Co-authored-by: Codex noreply@openai.com
Co-authored-by: Codex noreply@openai.com
Co-authored-by: Codex noreply@openai.com
Co-authored-by: Codex noreply@openai.com
Co-authored-by: Codex noreply@openai.com
Co-authored-by: Codex noreply@openai.com
Co-authored-by: Codex noreply@openai.com
Co-authored-by: Codex noreply@openai.com
923b79d to
9badcc1
Compare
Co-authored-by: Codex noreply@openai.com
Co-authored-by: Codex noreply@openai.com
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Once a named permission profile is selected, runtime state has to keep that profile identity intact instead of collapsing back to anonymous effective permissions. The session refresh path also needs to rebuild profile-derived network proxy state so active profile switches take effect consistently.
What changed
Stack
/permissionsmenu and custom profile display.