Discover permission profiles from the app server (#42453)

## Why

The permissions menu needs to reflect the profiles and configuration requirements available in the active app-server scope, including remote workspaces.

## What changed

- Load permission profiles and configuration requirements asynchronously when opening the permissions menu, using the active thread working directory.
- Render loading, retry, empty-catalog, and unsupported-server states, and fall back to the legacy permissions menu when explicit profiles are not configured.
- Disable profiles rejected by server requirements or unavailable in the catalog. Remote custom profiles remain visible but cannot yet be selected.
- Bound pagination and request time, reject malformed catalogs, and ignore responses made stale by account, thread, or modal changes.

## Testing

- Cover local, session-only, remote, legacy, empty, unsupported, pagination, malformed-response, and timeout discovery paths.
- Add TUI tests for loading, failures, retries, empty results, remote catalogs, stale responses, and working-directory changes.

GitOrigin-RevId: 3e2ab53a4eae1179587d064f9a4c605765ea7880
This commit is contained in:
Eric Traut authored and copyberry committed 2026-09-03 05:24:31 +00:00
1 parent 8b8ee28a9b
commit c9fecd3fa0
19 files changed
+797 -22

No files matched your search

@@ -0,0 +1,11 @@
---
source: tui/src/chatwidget/tests/permissions.rs
expression: "render_bottom_popup(&chat, 100)"
---
Update Model Permissions
No permission profiles returned by the server.
› current-profile (current) (disabled) Current permission profile. (disabled: Not available on
this server.)
Press enter to confirm or esc to go back
@@ -0,0 +1,10 @@
---
source: tui/src/chatwidget/tests/permissions.rs
expression: "render_bottom_popup(&chat, 80)"
---
Update Model Permissions
Failed to load permissions: disconnected
› 1. Retry
Press enter to confirm or esc to go back
@@ -0,0 +1,9 @@
---
source: tui/src/chatwidget/tests/permissions.rs
expression: "render_bottom_popup(&chat, 80)"
---
Update Model Permissions
› Loading permission profiles…
Press enter to confirm or esc to go back
@@ -0,0 +1,20 @@
---
source: tui/src/chatwidget/tests/permissions.rs
assertion_line: 50
expression: "render_bottom_popup(&chat, 110)"
---
Update Model Permissions
› 1. Ask for approval (current) Codex can read and edit files in the current workspace, and run commands.
Approval is required to access the internet or edit other files.
Approve for me (disabled) Only ask for actions detected as potentially unsafe. (disabled: Disabled by
requirements.)
Full Access (disabled) Codex can edit files outside this workspace and access the internet without
asking for approval. Exercise caution when using. (disabled: Disabled by
requirements.)
Read Only (disabled) Codex can read files in the current workspace. Approval is required to edit
files or access the internet. (disabled: Disabled by requirements.)
server-only (disabled) Description from the connected server. (disabled: Selecting custom profiles
from a remote server is not supported yet.)
Press enter to confirm or esc to go back