GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — permissions: store thread sessions as profiles by bolinfest · Pull Request #19776 · openai/codex

Conversation

@bolinfest

@bolinfest bolinfest commented Apr 27, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

Why

After thread sessions have a required PermissionProfile, the TUI no longer needs to cache a separate legacy SandboxPolicy in ThreadSessionState. Keeping the legacy field would reintroduce two permission authorities in the session cache and make later replay/switching logic easier to get wrong.

This PR keeps legacy app-server compatibility at the ingestion boundary: old sandbox response values are still accepted, but they are immediately converted to a cwd-anchored profile.

What Changed

  • Removes ThreadSessionState.sandbox_policy.
  • Updates active-session permission syncing to write only the current PermissionProfile.
  • Updates thread-read/replay/test fixtures to use profiles as the cached session permission source.
  • Leaves legacy sandbox fields in app-server request/response protocol paths unchanged; those are compatibility boundaries and are converted before entering cached TUI state.

Verification

  • cargo test -p codex-tui thread_session_state::tests --lib
  • cargo test -p codex-tui inactive_thread_started_notification_initializes_replay_session --lib
  • cargo test -p codex-tui thread_events --lib
  • just fix -p codex-tui

Stack created with Sapling. Best reviewed with ReviewStack.

  • permissions: add built-in default profiles #19900
  • app-server-protocol: mark permission profiles experimental #19899
  • -> permissions: store thread sessions as profiles #19776

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

chatgpt-codex-connector[bot] reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
This was referenced Apr 27, 2026
permissions: derive snapshot sandbox projections #19775
Merged
permissions: require profiles in TUI thread state #19773
Merged
permissions: derive config defaults as profiles #19772
Merged
permissions: make SessionConfigured profile-only #19774
Merged
@bolinfest
bolinfest force-pushed the pr19776 branch from 14d7367 to 4386fc0 Compare April 27, 2026 05:59
@bolinfest
bolinfest force-pushed the pr19775 branch from 9facea6 to 3841eb0 Compare April 27, 2026 05:59
@bolinfest
bolinfest force-pushed the pr19776 branch from 4386fc0 to 7e97545 Compare April 27, 2026 06:03
@bolinfest
bolinfest force-pushed the pr19775 branch from 3841eb0 to 6487630 Compare April 27, 2026 06:03
@bolinfest
bolinfest force-pushed the pr19776 branch from 7e97545 to cb85227 Compare April 27, 2026 06:09
@bolinfest
bolinfest force-pushed the pr19775 branch 2 times, most recently from 54173b9 to 59e21e6 Compare April 27, 2026 06:15
@bolinfest
bolinfest force-pushed the pr19776 branch 2 times, most recently from 4aecf2a to 2e1e5f3 Compare April 27, 2026 06:25
@bolinfest
bolinfest force-pushed the pr19775 branch from 59e21e6 to 1497658 Compare April 27, 2026 06:25
@bolinfest
bolinfest force-pushed the pr19776 branch from 2e1e5f3 to 94e89b5 Compare April 27, 2026 06:35
@bolinfest
bolinfest force-pushed the pr19775 branch from 1497658 to 9457244 Compare April 27, 2026 06:35
@bolinfest
bolinfest force-pushed the pr19776 branch from 94e89b5 to 8fff5bc Compare April 27, 2026 06:46
@bolinfest
bolinfest force-pushed the pr19775 branch 2 times, most recently from 6af2340 to eddf071 Compare April 27, 2026 06:55
@bolinfest
bolinfest force-pushed the pr19776 branch 2 times, most recently from 25c6ddb to cdce5b9 Compare April 27, 2026 07:06
@bolinfest
bolinfest force-pushed the pr19775 branch 2 times, most recently from c9269a0 to 6c92cc4 Compare April 27, 2026 07:14
@bolinfest
bolinfest force-pushed the pr19776 branch 2 times, most recently from 1db629a to 33fb299 Compare April 27, 2026 16:30
@bolinfest
bolinfest force-pushed the pr19775 branch from 6c92cc4 to 4e3c8ec Compare April 27, 2026 16:30
@bolinfest
bolinfest force-pushed the pr19776 branch from 33fb299 to c3bceef Compare April 27, 2026 16:46
@bolinfest
bolinfest force-pushed the pr19775 branch 2 times, most recently from b392db1 to b77b4d5 Compare April 27, 2026 20:42
@bolinfest
bolinfest force-pushed the pr19776 branch from c3bceef to 6fa843e Compare April 27, 2026 20:42
bolinfest added a commit that referenced this pull request Apr 27, 2026
@bolinfest
permissions: derive config defaults as profiles (#19772)
755880e
## Why

This continues the permissions migration by making legacy config default
resolution produce the canonical `PermissionProfile` first. The legacy
`SandboxPolicy` projection should stay available at compatibility
boundaries, but config loading should not create a legacy policy just to
immediately convert it back into a profile.

Specifically, when `default_permissions` is not specified in
`config.toml`, instead of creating a `SandboxPolicy` in
`codex-rs/core/src/config/mod.rs` and then trying to derive a
`PermissionProfile` from it, we use `derive_permission_profile()` to
create a more faithful `PermissionProfile` using the values of
`ConfigToml` directly.

This also keeps the existing behavior of `sandbox_workspace_write` and
extra writable roots after #19841 replaced `:cwd` with `:project_roots`.
Legacy workspace-write defaults are represented as symbolic
`:project_roots` write access plus symbolic project-root metadata
carveouts. Extra absolute writable roots are still added directly and
continue to get concrete metadata protections for paths that exist under
those roots.

The platform sandboxes differ when a symbolic project-root subpath does
not exist yet.

* **Seatbelt** can encode literal/subpath exclusions directly, so macOS
emits project-root metadata subpath policies even if `.git`, `.agents`,
or `.codex` do not exist.
* **bwrap** has to materialize bind-mount targets. Binding `/dev/null`
to a missing `.git` can create a host-visible placeholder that changes
Git repo discovery. Binding missing `.agents` would not affect Git
discovery, but it would still create a host-visible project metadata
placeholder from an automatic compatibility carveout. Linux therefore
skips only missing automatic `.git` and `.agents` read-only metadata
masks; missing `.codex` remains protected so first-time project config
creation goes through the protected-path approval flow. User-authored
`read` and `none` subpath rules keep normal bwrap behavior, and `none`
can still mask the first missing component to prevent creation under
writable roots.

## What Changed

- Adds profile-native helpers for legacy workspace-write semantics,
including `PermissionProfile::workspace_write_with()`,
`FileSystemSandboxPolicy::workspace_write()`, and
`FileSystemSandboxPolicy::with_additional_legacy_workspace_writable_roots()`.
- Makes `FileSystemSandboxPolicy::workspace_write()` the single legacy
workspace-write constructor so both `from_legacy_sandbox_policy()` and
`From<&SandboxPolicy>` include the project-root metadata carveouts.
- Removes the no-carveout `legacy_workspace_write_base_policy()` path
and the `prune_read_entries_under_writable_roots()` cleanup that was
only needed by that split construction.
- Adds `ConfigToml::derive_permission_profile()` for legacy sandbox-mode
fallback resolution; named `default_permissions` profiles continue
through the permissions profile pipeline instead of being reconstructed
from `sandbox_mode`.
- Updates `Config::load()` to start from the derived profile, validate
that it still has a legacy compatibility projection, and apply
additional writable roots directly to managed workspace-write filesystem
policies.
- Updates Linux bwrap argument construction so missing automatic
`.git`/`.agents` symbolic project-root read-only carveouts are skipped
before emitting bind args; missing `.codex`, user-authored `read`/`none`
subpath rules, and existing missing writable-root behavior are
preserved.
- Adds coverage that legacy workspace-write config produces symbolic
project-root metadata carveouts, extra legacy workspace writable roots
still protect existing metadata paths such as `.git`, and bwrap skips
missing `.git`/`.agents` project-root carveouts while preserving missing
`.codex` and user-authored missing subpath rules.

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/19772).
* #19776
* #19775
* #19774
* #19773
* __->__ #19772
@bolinfest
bolinfest force-pushed the pr19776 branch from 7e8dd67 to 2558ae6 Compare April 27, 2026 23:58
@bolinfest
bolinfest force-pushed the pr19775 branch 2 times, most recently from 3fe6c38 to 5772009 Compare April 28, 2026 00:04
@bolinfest
bolinfest force-pushed the pr19776 branch 2 times, most recently from 457d0a6 to 7481ea3 Compare April 28, 2026 00:05
@bolinfest
bolinfest force-pushed the pr19775 branch 2 times, most recently from 7a2d356 to dd9545c Compare April 28, 2026 00:12
@bolinfest
bolinfest force-pushed the pr19776 branch from 7481ea3 to 88df7ef Compare April 28, 2026 00:12
This was referenced Apr 28, 2026
permissions: add built-in default profiles #19900
Merged
app-server-protocol: mark permission profiles experimental #19899
Merged
@bolinfest
bolinfest force-pushed the pr19775 branch from dd9545c to 2f9c725 Compare April 28, 2026 03:18
@bolinfest
bolinfest force-pushed the pr19776 branch from 88df7ef to 08e200f Compare April 28, 2026 03:18
bolinfest added a commit that referenced this pull request Apr 28, 2026
@bolinfest
permissions: require profiles in TUI thread state (#19773)
af95662
## Why

`ThreadSessionState` is the TUI's cached view of an app-server session.
To make `PermissionProfile` the canonical runtime permissions model,
cached thread sessions need to always have a profile instead of treating
the profile as an optional supplement to a legacy `sandbox` response
field.

The main compatibility concern is older app-server v2 lifecycle
responses that only include `sandbox` and omit `permissionProfile`:

- `thread/start` -> `ThreadStartResponse.sandbox`
- `thread/resume` -> `ThreadResumeResponse.sandbox`
- `thread/fork` -> `ThreadForkResponse.sandbox`

Those responses must still hydrate correctly when the TUI is pointed at
an older app-server. This PR converts the legacy `sandbox` value into a
`PermissionProfile` immediately at response ingestion time, using the
response `cwd`, so cached sessions do not carry an optional profile that
can later reinterpret cwd-bound grants against a different thread cwd.

This fallback is intentionally boundary compatibility. The follow-up PRs
in this stack continue the cleanup by making `SessionConfiguredEvent`
profile-only, deriving sandbox projections from snapshots only when an
API still needs them, and then removing `sandbox_policy` from
`ThreadSessionState`.

## What Changed

- Makes `ThreadSessionState.permission_profile` required.
- Converts legacy app-server response `sandbox` values into a
`PermissionProfile` at ingestion time using the response cwd.
- Ensures `thread/read` hydration does not reuse a primary session
profile that may be anchored to a different cwd; it uses the active
widget permission settings for the read thread fallback instead of
reusing cached primary-session permissions.
- Keeps the app-server request path unchanged: embedded sessions send
profiles, while remote sessions continue using legacy sandbox overrides
for compatibility.

## Verification

- `cargo test -p codex-tui thread_read --lib`
- `cargo test -p codex-tui
permission_settings_sync_preserves_active_profile_only_rules --lib`
- `cargo test -p codex-tui
resume_response_restores_turns_from_thread_items --lib`
- `cargo test -p codex-tui thread_session_state::tests --lib`




























---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/19773).
* #19900
* #19899
* #19776
* #19775
* #19774
* __->__ #19773
@bolinfest
bolinfest force-pushed the pr19775 branch from 2f9c725 to 7497c02 Compare April 28, 2026 03:41
@bolinfest
bolinfest force-pushed the pr19776 branch from 08e200f to 7edd6bd Compare April 28, 2026 03:41
@bolinfest
bolinfest force-pushed the pr19775 branch from 7497c02 to ee35838 Compare April 28, 2026 04:12
@bolinfest
bolinfest force-pushed the pr19776 branch from 7edd6bd to 2d32dad Compare April 28, 2026 04:12
@bolinfest
bolinfest requested a review from viyatb-oai April 28, 2026 04:13
@bolinfest
bolinfest force-pushed the pr19775 branch from ee35838 to 5895cd8 Compare April 28, 2026 04:17
@bolinfest
bolinfest force-pushed the pr19776 branch 2 times, most recently from 46a856e to 9133437 Compare April 28, 2026 04:29
@bolinfest
bolinfest force-pushed the pr19775 branch from 5895cd8 to fac5fcd Compare April 28, 2026 04:29
@bolinfest
bolinfest force-pushed the pr19776 branch from 9133437 to 61fac4e Compare April 28, 2026 04:40
@bolinfest
bolinfest force-pushed the pr19775 branch from fac5fcd to 2476604 Compare April 28, 2026 04:40
viyatb-oai
viyatb-oai approved these changes Apr 28, 2026
View reviewed changes
bolinfest added a commit that referenced this pull request Apr 28, 2026
@bolinfest
permissions: make SessionConfigured profile-only (#19774)
bf38def
## Why

`SessionConfiguredEvent` is the internal event that tells clients what
permissions are active for a session. Emitting both `sandbox_policy` and
`permission_profile` leaves two possible authorities and forces every
consumer to decide which one to honor. At this point in the migration,
the profile is expressive enough to represent managed, disabled, and
external sandbox enforcement, so the internal event can be profile-only.

The wire compatibility concern is older serialized events or rollout
data that only contain `sandbox_policy`; those still need to
deserialize.

## What Changed

- Removes `sandbox_policy` from `SessionConfiguredEvent` and makes
`permission_profile` required.
- Adds custom deserialization so old payloads with only `sandbox_policy`
are upgraded to a cwd-anchored `PermissionProfile`.
- Updates core event emission and TUI session handling to sync
permissions from the profile directly.
- Updates app-server response construction to derive the legacy
`sandbox` response field from the active thread snapshot instead of from
`SessionConfiguredEvent`.
- Updates yolo-mode display logic to treat both
`PermissionProfile::Disabled` and managed unrestricted filesystem plus
enabled network as full-access, while still preserving the distinction
between no sandbox and external sandboxing.

## Verification

- `cargo test -p codex-protocol session_configured_event --lib`
- `cargo test -p codex-protocol serialize_event --lib`
- `cargo test -p codex-exec session_configured --lib`
- `cargo test -p codex-app-server
thread_response_permission_profile_preserves_enforcement --lib`
- `cargo test -p codex-core
session_configured_reports_permission_profile_for_external_sandbox
--lib`
- `cargo test -p codex-tui session_configured --lib`
- `cargo test -p codex-tui
yolo_mode_includes_managed_full_access_profiles --lib`


































---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/19774).
* #19900
* #19899
* #19776
* #19775
* __->__ #19774
@bolinfest
bolinfest force-pushed the pr19776 branch from 61fac4e to 6c6150c Compare April 28, 2026 05:07
@bolinfest
bolinfest force-pushed the pr19775 branch from 2476604 to 5e966fd Compare April 28, 2026 05:07
@bolinfest
permissions: store thread sessions as profiles
360da3f
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

1 more reviewer
@viyatb-oai viyatb-oai viyatb-oai approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@bolinfest @viyatb-oai
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.