Commit Graph

15861 Commits

Author SHA1 Message Date
Michael Bolin
2c611aba2f Merge 6ace6c2827 into sapling-pr-archive-bolinfest 2026-05-16 07:51:31 -07:00
Michael Bolin
6ace6c2827 test: construct permission profiles directly 2026-05-16 07:51:16 -07:00
Michael Bolin
e5e148b087 Merge 12a3e8cd25 into sapling-pr-archive-bolinfest 2026-05-16 07:46:07 -07:00
Michael Bolin
12a3e8cd25 test: construct permission profiles directly 2026-05-16 07:45:52 -07:00
Michael Bolin
8f033b4abe merge commit for archive created by Sapling 2026-05-16 07:34:55 -07:00
Michael Bolin
8bd521e0bf test: construct permission profiles directly 2026-05-16 07:34:47 -07:00
Michael Bolin
6e2cd91fa6 merge commit for archive created by Sapling 2026-05-16 07:28:36 -07:00
Michael Bolin
7003cff49e test: construct permission profiles directly 2026-05-16 07:28:16 -07:00
Michael Bolin
108234b5eb core: set permission profiles from snapshots (#22920)
## Why

#22891 moved the TUI turn-command path to pass `ActivePermissionProfile`
instead of the full `PermissionProfile`, but the remaining
config/session bridge still accepted the concrete `PermissionProfile`
and active profile id as separate arguments. That shape made it too easy
for future callers to update the concrete profile and active profile id
out of sync.

This PR makes the trusted session snapshot path pass one coherent value
into `Permissions`, while keeping `requirements.toml` enforcement owned
by the existing constrained permission state.

## What Changed

- Added `PermissionProfileSnapshot` as the public snapshot value for
trusted session/config synchronization.
- Changed `Permissions::set_permission_profile_from_session_snapshot()`
and `replace_permission_profile_from_session_snapshot()` to take a
`PermissionProfileSnapshot`.
- Updated the replacement path to derive its constrained
`PermissionProfile` from the snapshot, so callers cannot pass a separate
profile that disagrees with the snapshot.
- Removed the internal tuple-style
`PermissionProfileState::set_active_permission_profile()` mutation path.
- Updated core session projection and TUI call sites to construct
explicit legacy or active snapshots.
- Documented the snapshot constructors so legacy use and id/profile
mismatch hazards are called out at the API boundary.
- Added a focused config test that verifies snapshot updates still
respect existing permission constraints.

## How To Review

1. Start with `codex-rs/core/src/config/resolved_permission_profile.rs`;
`PermissionProfileSnapshot` is the public wrapper, while
`ResolvedPermissionProfile` stays internal.
2. Check `codex-rs/core/src/config/mod.rs` to confirm both
session-snapshot setters validate through `PermissionProfileState` and
no longer accept loose profile/id pairs.
3. Skim `codex-rs/core/src/session/session.rs` for the session
projection path; it now builds the snapshot before installing it.
4. Skim the TUI changes as call-site migration from loose argument pairs
to explicit snapshot construction.

## Verification

- `cargo test -p codex-core
permission_snapshot_setter_preserves_permission_constraints`
- `cargo test -p codex-tui status_permissions_`
- `cargo test -p codex-tui
session_configured_preserves_profile_workspace_roots`
- `just fix -p codex-core -p codex-tui`
2026-05-16 07:26:18 -07:00
Eric Traut
de9c5c0226 Fix Windows doctor npm root probe (#22967)
## Why
On Windows npm-managed installs expose the working shim as `npm.cmd`.
`codex doctor` probed bare `npm`, which could incorrectly report that
npm global-root inspection was unavailable even when the install was
healthy.

Fixes #22964.

## What changed
- Use `npm.cmd` for the doctor npm-root probe on Windows.
- Keep the existing `npm` probe on non-Windows platforms.
2026-05-16 00:39:27 -07:00
Ahmed Ibrahim
326e31ab65 [codex] Refine Python SDK user-facing docs (#22941)
## Summary
- Remove maintainer and release-process wording from the Python SDK
README and docs.
- Rewrite SDK-facing comments/docstrings so they read as standalone
product documentation.
- Add a real app-server integration smoke that follows the public
quickstart-style `Codex() -> thread_start() -> run()` path.

## Integration coverage
- Add `test_real_quickstart_style_flow_smoke` in the real app-server
integration suite.

## Validation
- Local tests were not run per repo guidance. CI should validate this
branch once the PR is online.
2026-05-15 19:55:05 -07:00
Michael Bolin
b12d16f952 merge commit for archive created by Sapling 2026-05-15 17:38:25 -07:00
Michael Bolin
49a9062253 windows-sandbox: drive write roots from resolved permissions 2026-05-15 17:38:07 -07:00
Michael Bolin
f8724cf510 merge commit for archive created by Sapling 2026-05-15 17:33:32 -07:00
Michael Bolin
3d98e859e5 core: set permission profiles from snapshots 2026-05-15 17:31:52 -07:00
Michael Bolin
5bf17a4827 Merge c42e3703b3 into sapling-pr-archive-bolinfest 2026-05-15 17:21:09 -07:00
Michael Bolin
c42e3703b3 windows-sandbox: drive write roots from resolved permissions 2026-05-15 17:21:02 -07:00
Michael Bolin
9025550709 app-server-protocol: remove PermissionProfile from API (#22924)
## Why

The app server API should expose permission profile identity, not the
lower-level runtime permission model. `PermissionProfile` is the
compiled sandbox/network representation that the server uses internally;
exposing it through app-server-protocol forces clients to understand
details that should remain implementation-level.

The API boundary should prefer `ActivePermissionProfile`: a stable
profile id, plus future parent-profile metadata, that clients can pass
back when they want to select the same active permissions. This also
avoids schema generation collisions between the app-server v2 API type
space and the core protocol model.

Incidentally, while PR makes a number of changes to `command/exec`, note
that we are hoping to deprecate this API in favor of `process/spawn`, so
we don't need to be too finicky about these changes.

## What Changed

- Removed `PermissionProfile` from the app-server-protocol API surface,
including generated schema and TypeScript exports.
- Changed `CommandExecParams.permissionProfile` to
`ActivePermissionProfile`.
- Resolve command exec profile ids through `ConfigManager` for the
command cwd, matching turn override selection semantics.
- Updated downstream TUI tests/helpers to use core permission types
directly instead of app-server-protocol `PermissionProfile` shims.
2026-05-15 17:10:15 -07:00
Michael Bolin
f11f3e4ef8 merge commit for archive created by Sapling 2026-05-15 17:03:29 -07:00
Michael Bolin
de5a796e9a windows-sandbox: drive write roots from resolved permissions 2026-05-15 17:03:11 -07:00
Michael Bolin
b90513496b merge commit for archive created by Sapling 2026-05-15 16:54:07 -07:00
Michael Bolin
70a7dcacd4 app-server-protocol: use active permission profile for command exec 2026-05-15 16:53:59 -07:00
Michael Bolin
89a88a9982 merge commit for archive created by Sapling 2026-05-15 16:43:44 -07:00
Michael Bolin
07b7e3c426 app-server-protocol: use active permission profile for command exec 2026-05-15 16:43:35 -07:00
Michael Bolin
62fb720137 merge commit for archive created by Sapling 2026-05-15 16:39:11 -07:00
Michael Bolin
78674c0f52 app-server-protocol: use active permission profile for command exec 2026-05-15 16:39:02 -07:00
Michael Bolin
f39835bb73 merge commit for archive created by Sapling 2026-05-15 16:37:35 -07:00
Michael Bolin
21f3ede082 windows-sandbox: drive write roots from resolved permissions 2026-05-15 16:37:19 -07:00
Michael Bolin
f1c9aaa637 Merge 72d41e5db2 into sapling-pr-archive-bolinfest 2026-05-15 16:33:04 -07:00
Michael Bolin
72d41e5db2 core: set permission profiles from snapshots 2026-05-15 16:32:55 -07:00
Michael Bolin
c264a97c85 merge commit for archive created by Sapling 2026-05-15 16:25:58 -07:00
Michael Bolin
f4ff44e042 app-server-protocol: use active permission profile for command exec 2026-05-15 16:25:49 -07:00
Michael Bolin
bfd6054051 merge commit for archive created by Sapling 2026-05-15 16:21:44 -07:00
Michael Bolin
5e076c4a3a windows-sandbox: drive write roots from resolved permissions 2026-05-15 16:21:24 -07:00
Michael Bolin
2c409f53c4 merge commit for archive created by Sapling 2026-05-15 16:20:04 -07:00
Michael Bolin
a850df1e1e app-server-protocol: use active permission profile for command exec 2026-05-15 16:19:44 -07:00
Michael Bolin
6349e1ba5c merge commit for archive created by Sapling 2026-05-15 16:14:08 -07:00
Michael Bolin
a4be788173 windows-sandbox: drive write roots from resolved permissions 2026-05-15 16:13:43 -07:00
Michael Bolin
b10098c496 Merge b2d0a5a785 into sapling-pr-archive-bolinfest 2026-05-15 15:58:24 -07:00
Michael Bolin
b2d0a5a785 core: set permission profiles from snapshots 2026-05-15 15:58:13 -07:00
Michael Bolin
8ce09d64e1 merge commit for archive created by Sapling 2026-05-15 15:57:49 -07:00
Michael Bolin
dce80187ae core: set permission profiles from snapshots 2026-05-15 15:57:25 -07:00
Michael Bolin
eb7790a7b7 merge commit for archive created by Sapling 2026-05-15 15:50:50 -07:00
Michael Bolin
56238d2fa2 windows-sandbox: send permission profiles to elevated runner 2026-05-15 15:50:23 -07:00
Michael Bolin
86e11d7697 windows-sandbox: add resolved permissions helper 2026-05-15 15:50:23 -07:00
Michael Bolin
f1e0e5cea8 Merge 7fbefbb0e1 into sapling-pr-archive-bolinfest 2026-05-15 15:43:06 -07:00
Michael Bolin
7fbefbb0e1 windows-sandbox: send permission profiles to elevated runner 2026-05-15 15:42:49 -07:00
Michael Bolin
bbb5c2811d tui: pass active permission profiles through app commands (#22891)
## Why

This continues the permissions migration by keeping the TUI command
boundary aligned with the app-server protocol direction from #22795:
callers should select a permission profile by id instead of passing a
concrete `PermissionProfile` value around as the turn configuration.

`AppCommand` is internal to the TUI, but it is the path that eventually
becomes `thread/turn/start`, so carrying concrete profile details there
made it too easy for UI code to keep relying on the old whole-profile
replacement model.

## What changed

- `AppCommand::UserTurn` and `AppCommand::OverrideTurnContext` now carry
`Option<ActivePermissionProfile>` instead of `PermissionProfile`.
- Composer submissions copy the active permission profile id from the
current session snapshot; legacy snapshots intentionally submit no
active profile id.
- Permission preset UI events now carry only the active built-in profile
id. The app derives the concrete built-in `PermissionProfile` internally
only when updating its local config/status snapshot.
- Permission presets expose their built-in active profile id, and preset
selection preserves that id in both the immediate turn override and the
local TUI config snapshot.
- Turn routing sends `TurnPermissionsOverride::ActiveProfile` when an
active id is present, and only falls back to the legacy sandbox
projection for the remaining runtime override path.

## How to review

Start with `codex-rs/tui/src/app_command.rs` to verify the command shape
no longer exposes `PermissionProfile`.

Then read `codex-rs/tui/src/app/thread_routing.rs` to verify the
app-server turn-start conversion: active ids go through as ids, while
the legacy sandbox fallback is still constrained to the existing runtime
override case.

Finally, check `codex-rs/tui/src/chatwidget/permission_popups.rs`,
`codex-rs/tui/src/app/event_dispatch.rs`,
`codex-rs/tui/src/app/config_persistence.rs`, and
`codex-rs/utils/approval-presets/src/lib.rs` to see how preset
selections stay id-only across TUI events while the local display/config
mirror still gets a concrete built-in profile.

## Verification

Latest local verification after the id-only `AppEvent` cleanup:

- `cargo check -p codex-tui --tests`
- `cargo test -p codex-tui
permissions_selection_sends_approvals_reviewer_in_override_turn_context`
- `cargo test -p codex-tui update_feature_flags_enabling_guardian`
- `cargo test -p codex-utils-approval-presets`
- `just fmt`
- `just fix -p codex-tui -p codex-utils-approval-presets`

Earlier in the same PR, before the final event-shape cleanup:

- `cargo test -p codex-tui turn_permissions_`
- `cargo test -p codex-tui submission_`
- `cargo test -p codex-tui
session_configured_syncs_widget_config_permissions_and_cwd`
- `RUST_MIN_STACK=16777216 cargo test -p codex-tui`
2026-05-15 22:42:35 +00:00
Michael Bolin
c563ba6b18 Merge e0c614b2da into sapling-pr-archive-bolinfest 2026-05-15 15:38:51 -07:00
Michael Bolin
e0c614b2da windows-sandbox: add resolved permissions helper 2026-05-15 15:38:42 -07:00