Commit Graph
6644 Commits
Author SHA1 Message Date
Eric Traut afdf699cc0 Merge branch 'etraut/next-turn-state-app-server' into etraut/next-turn-state-tui 2026-05-16 16:00:56 -07:00
Eric Traut 9af52a593b Merge branch 'etraut/next-turn-state-core' into etraut/next-turn-state-app-server 2026-05-16 16:00:50 -07:00
Eric Traut a31c4cd218 Merge branch 'etraut/next-turn-state-remove-override-context' into etraut/next-turn-state-core
# Conflicts:
#	codex-rs/core/src/codex_thread.rs
2026-05-16 16:00:41 -07:00
Eric Traut 5b47db287d Fix OverrideTurnContext removal split 2026-05-16 16:00:11 -07:00
Eric Traut fd0125a122 Merge branch 'etraut/next-turn-state-app-server' into etraut/next-turn-state-tui 2026-05-16 15:49:31 -07:00
Eric Traut f3703798ee Merge branch 'etraut/next-turn-state-core' into etraut/next-turn-state-app-server 2026-05-16 15:49:24 -07:00
Eric Traut 9393c2647b Add queued core turn context op 2026-05-16 15:49:05 -07:00
Eric Traut 875b846721 Remove core OverrideTurnContext op 2026-05-16 15:47:40 -07:00
Eric Traut 0c291736bf Merge branch 'etraut/next-turn-state-app-server' into etraut/next-turn-state-tui 2026-05-16 14:44:18 -07:00
Eric Traut e3bb6dad55 Merge branch 'etraut/next-turn-state-core' into etraut/next-turn-state-app-server 2026-05-16 14:43:58 -07:00
Eric Traut b2fa7ac1d0 Document direct turn context override ordering 2026-05-16 14:43:36 -07:00
Eric Traut a5b5369d44 Merge branch 'etraut/next-turn-state-app-server' into etraut/next-turn-state-tui 2026-05-16 14:22:14 -07:00
Eric Traut 49bcf51b7f Merge branch 'etraut/next-turn-state-core' into etraut/next-turn-state-app-server
# Conflicts:
#	codex-rs/app-server/src/request_processors/turn_processor.rs
2026-05-16 14:22:05 -07:00
Eric Traut 1320847a37 Merge branch 'etraut/next-turn-state-input-op-consolidation' into etraut/next-turn-state-core 2026-05-16 14:21:21 -07:00
Eric Traut 1c10a91853 Merge branch 'etraut/next-turn-state-remove-user-input-with-context' into etraut/next-turn-state-input-op-consolidation
# Conflicts:
#	codex-rs/app-server/src/request_processors/turn_processor.rs
#	codex-rs/core/src/session/handlers.rs
#	codex-rs/protocol/src/protocol.rs
2026-05-16 14:21:06 -07:00
Eric Traut cb528adace Remove UserInputWithTurnContext op 2026-05-16 14:20:00 -07:00
Eric Traut 3b1b54ace7 Add turn context to UserInput 2026-05-16 14:16:20 -07:00
Eric Traut d8c50437f3 Merge branch 'etraut/next-turn-state-app-server' into etraut/next-turn-state-tui 2026-05-16 13:51:47 -07:00
Eric Traut 6e0bf085f3 Merge branch 'etraut/next-turn-state-core' into etraut/next-turn-state-app-server 2026-05-16 13:51:38 -07:00
Eric Traut 745fb81766 Merge branch 'etraut/next-turn-state-input-op-consolidation' into etraut/next-turn-state-core 2026-05-16 13:51:28 -07:00
Eric Traut e1b60da6fc Fix clippy field shorthand in core tests 2026-05-16 13:51:13 -07:00
sayan-oai 061a614d85 multiagent: trim model-visible description, cap to 5 models (#23069)
## Why

The `spawn_agent` model override guidance is uncapped and bloating
context. We need to trim down each entry and cap total entries.

picked 5 as cap, we can change

## What changed

- Cap the model override summaries shown in `spawn_agent` to the first 5
picker-visible models, preserving the existing priority ordering from
the models manager.
- Condense each rendered entry to the actionable pieces the model needs:
  - use the model slug as the label
  - render compact reasoning effort lists with the default marked inline
- render only service tier IDs, and omit the clause when no tiers are
available
- Update coverage so the compact formatter shape and the top-5 cap are
exercised, and keep the end-to-end request assertion aligned with real
model metadata.

## Example

Before:

`- gpt-5.4 ('gpt-5.4\'): Strong model for everyday coding. Default
reasoning effort: medium. Supported reasoning efforts: low (Fast
responses with lighter reasoning), medium (Balances speed and reasoning
depth for everyday tasks), high (Greater reasoning depth for complex
problems), xhigh (Extra high reasoning depth for complex problems).
Supported service tiers: priority (Fast: 1.5x speed, increased usage).`

After:

`- 'gpt-5.4': Strong model for everyday coding. Reasoning efforts: low,
medium (default), high, xhigh. Service tiers: priority.`
2026-05-16 13:43:30 -07:00
Eric Traut 546bf612b6 Merge branch 'etraut/next-turn-state-app-server' into etraut/next-turn-state-tui 2026-05-16 13:32:41 -07:00
Eric Traut 744ed740f1 Merge branch 'etraut/next-turn-state-core' into etraut/next-turn-state-app-server
# Conflicts:
#	codex-rs/app-server/src/request_processors.rs
#	codex-rs/app-server/src/request_processors/turn_processor.rs
2026-05-16 13:31:59 -07:00
Eric Traut e3d8a8e412 Merge branch 'etraut/next-turn-state-input-op-consolidation' into etraut/next-turn-state-core
# Conflicts:
#	codex-rs/app-server/src/request_processors/turn_processor.rs
#	codex-rs/core/src/session/handlers.rs
#	codex-rs/core/src/session/tests.rs
#	codex-rs/protocol/src/protocol.rs
2026-05-16 13:28:33 -07:00
Miaolin Min 6941f5c2c5 [codex] preserve MCP result meta in McpToolCallItemResult (#22946)
## Summary

https://openai.slack.com/archives/C0ARA9UAQEA/p1778890981647319?thread_ts=1778888537.934319&cid=C0ARA9UAQEA


- Add `_meta` to exec JSONL MCP tool call result events.
- Copy MCP result metadata through the JSONL event conversion.
- Add a focused test that verifies `_meta` is serialized as `_meta` and
not `meta`.


## Verification

https://www.notion.so/openai/Miaolin-0516-_meta-population-debug-3628e50b62b08074b365e0ce1ffb8f74
2026-05-16 13:27:44 -07:00
Eric Traut 30f6ab2372 Consolidate core input ops 2026-05-16 13:19:04 -07:00
Michael Zeng b200dd1b6f exec-server: support auth-backed remote executor registration (#22769)
This updates remote `exec-server` registration to use normal Codex auth
instead of a registry-issued credential. The registry request is built
from the existing auth-provider path, which preserves the biscuit-only
registry contract introduced in
[openai/openai#924101](https://github.com/openai/openai/pull/924101)
while removing the old remote registry bearer env var and its direct
transport assumptions.

The default remote flow uses persisted ChatGPT auth from the normal
Codex config/storage path. This PR also includes the containerized Agent
Identity path needed by
[openai/openai#924260](https://github.com/openai/openai/pull/924260):
remote `exec-server` accepts `--allow-agent-identity-auth`, permits
Agent Identity auth loaded from `CODEX_ACCESS_TOKEN` only when that flag
is present, and reuses the existing Agent task registration plus derived
`AgentAssertion` header generation. API-key auth remains unsupported,
and Agent Identity stays opt-in.

Validation performed beyond normal presubmit coverage:
- `cargo fmt --all --check`
- `cargo check -p codex-cli`
- `cargo test -p codex-exec-server`
- `cargo test -p codex-cli exec_server_agent_identity_auth_flag_`
- `cargo test -p codex-cli remote_exec_server_auth_mode_`

I also attempted `cargo test -p codex-cli`. The new CLI tests passed
inside that run, but the suite ended on an unrelated local
marketplace-state failure in
`plugin_list_excludes_unconfigured_repo_local_marketplaces`.
2026-05-16 12:48:28 -07:00
Eric Traut 11b4da4a58 Fix TUI turn context permissions merge 2026-05-16 12:40:37 -07:00
Eric Traut a987271f11 Merge branch 'etraut/next-turn-state-app-server' into etraut/next-turn-state-tui 2026-05-16 12:36:02 -07:00
Eric Traut 95307a58ca Merge branch 'etraut/next-turn-state-core' into etraut/next-turn-state-app-server
# Conflicts:
#	codex-rs/app-server/README.md
#	codex-rs/app-server/src/request_processors.rs
#	codex-rs/app-server/src/request_processors/turn_processor.rs
2026-05-16 12:35:41 -07:00
Eric Traut 34263f13ca Merge remote-tracking branch 'origin/main' into etraut/next-turn-state-core
# Conflicts:
#	codex-rs/core/src/session/handlers.rs
#	codex-rs/core/src/session/tests.rs
#	codex-rs/protocol/src/protocol.rs
2026-05-16 12:29:40 -07:00
Michael Bolin d91bc15618 test: construct permission profiles directly (#23030)
## Why

`SandboxPolicy` is now a legacy compatibility shape, but several tests
still built a `SandboxPolicy` only to immediately convert it into
`PermissionProfile` for APIs that already accept canonical runtime
permissions. Those detours make it harder to audit where legacy sandbox
policy is still required, because boundary-only usages are mixed
together with ordinary test setup.

## What Changed

- Updated tests in `codex-core`, `codex-exec`, `codex-analytics`, and
`codex-config` to construct `PermissionProfile` values directly when the
code under test takes a permission profile.
- Changed exec-policy, request-permissions, session, and sandbox test
helpers to pass `PermissionProfile` through instead of converting from
`SandboxPolicy` internally.
- Left `SandboxPolicy` in place where tests are explicitly exercising
legacy compatibility or request/response boundaries.

## Test Plan

- `cargo test -p codex-analytics -p codex-config`
- `cargo test -p codex-core --lib safety::tests`
- `cargo test -p codex-core --lib exec_policy::tests::`
- `cargo test -p codex-core --lib exec::tests`
- `cargo test -p codex-core --lib guardian_review_session_config`
- `cargo test -p codex-core --lib tools::network_approval::tests`
- `cargo test -p codex-core --lib
tools::runtimes::shell::unix_escalation::tests`
- `cargo test -p codex-core --lib managed_network`
- `cargo test -p codex-core --test all request_permissions::`
- `cargo test -p codex-exec sandbox`


---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/23030).
* #23036
* __->__ #23030
2026-05-16 12:12:37 -07:00
Eric Traut 941e7f825e Improve goal completion usage reporting (#22907)
## Why

Goal completion follow-up turns currently receive a preformatted English
usage sentence such as `time used: 2586 seconds`. That nudges the model
to echo an awkward raw seconds count in the final reply, even though the
tool result already exposes structured usage fields like
`goal.timeUsedSeconds`, `goal.tokensUsed`, and `goal.tokenBudget`.

## What changed

- Replace the preformatted completion usage sentence with guidance to
read the structured goal fields from the tool result.
- Preserve token-budget reporting while allowing the model to phrase
elapsed time in a concise, human-friendly way that fits the response
language.
- Update core coverage for both the generated completion guidance and
the session flow that forwards it back to the model.

## Verification

Previously, it would have output a final message indicating that it
"worked for 303 seconds". Now it shows the following:

<img width="286" height="35" alt="image"
src="https://github.com/user-attachments/assets/d7011880-9449-46a7-856f-4e50ae00eb45"
/>
2026-05-16 11:49:40 -07:00
Ahmed Ibrahim a280248021 [codex] Split Python SDK helper logic (#22939)
## Summary
- Move approval-mode mapping into
`sdk/python/src/openai_codex/_approval_mode.py`.
- Move initialize metadata parsing and normalization into
`sdk/python/src/openai_codex/_initialize_metadata.py`.
- Keep the public `ApprovalMode` export stable and retarget direct
metadata helper coverage.

## Integration coverage
- Add an app-server harness smoke that exercises sync and async SDK
initialization plus thread creation.

## Validation
- Local tests were not run per repo guidance. CI should validate this
branch once the PR is online.
2026-05-16 09:47:51 -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
Eric Traut 6cfccaca00 Merge branch 'etraut/next-turn-state-app-server' into etraut/next-turn-state-tui 2026-05-15 18:34:32 -07:00
Eric Traut 474dd05351 Merge branch 'etraut/next-turn-state-core' into etraut/next-turn-state-app-server 2026-05-15 18:34:10 -07:00
Eric Traut 24b27613cf Handle turn context applied in MCP runner 2026-05-15 18:33:47 -07:00
Eric Traut 806d722c7a Merge branch 'etraut/next-turn-state-app-server' into etraut/next-turn-state-tui 2026-05-15 18:27:19 -07:00
Eric Traut f87f7f2ab9 Merge branch 'etraut/next-turn-state-core' into etraut/next-turn-state-app-server 2026-05-15 18:27:03 -07:00
Eric Traut 09588ff9c7 Simplify turn context core changes 2026-05-15 18:26:30 -07:00
Eric Traut cf0e9c5356 Merge branch 'etraut/next-turn-state-app-server' into etraut/next-turn-state-tui 2026-05-15 18:05:15 -07:00
Eric Traut 8c4e73d322 Use queued turn context updates in app server 2026-05-15 18:05:01 -07:00
Eric Traut ba863d1fc8 Merge branch 'etraut/next-turn-state-core' into etraut/next-turn-state-app-server 2026-05-15 18:03:35 -07:00
Eric Traut a46e9baa4b Add queued turn context core op 2026-05-15 18:03:20 -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
Eric Traut e2325a2ec4 Merge branch 'etraut/next-turn-state-app-server' into etraut/next-turn-state-tui 2026-05-15 16:50:45 -07:00