Skip to content

app-server: stop returning thread permission profiles#22792

Merged
bolinfest merged 1 commit into
mainfrom
pr22792
May 15, 2026
Merged

app-server: stop returning thread permission profiles#22792
bolinfest merged 1 commit into
mainfrom
pr22792

Conversation

@bolinfest
Copy link
Copy Markdown
Collaborator

@bolinfest bolinfest commented May 15, 2026

Why

The app-server thread lifecycle API should no longer expose the full PermissionProfile value. After the permissions-profile migration, clients should round-trip only the active profile identity through activePermissionProfile and permissions when that identity is known.

The full profile is server-side config. Treating a response-derived legacy sandbox projection as a new local profile can lose named-profile restrictions and accidentally widen permissions on the next turn. The legacy sandbox response field remains only as the compatibility/display fallback.

What Changed

  • Removed permissionProfile from ThreadStartResponse, ThreadResumeResponse, and ThreadForkResponse.
  • Stopped populating that field in app-server thread start/resume/fork responses.
  • Updated embedded exec/TUI response mapping to derive display permission state from local config or the legacy sandbox fallback instead of a response profile value.
  • Added a TUI turn override shape that distinguishes preserving server permissions, selecting an active profile id, and sending a legacy sandbox for an explicit local override.
  • Preserved remote app-server permissions across turns by sending permissions only when an activePermissionProfile id is known, and otherwise sending no sandbox override unless the user selected a local override.
  • Kept embedded thread/resume hydration server-authored when activePermissionProfile is absent, which matches the live-thread attach path where the server ignores requested overrides.
  • Updated the app-server README to remove the obsolete lifecycle response permissionProfile reference. The remaining permissionProfile README references are request-side permission overrides.
  • Regenerated app-server JSON schema and TypeScript fixtures.
  • Kept the generated typed response enum exempt from large_enum_variant, matching the existing payload enum exemption after the lifecycle response variants shrank.

How To Review

Start with codex-rs/app-server-protocol/src/protocol/v2/thread.rs to confirm the response shape, then check the response construction in codex-rs/app-server/src/request_processors. The generated schema and TypeScript fixture changes are mechanical follow-through from the protocol removal.

The TUI behavior is the delicate part: review codex-rs/tui/src/app_server_session.rs for response hydration and turn-start override projection, then codex-rs/tui/src/app/thread_routing.rs for the decision about whether the next turn should preserve the server snapshot, send an active profile id, or send a legacy sandbox for an explicit local override.

Verification

  • just write-app-server-schema
  • cargo test -p codex-app-server-protocol thread_lifecycle_responses_default_missing_optional_fields
  • cargo test -p codex-exec session_configured_from_thread_response_uses_permission_profile_from_config
  • cargo test -p codex-tui --lib thread_response
  • cargo test -p codex-tui turn_permissions_
  • cargo test -p codex-tui resume_response_restores_turns_from_thread_items
  • cargo test -p codex-analytics track_response_only_enqueues_analytics_relevant_responses
  • just fix -p codex-analytics
  • just fix -p codex-app-server-protocol
  • just fix -p codex-tui
  • just argument-comment-lint

Stack created with Sapling. Best reviewed with ReviewStack.

Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8e7e4c06bf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread codex-rs/app-server-protocol/src/protocol/v2/thread.rs
Comment thread codex-rs/tui/src/app_server_session.rs
Copy link
Copy Markdown
Collaborator

@viyatb-oai viyatb-oai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flagging one resume-path regression that looks worth fixing before merge.

Comment thread codex-rs/tui/src/app_server_session.rs Outdated
bolinfest added a commit that referenced this pull request May 15, 2026
## Why

`SandboxPolicy` is being pushed back toward legacy config loading and
compatibility boundaries. Guardian review sessions already want the
built-in read-only permission behavior; carrying that as an active
`PermissionProfile` makes the review sandbox follow the new permissions
path instead of configuring the child session through the legacy policy
API.

## What Changed

- Configure the guardian review session with
`PermissionProfile::read_only()`.
- Send the read-only profile through the guardian child `Op::UserTurn`.
- Keep the legacy `sandbox_policy` field populated with
`SandboxPolicy::new_read_only_policy()` declared next to the profile so
the two remain visibly in sync until the compatibility field goes away.

## How To Review

Start in `codex-rs/core/src/guardian/review_session.rs`. The important
check is that both the guardian config and the child turn now use the
read-only permission profile, while the remaining
`SandboxPolicy::ReadOnly` assignment is only the compatibility field
required by the current turn protocol.

## Verification

- `cargo test -p codex-core
guardian_review_session_config_clears_parent_developer_instructions`





---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/22789).
* #22795
* #22792
* #22791
* #22790
* __->__ #22789
bolinfest added a commit that referenced this pull request May 15, 2026
## Why

The permissions instruction builder should consume the new permissions
model directly. Keeping a `SandboxPolicy` conversion helper in this path
encourages new code to route through legacy sandbox policy values even
when the caller already has a `PermissionProfile`.

## What Changed

- Removed `PermissionsInstructions::from_policy`.
- Removed the test that exercised that legacy helper.
- Left the existing profile-based instruction coverage in place.

## How To Review

Review `codex-rs/core/src/context/permissions_instructions.rs` first.
This PR is intentionally narrow: the production behavior should be
unchanged for profile callers, and the deleted surface was only a
convenience adapter from `SandboxPolicy`.

## Verification

- `cargo test -p codex-core builds_permissions_from_profile`








---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/22790).
* #22795
* #22792
* #22791
* __->__ #22790
bolinfest added a commit that referenced this pull request May 15, 2026
## Why

Sandbox telemetry tags should be derived from the active permission
profile, not from a legacy `SandboxPolicy`, so the tagging code stays
aligned with the permissions migration and does not preserve a
policy-shaped production helper only for tests.

## What Changed

- Removed the production `sandbox_tag(&SandboxPolicy, ...)` helper.
- Updated sandbox tag tests to construct the relevant
`PermissionProfile` values directly.
- Kept the platform-specific sandbox tag behavior under the existing
`permission_profile_sandbox_tag` path.

## How To Review

The production change is in `codex-rs/core/src/sandbox_tags.rs`. Most of
the diff is test cleanup that replaces legacy policy setup with
permission profiles, so review the expected tag assertions rather than
the old helper mechanics.

## Verification

- `cargo test -p codex-core sandbox_tag`









---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/22791).
* #22795
* #22792
* __->__ #22791
Base automatically changed from pr22791 to main May 15, 2026 17:58
@bolinfest bolinfest force-pushed the pr22792 branch 2 times, most recently from bcf35da to 6db97e9 Compare May 15, 2026 18:28
@bolinfest bolinfest merged commit 83bbb4f into main May 15, 2026
45 of 46 checks passed
@bolinfest bolinfest deleted the pr22792 branch May 15, 2026 19:45
@github-actions github-actions Bot locked and limited conversation to collaborators May 15, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants