Commit Graph
12354 Commits
Author SHA1 Message Date
Michael Bolin 5d2b2e0176 Merge 7f4668ae7c into sapling-pr-archive-bolinfest 2026-04-21 21:57:36 -07:00
Michael Bolin 7f4668ae7c fix(exec-server): retain output until streams close 2026-04-21 21:57:30 -07:00
Michael Bolin 16b731a31c Merge cd2f83c3c2 into sapling-pr-archive-bolinfest 2026-04-21 21:53:39 -07:00
Michael Bolin cd2f83c3c2 fix(exec-server): retain output until streams close 2026-04-21 21:53:25 -07:00
Michael Bolin faed6d5c07 tests: serialize process-heavy Windows CI suites (#18943)
## Why

A [Windows Cargo
build](https://github.com/openai/codex/actions/runs/24754807756/job/72425641062)
on `main` timed out in several unrelated-looking suites at the same
time:

- `codex-app-server` account tests failed before account logic, while
`mcp.initialize()` was waiting for the first JSON-RPC response.
- `codex-core` `apply_patch_cli` tests timed out while running full
Codex/apply_patch turns.
- `codex-windows-sandbox` legacy session tests timed out while creating
restricted-token child processes and private desktops.

The app-server log reached the test harness write path in
[`McpProcess::initialize_with_params`](https://github.com/openai/codex/blob/731b54d08fb93aec31fb020999a62447886f3ab3/codex-rs/app-server/tests/common/mcp_process.rs#L244-L263),
but never printed the matching stdout read from
[`read_jsonrpc_message`](https://github.com/openai/codex/blob/731b54d08fb93aec31fb020999a62447886f3ab3/codex-rs/app-server/tests/common/mcp_process.rs#L1123-L1128).
The server initialize handler is a small bookkeeping/response path
([`message_processor.rs`](https://github.com/openai/codex/blob/731b54d08fb93aec31fb020999a62447886f3ab3/codex-rs/app-server/src/message_processor.rs#L601-L728)),
so the failure looks like Windows runner process/pipe scheduling
starvation rather than account-specific behavior.

## What Changed

This updates `.config/nextest.toml` to serialize two process-heavy sets:

- `codex-core` tests matching `package(codex-core) & kind(test) &
test(apply_patch_cli)`
- `codex-windows-sandbox` tests matching `package(codex-windows-sandbox)
& test(legacy_)`

`codex-app-server` integration tests were already serialized inside
their own package; this change reduces overlap with the other suites
that were saturating the runner at the same time.

## Verification

- `cargo nextest list --filterset "package(codex-core) & kind(test) &
test(apply_patch_cli)"`
- `cargo nextest list --filterset "package(codex-windows-sandbox) &
test(legacy_)"`

The Windows sandbox filter naturally lists no tests on macOS, but it
validates the nextest filter/config syntax locally.
2026-04-21 21:14:45 -07:00
Michael Bolin f5288c8362 Merge 448f71e7d0 into sapling-pr-archive-bolinfest 2026-04-21 21:13:16 -07:00
Michael Bolin 448f71e7d0 fix(exec-server): retain output until streams close 2026-04-21 21:12:52 -07:00
Dylan Hurd 0e39614d87 chore(tui) debug-config guardian_policy_config (#18923)
## Summary
List guardian_policy_config_source in `/debug-config` output

## Testing
 - [x] Ran locally
2026-04-21 21:00:23 -07:00
Eric Traut c7e5a9d95e Keep TUI status surfaces in sync (#18935) 2026-04-21 20:39:23 -07:00
Michael Bolin 4615e8a8a8 Merge e004f241f4 into sapling-pr-archive-bolinfest 2026-04-21 20:37:23 -07:00
Michael Bolin e004f241f4 tests: serialize process-heavy Windows CI suites 2026-04-21 20:37:14 -07:00
Michael Bolin 03ae4db0f4 ci: keep argument comment lint checks materialized (#18926)
## Why

The fast `rust-ci` workflow decides whether to run the cross-platform
`argument-comment-lint` job based on changed paths. PRs that touch
Rust-adjacent Bazel wrapper files, such as `defs.bzl` or
`workspace_root_test_launcher.*.tpl`, can change how Rust tests and lint
targets behave without changing any `.rs` files.

When that detector returned false, GitHub skipped the matrix job before
expanding it. That produced a single skipped check named `Argument
comment lint - ${{ matrix.name }}` instead of the Linux, macOS, and
Windows check names that branch protection expects, leaving the PR
unable to go green when those matrix checks are required.

## What Changed

- Treat root Bazel wrapper files as `argument-comment-lint` relevant
changes.
- Keep the `argument_comment_lint_prebuilt` matrix job materialized for
every PR so the per-platform check names always exist.
- Add a single gate step that decides whether the real lint work should
run.
- Move the checkout-adjacent Bazel setup and OS-specific lint commands
into `.github/actions/run-argument-comment-lint/action.yml` so the
workflow does not repeat the same path-detection condition on each step.

## Verification

- Parsed `.github/workflows/rust-ci.yml` and
`.github/actions/run-argument-comment-lint/action.yml` with Python YAML
loading.
- Simulated the workflow path-matching shell conditions for the root
Bazel wrapper files and confirmed they set `argument_comment_lint=true`.
2026-04-22 03:36:46 +00:00
Michael Bolin f9c059e000 Merge 04d83c97b2 into sapling-pr-archive-bolinfest 2026-04-21 20:35:05 -07:00
Michael Bolin 04d83c97b2 app-server: flush stdio responses 2026-04-21 20:34:53 -07:00
Michael Bolin 133da6bed0 Merge 731b54d08f into sapling-pr-archive-bolinfest 2026-04-21 20:27:05 -07:00
Michael Bolin 731b54d08f tests: serialize process-heavy Windows CI suites 2026-04-21 20:26:51 -07:00
Michael Bolin 9f59ead36a Merge 3876bdae69 into sapling-pr-archive-bolinfest 2026-04-21 20:23:55 -07:00
Michael Bolin 3876bdae69 tests: isolate approval fixtures from host rules 2026-04-21 20:23:06 -07:00
Michael Bolin 4eea596672 shell-escalation: carry resolved permission profiles 2026-04-21 20:23:06 -07:00
Michael Bolin 1e495d7048 mcp: include permission profiles in sandbox state 2026-04-21 20:23:06 -07:00
Michael Bolin 2f25e5a87e tui: carry permission profiles on user turns 2026-04-21 20:23:06 -07:00
Michael Bolin 19958ca802 tui: sync session permission profiles 2026-04-21 20:23:06 -07:00
Michael Bolin b53f181d85 app-server: accept command permission profiles 2026-04-21 20:23:06 -07:00
Michael Bolin ee9808cc67 protocol: report session permission profiles 2026-04-21 20:23:06 -07:00
Michael Bolin c5baf5a49f rollout: persist turn permission profiles 2026-04-21 20:23:06 -07:00
Michael Bolin 1262d6582a clients: send permission profiles to app-server 2026-04-21 20:23:06 -07:00
Michael Bolin 9048348b5f app-server: accept permission profile overrides 2026-04-21 20:23:06 -07:00
Michael Bolin fcfb087fe5 app-server: expose thread permission profiles 2026-04-21 20:23:06 -07:00
Michael Bolin a7f1a08d1b core: derive active permission profiles 2026-04-21 20:23:06 -07:00
Michael Bolin 36f8bb4ffa exec-server: carry filesystem sandbox profiles (#18276)
## Why

The exec-server still needs platform sandbox inputs, but the migration
should preserve the `PermissionProfile` that produced them. Keeping only
the derived legacy sandbox map would keep `SandboxPolicy` as the
effective abstraction and would make full-disk vs. restricted profiles
harder to preserve as the permissions stack starts round-tripping
profiles.

`PermissionProfile` entries can also be cwd-sensitive (`:cwd`,
`:project_roots`, relative globs), so the exec-server must carry the
request sandbox cwd instead of resolving those entries against the
long-lived exec-server process cwd.

## What changed

`FileSystemSandboxContext` now carries `permissions: PermissionProfile`
plus an optional `cwd`:

- removed `sandboxPolicy`, `sandboxPolicyCwd`,
`fileSystemSandboxPolicy`, and `additionalPermissions`
- added `permissions` and `cwd`
- kept the platform knobs `windowsSandboxLevel`,
`windowsSandboxPrivateDesktop`, and `useLegacyLandlock`

Core turn and apply-patch paths populate the context from the active
runtime permissions and request cwd. Exec-server derives platform
`SandboxPolicy`/`FileSystemSandboxPolicy` at the filesystem boundary,
adds helper runtime reads there, and rejects cwd-dependent profiles that
arrive without a cwd.

The legacy `FileSystemSandboxContext::new(SandboxPolicy)` constructor
now preserves the old workspace-write conversion semantics for
compatibility tests/callers.

## Verification

- `cargo test -p codex-exec-server`
- `cargo test -p codex-exec-server sandbox_cwd -- --nocapture`
- `cargo test -p codex-exec-server
sandbox_context_new_preserves_legacy_workspace_write_read_only_subpaths
-- --nocapture`
- `cargo test -p codex-core --lib
file_system_sandbox_context_uses_active_attempt -- --nocapture`
2026-04-21 20:22:28 -07:00
Michael Bolin 4b1837bbab Merge 592110f731 into sapling-pr-archive-bolinfest 2026-04-21 20:05:15 -07:00
Michael Bolin 592110f731 ci: keep argument comment lint checks materialized 2026-04-21 20:05:01 -07:00
efrazer-oai 564860e8bd refactor: add agent identity crate (#18871)
## Summary

This PR adds `codex-agent-identity` as an isolated crate for Agent
Identity business logic.

The crate owns:
- AgentAssertion construction.
- Agent task registration.
- private-key assertion signing.
- bounded blocking HTTP for task registration.

It does not wire AgentIdentity into `auth.json`, `AuthManager`, rollout
state, or request callsites. That integration happens in later PRs.

Reference old stack: https://github.com/openai/codex/pull/17387/changes

## Stack

1. https://github.com/openai/codex/pull/18757: full revert
2. This PR: isolated Agent Identity crate
3. https://github.com/openai/codex/pull/18785: explicit AgentIdentity
auth mode and startup task allocation
4. https://github.com/openai/codex/pull/18811: migrate Codex backend
auth callsites through AuthProvider
5. https://github.com/openai/codex/pull/18904: accept AgentIdentity JWTs
and load `CODEX_AGENT_IDENTITY`

## Testing

Tests: targeted Rust checks, cargo-shear, Bazel lock check, and CI.
2026-04-21 19:57:49 -07:00
Michael Bolin 547c8c43a4 merge commit for archive created by Sapling 2026-04-21 19:57:42 -07:00
Michael Bolin 39310e7088 exec-server: carry filesystem sandbox profiles 2026-04-21 19:57:27 -07:00
Michael Bolin 8fea372c77 Fix remote app-server shutdown race (#18936)
## Why

A Mac Bazel CI run saw `remote_notifications_arrive_over_websocket` fail
during shutdown with `remote app-server shutdown channel is closed`
(https://app.buildbuddy.io/invocation/9dac05d6-ae20-40f9-b627-fca6e91cf127).
The remote websocket worker can legitimately finish while `shutdown()`
is waiting for the shutdown acknowledgement: after the test server sends
a notification and exits, the worker may deliver the required disconnect
event, observe that the caller has dropped the event receiver, and exit
before it sends the shutdown one-shot.

That state is already terminal cleanup, not a failed shutdown, so
callers should not see a `BrokenPipe` from the acknowledgement channel.

## What Changed

- Treat a closed remote shutdown acknowledgement as an already-exited
worker while still propagating websocket close errors when the worker
returns them.
- Added a deterministic regression test for the interleaving where the
shutdown command is received and the worker exits before replying.

## Verification

- `cargo test -p codex-app-server-client`
- New test:
`remote::tests::shutdown_tolerates_worker_exit_after_command_is_queued`
2026-04-22 02:41:19 +00:00
Michael Bolin c76ca34261 merge commit for archive created by Sapling 2026-04-21 19:35:55 -07:00
Michael Bolin 9d11c77a95 exec-server: carry filesystem sandbox profiles 2026-04-21 19:34:59 -07:00
Michael Bolin 5508824649 Merge 5a7a2a89c3 into sapling-pr-archive-bolinfest 2026-04-21 19:27:32 -07:00
Michael Bolin 5a7a2a89c3 app-server-client: tolerate remote shutdown race 2026-04-21 19:27:17 -07:00
Michael Bolin 592481ae53 Merge 9187181d15 into sapling-pr-archive-bolinfest 2026-04-21 18:40:59 -07:00
Michael Bolin 9187181d15 ci: keep argument comment lint checks materialized 2026-04-21 18:40:37 -07:00
xl-openaiandCodex a978e411f6 feat: Support remote plugin list/read. (#18452)
Add a temporary internal remote_plugin feature flag that merges remote
marketplaces into plugin/list and routes plugin/read through the remote
APIs when needed, while keeping pure local marketplaces working as
before.

---------

Co-authored-by: Codex <noreply@openai.com>
2026-04-21 18:39:07 -07:00
Michael Bolin 536952eeee bazel: run wrapped Rust unit test shards (#18913)
## Why

The `codex-tui` Cargo test suite was catching stale snapshot
expectations, but the matching Bazel unit-test target was still green.
The TUI unit target is wrapped by `workspace_root_test` so tests run
from the repository root and Insta can resolve Cargo-like snapshot
paths. After native Bazel sharding was enabled for that wrapped target,
rules_rust also inserted its own sharding wrapper around the Rust test
binary.

Those two wrappers did not compose: rules_rust's sharding wrapper
expects to run from its own runfiles cwd, while `workspace_root_test`
deliberately changes cwd to the repo root before invoking the test. In
that configuration, the inner wrapper could fail to enumerate the Rust
tests and exit successfully with empty shards, so snapshot regressions
were not being exercised by Bazel.

## What Changed

- Stop enabling rules_rust's inner `experimental_enable_sharding` for
unit-test binaries created by `codex_rust_crate`.
- Keep the configured `shard_count` on the outer `workspace_root_test`
target.
- Add libtest sharding directly to `workspace_root_test_launcher.sh.tpl`
and `workspace_root_test_launcher.bat.tpl` after the launcher has
resolved the actual test binary and established the intended
repository-root cwd.
- Partition tests by a stable FNV-1a hash of each libtest test name,
matching the stable-shard behavior we wanted without depending on the
inner rules_rust wrapper.
- Preserve ad-hoc local test filters by running the resolved test binary
directly when explicit test args are supplied.
- On Windows, run selected libtest names from the shard list in bounded
PowerShell batches instead of concatenating every selected test into one
`cmd.exe` command line.

This PR is stacked on top of #18912, which contains only the snapshot
expectation updates exposed once the Bazel target actually runs the TUI
unit tests. It is also the reason #18916 becomes visible: once this
wrapper fix makes Bazel execute the affected `codex-core` test, that
test needs its own executable-path setup fixed.

## Verification

- `cargo test -p codex-tui`
- `bazel test //codex-rs/tui:tui-unit-tests --test_output=errors`
- `bazel test //codex-rs/tui:all --test_output=errors`
- `bash -n workspace_root_test_launcher.sh.tpl`
- Exercised the Windows PowerShell batching fragment locally with a fake
test binary and shard-list file.
2026-04-21 18:35:47 -07:00
Michael Bolin 5c94032350 Merge a7f7c21942 into sapling-pr-archive-bolinfest 2026-04-21 18:31:56 -07:00
Michael Bolin a7f7c21942 tests: isolate approval fixtures from host rules 2026-04-21 18:31:35 -07:00
Michael Bolin 1ffa050cdf shell-escalation: carry resolved permission profiles 2026-04-21 18:31:35 -07:00
Michael Bolin ed38a7a2b2 mcp: include permission profiles in sandbox state 2026-04-21 18:31:35 -07:00
Michael Bolin 9b4b198cf3 tui: carry permission profiles on user turns 2026-04-21 18:31:35 -07:00
Michael Bolin 9c60c2e054 tui: sync session permission profiles 2026-04-21 18:31:35 -07:00