Commit Graph
14161 Commits
Author SHA1 Message Date
Michael Bolin d4628b177b Merge b9fc9c06c8 into sapling-pr-archive-bolinfest 2026-04-28 17:13:06 -07:00
Michael Bolin b9fc9c06c8 core tests: migrate prompt caching turns to profiles 2026-04-28 17:12:55 -07:00
Michael Bolin 5d08315c00 core tests: migrate exec policy turns to profiles (#20030)
## Summary

This migrates `core/tests/suite/exec_policy.rs` away from legacy
`SandboxPolicy` turn construction. These tests all use no-sandbox turns
to exercise exec-policy behavior, so `PermissionProfile::Disabled` is
the canonical representation.

## Changes

- Replaces direct `SandboxPolicy::DangerFullAccess` turn fields with
`PermissionProfile::Disabled`.
- Uses `turn_permission_fields()` to populate the compatibility
`sandbox_policy` field required by `Op::UserTurn`.
- Removes the `SandboxPolicy` import from `exec_policy.rs`.

## Verification

- `cargo check -p codex-core --tests`
2026-04-28 17:12:48 -07:00
Michael Bolin c6b17222ab Merge a8185557fb into sapling-pr-archive-bolinfest 2026-04-28 17:12:29 -07:00
Michael Bolin a8185557fb core tests: migrate exec policy turns to profiles 2026-04-28 17:12:18 -07:00
Michael Bolin b599849d86 core tests: migrate permissions message tests to profiles (#20028)
## Summary

This removes another test-only `SandboxPolicy` dependency by configuring
`permissions_messages.rs` with a `PermissionProfile` directly. The test
still verifies the rendered compatibility permissions text, but now
obtains the legacy projection from the loaded `Config` rather than using
`SandboxPolicy` as the source of truth.

## Changes

- Builds the workspace-write test setup with
`PermissionProfile::workspace_write_with()`.
- Applies that profile through `Permissions::set_permission_profile()`.
- Uses `Config::legacy_sandbox_policy()` only for the expected
`PermissionsInstructions` compatibility rendering.

## Verification

- `cargo check -p codex-core --tests`
2026-04-28 17:12:10 -07:00
Michael Bolin b176628ecb Merge d5aa14e0cf into sapling-pr-archive-bolinfest 2026-04-28 17:11:59 -07:00
Michael Bolin d5aa14e0cf core tests: migrate permissions message tests to profiles 2026-04-28 17:11:48 -07:00
Michael Bolin 3ef09c71d3 core tests: migrate tools tests to permission profiles (#20027)
## Summary

This continues the test-side migration away from `SandboxPolicy` by
removing the remaining legacy policy setup in
`core/tests/suite/tools.rs`. The affected test was already modeling a
profile-backed filesystem policy with a deny-read glob, so configuring
the test through `Permissions::set_permission_profile()` is a better
match for the behavior being exercised.

## Changes

- Drops the `SandboxPolicy` import from `core/tests/suite/tools.rs`.
- Configures the glob deny-read shell test directly with a
`PermissionProfile` instead of creating a legacy read-only policy first.
- Submits the test turn with the session permission profile so the
deny-read glob remains active for the command under test.

## Verification

- `cargo check -p codex-core --tests`
2026-04-28 17:11:43 -07:00
Michael Bolin 890a11d63c Merge 33d0b61573 into sapling-pr-archive-bolinfest 2026-04-28 17:11:32 -07:00
Michael Bolin 33d0b61573 core tests: migrate tools tests to permission profiles 2026-04-28 17:11:20 -07:00
Michael Bolin 8d3992d830 core tests: migrate plan item turns to profiles (#20026)
## Why

The core item tests still had a cluster of plan-mode `Op::UserTurn`
literals that used `SandboxPolicy::DangerFullAccess` and omitted
`permission_profile`. These tests are validating emitted item lifecycle
events, so keeping them on the legacy sandbox-only turn shape adds noise
to the broader permissions migration without testing legacy behavior.

## What Changed

- Adds a local `disabled_plan_turn()` helper that preserves the existing
`std::env::current_dir()` turn cwd behavior.
- Uses `turn_permission_fields(PermissionProfile::Disabled, cwd)` to
populate both the compatibility `sandbox_policy` and canonical
`permission_profile` fields.
- Replaces the plan-mode hand-built turns in
`codex-rs/core/tests/suite/items.rs`, removing all `SandboxPolicy`
references from that file and reducing remaining `codex-rs/core/tests`
`SandboxPolicy` files from 16 to 15.

## Verification

- `cargo check -p codex-core --tests`
2026-04-28 17:11:17 -07:00
Michael Bolin dbd0554900 Merge dc3a9abb37 into sapling-pr-archive-bolinfest 2026-04-28 17:11:00 -07:00
Michael Bolin dc3a9abb37 core tests: migrate plan item turns to profiles 2026-04-28 17:10:48 -07:00
Michael Bolin 162f4e3183 core tests: migrate safety check turns to profiles (#20024)
## Why

This stack is retiring direct `SandboxPolicy` construction from tests so
core coverage exercises the same `PermissionProfile` turn path used by
runtime code. `safety_check_downgrade.rs` still submitted each test turn
as `SandboxPolicy::DangerFullAccess` with no permission profile, even
though the tests are about model verification/reroute behavior rather
than legacy sandbox conversion.

## What Changed

- Adds a local `disabled_text_turn()` helper that derives both the
compatibility `sandbox_policy` and canonical `permission_profile` from
`PermissionProfile::Disabled`.
- Replaces repeated hand-built `Op::UserTurn` literals in
`codex-rs/core/tests/suite/safety_check_downgrade.rs` with that helper.
- Removes all `SandboxPolicy` references from the safety-check suite,
reducing the remaining `codex-rs/core/tests` files that mention
`SandboxPolicy` from 17 to 16.

## Verification

- `cargo check -p codex-core --tests`
2026-04-28 17:10:42 -07:00
Michael Bolin 466db52f69 Merge 9d5c053248 into sapling-pr-archive-bolinfest 2026-04-28 17:10:12 -07:00
Michael Bolin 9d5c053248 core tests: migrate safety check turns to profiles 2026-04-28 17:09:59 -07:00
Michael Bolin 2a8ce9b319 core tests: migrate view image turns to profiles (#20021)
## Why

This stack is removing direct `SandboxPolicy` usage from test code so
new tests exercise the same `PermissionProfile` path that runtime code
now treats as canonical. `view_image.rs` still built `Op::UserTurn`
requests with `SandboxPolicy::DangerFullAccess` and no permission
profile, which kept another core test module on the legacy turn shape.

## What Changed

- Adds a small `disabled_user_turn()` helper for the view-image suite
that derives the compatibility `sandbox_policy` and canonical
`permission_profile` from `PermissionProfile::Disabled`.
- Replaces repeated direct `Op::UserTurn` literals in
`codex-rs/core/tests/suite/view_image.rs` with that helper.
- Removes all `SandboxPolicy` references from `view_image.rs`, reducing
the remaining `codex-rs/core/tests` files that mention `SandboxPolicy`
from 18 to 17.

## Verification

- `cargo check -p codex-core --tests`
2026-04-28 17:09:48 -07:00
Michael Bolin 2539682647 Merge 360b70c7ce into sapling-pr-archive-bolinfest 2026-04-28 17:09:34 -07:00
Michael Bolin 360b70c7ce core tests: migrate view image turns to profiles 2026-04-28 17:09:21 -07:00
Michael Bolin d77d23da2e core tests: migrate model/personality turns to profiles (#20018)
## Summary

- Migrates `model_switching.rs` and `personality.rs` direct
`Op::UserTurn` construction from legacy `SandboxPolicy` literals to
`PermissionProfile`-backed turn fields.
- Adds small local helpers in each file so tests keep asserting
model/personality behavior without repeating permission plumbing.
- Reduces `rg -l '\bSandboxPolicy\b' codex-rs/core/tests` from 20 files
to 18; `codex-rs/tui` remains at zero `SandboxPolicy` references.

## Testing

- `cargo check -p codex-core --tests`
- `just fmt`
2026-04-28 17:09:12 -07:00
Michael Bolin 61ca61f4e6 Merge 2cda9ab159 into sapling-pr-archive-bolinfest 2026-04-28 17:08:34 -07:00
Abhinav 5b0d9df1d0 Increase plugin hook env test timeout (#20100)
# Why

`plugin_hook_sources_run_with_plugin_env_and_plugin_source` can still
fail on Windows after the earlier file-based assertion cleanup because
the hook process itself occasionally exceeds the old 5s timeout under CI
load. When that happens, the hook run ends as `Failed` before the test
can inspect its structured output.

The Windows Bazel failure showed the hook run itself failing after
nearly 8 seconds:

```text
---- engine::tests::plugin_hook_sources_run_with_plugin_env_and_plugin_source stdout ----
thread 'engine::tests::plugin_hook_sources_run_with_plugin_env_and_plugin_source' panicked at hooks/src\engine\mod_tests.rs:428:5:
assertion failed: `(left == right)`
Diff < left / right > :
<Failed
>Completed
...
test result: FAILED. 78 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 7.96s
```

# What

- raise the flaky plugin hook env test timeout from 5s to 10s so it
matches the other executed hook tests in this module

# Validation

- `cargo test -p codex-hooks`
2026-04-28 17:08:12 -07:00
Michael Bolin 2cda9ab159 core tests: migrate model/personality turns to profiles 2026-04-28 17:08:12 -07:00
Michael Bolin d6d79ffcc7 core tests: send model turns with permission profiles (#20016)
## Summary
- Migrate direct `Op::UserTurn` construction in remote-model tests from
legacy `SandboxPolicy::DangerFullAccess` to
`PermissionProfile::Disabled` via `turn_permission_fields()`.
- Migrate the Responses API proxy header helper from an inline
workspace-write `SandboxPolicy` to
`PermissionProfile::workspace_write()`.
- Reduce `SandboxPolicy` references in `codex-rs/core/tests` from 22
files after #20015 to 20 files.

## Testing
- `cargo check -p codex-core --tests`
- `just fmt`





























---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/20016).
* #20041
* #20040
* #20037
* #20035
* #20034
* #20033
* #20032
* #20030
* #20028
* #20027
* #20026
* #20024
* #20021
* #20018
* __->__ #20016
2026-04-28 17:08:04 -07:00
Michael Bolin 3102f525fc Merge 2d03a18cb1 into sapling-pr-archive-bolinfest 2026-04-28 17:07:34 -07:00
Michael Bolin 2d03a18cb1 core tests: migrate hook turns to profiles 2026-04-28 17:07:14 -07:00
Michael Bolin 580e025a5f core tests: migrate apply patch turns to profiles 2026-04-28 17:07:14 -07:00
Michael Bolin 57c9bdcf0a core tests: migrate rmcp turns to profiles 2026-04-28 17:07:14 -07:00
Michael Bolin 83b671056a core tests: migrate compact turns to profiles 2026-04-28 17:07:14 -07:00
Michael Bolin 1faa73a715 core tests: migrate zsh-fork permissions to profiles 2026-04-28 17:07:14 -07:00
Michael Bolin 1b037c0401 core tests: migrate request permissions tool turns to profiles 2026-04-28 17:07:13 -07:00
Michael Bolin 968183767f core tests: migrate prompt caching turns to profiles 2026-04-28 17:07:13 -07:00
Michael Bolin 68301852d9 core tests: migrate exec policy turns to profiles 2026-04-28 17:07:13 -07:00
Michael Bolin 9c118360d0 core tests: migrate permissions message tests to profiles 2026-04-28 17:07:13 -07:00
Michael Bolin a4b786386b core tests: migrate tools tests to permission profiles 2026-04-28 17:07:13 -07:00
Michael Bolin cdae316a0d core tests: migrate plan item turns to profiles 2026-04-28 17:07:13 -07:00
Michael Bolin 121e2e9152 core tests: migrate safety check turns to profiles 2026-04-28 17:07:13 -07:00
Michael Bolin 791cc4c61d core tests: migrate view image turns to profiles 2026-04-28 17:07:13 -07:00
Michael Bolin 9b304c5a23 core tests: migrate model/personality turns to profiles 2026-04-28 17:07:13 -07:00
Michael Bolin 6e2b1aff7c core tests: send model turns with permission profiles 2026-04-28 17:07:13 -07:00
Michael Bolin 158b2a4201 core tests: configure profiles directly (#20015)
## Summary
- Replace legacy sandbox config setup in delegate and telemetry tests
with direct `PermissionProfile` configuration.
- Move no-sandbox and read-only test turns in `tools.rs`,
`code_mode.rs`, `user_shell_cmd.rs`, and `model_visible_layout.rs` from
legacy `SandboxPolicy` values to `PermissionProfile` helpers, while
leaving the deny-glob read-only compatibility case for a later targeted
cleanup.
- Use `PermissionProfile::read_only()` where tests need managed
read-only behavior and `PermissionProfile::Disabled` where they
intentionally need no sandbox.
- Reduce `SandboxPolicy` references in `codex-rs/core/tests` from 27
files after #20013 to 22 files.

## Testing
- `cargo check -p codex-core --tests`
- `just fmt`
2026-04-28 17:06:59 -07:00
Michael Bolin 1e455a4d8f Merge dc8896930f into sapling-pr-archive-bolinfest 2026-04-28 17:06:29 -07:00
Michael Bolin dc8896930f core tests: configure profiles directly 2026-04-28 17:06:06 -07:00
Michael Bolin 52e79ee49a core tests: migrate more turns to permission profiles (#20013)
## Summary
- Migrate another batch of direct `Op::UserTurn` test construction from
legacy `SandboxPolicy` values to `PermissionProfile` inputs via
`turn_permission_fields()`.
- Replace a one-off read-only `SandboxPolicy` bridge in the macOS exec
test with `PermissionProfile::read_only()`.
- Reduce `SandboxPolicy` references in `codex-rs/core/tests` from 32
files at the start of the cleanup stack to 27 files.

## Testing
- `cargo check -p codex-core --tests`
- `just fmt`
- `just fix -p codex-core`
2026-04-28 17:05:53 -07:00
Michael Bolin 09e709bf2e Merge acaba0bf70 into sapling-pr-archive-bolinfest 2026-04-28 17:05:04 -07:00
Michael Bolin acaba0bf70 core tests: migrate more turns to permission profiles 2026-04-28 17:04:27 -07:00
Michael Bolin 7d15936e69 core tests: build user turns from permission profiles (#20011)
## Summary
- Add `turn_permission_fields()` so tests that construct `Op::UserTurn`
directly can provide a canonical `PermissionProfile` while still filling
the required legacy `sandbox_policy` compatibility field.
- Migrate direct user-turn construction in core integration tests from
`SandboxPolicy::DangerFullAccess` to `PermissionProfile::Disabled`.
- Continue reducing direct `SandboxPolicy` usage in
`codex-rs/core/tests`, from 41 files after #20010 to 32 files in this
PR.

## Testing
- `cargo check -p codex-core --tests`
- `just fmt`
- `just fix -p core_test_support`
- `just fix -p codex-core`
2026-04-28 17:03:20 -07:00
Michael Bolin 8e5cfdbd59 merge commit for archive created by Sapling 2026-04-28 16:56:46 -07:00
Michael Bolin 464e16e2fc permissions: expose active profile metadata 2026-04-28 16:56:35 -07:00