Commit Graph

6734 Commits

Author SHA1 Message Date
Eric Traut
49860973c4 Merge branch 'etraut/next-turn-state-core' into etraut/next-turn-state-app-server
# Conflicts:
#	codex-rs/app-server-protocol/src/protocol/common.rs
#	codex-rs/app-server-protocol/src/protocol/v2/thread.rs
#	codex-rs/app-server/src/request_processors/turn_processor.rs
2026-05-18 19:26:52 -07:00
Eric Traut
ef2278bfdc Merge branch 'etraut/next-turn-state-remove-override-context' into etraut/next-turn-state-core 2026-05-18 19:23:13 -07:00
Eric Traut
154ef812a5 Merge branch 'etraut/next-turn-state-input-op-consolidation' into etraut/next-turn-state-remove-override-context 2026-05-18 19:23:01 -07:00
Eric Traut
45fe8ff8cc Merge branch 'etraut/next-turn-state-remove-user-input-with-context' into etraut/next-turn-state-input-op-consolidation
# Conflicts:
#	codex-rs/core/src/session/handlers.rs
#	codex-rs/core/tests/common/test_codex.rs
#	codex-rs/core/tests/suite/request_permissions.rs
#	codex-rs/core/tests/suite/unified_exec.rs
#	codex-rs/protocol/src/protocol.rs
2026-05-18 19:22:12 -07:00
Eric Traut
6927359c0c Simplify turn start context overrides 2026-05-18 18:51:31 -07:00
Eric Traut
e3fe029000 Remove UserInputWithTurnContext op 2026-05-18 18:51:06 -07:00
Eric Traut
84d941d07f [1 of 7] Add thread settings to UserInput (#23080)
**Stack position:** [1 of 7]

## Summary

The first three PRs in this stack are a cleanup pass before the actual
thread settings API work.

Today, core has several overlapping "user input" ops: `UserInput`,
`UserInputWithTurnContext`, and `UserTurn`. They differ mostly in how
much next-turn state they carry, which makes the later queued thread
settings update harder to reason about and review.

This PR starts that cleanup by adding the shared
`ThreadSettingsOverrides` payload and allowing `Op::UserInput` to carry
it. Existing variants remain in place here, so this layer is mostly a
behavior-preserving API shape change plus mechanical constructor
updates.

## End State After PR3

By the end of PR3, `Op::UserInput` is the only "user input" core op. It
can carry optional thread settings overrides for callers that need to
update stored defaults with a turn, while callers without updates use
empty settings. `Op::UserInputWithTurnContext` and `Op::UserTurn` are
deleted.

## End State After PR5

By the end of PR5, core will have only two ops for this area:

- `Op::UserInput` for user-input-bearing submissions.
- `Op::ThreadSettings` for settings-only updates.

## Stack

1. [1 of 7] [Add thread settings to
UserInput](https://github.com/openai/codex/pull/23080) (this PR)
2. [2 of 7] [Remove
UserInputWithTurnContext](https://github.com/openai/codex/pull/23081)
3. [3 of 7] [Remove
UserTurn](https://github.com/openai/codex/pull/23075)
4. [4 of 7] [Placeholder for OverrideTurnContext
cleanup](https://github.com/openai/codex/pull/23087)
5. [5 of 7] [Replace OverrideTurnContext with
ThreadSettings](https://github.com/openai/codex/pull/22508)
6. [6 of 7] [Add app-server thread settings
API](https://github.com/openai/codex/pull/22509)
7. [7 of 7] [Sync TUI thread
settings](https://github.com/openai/codex/pull/22510)
2026-05-18 18:48:35 -07:00
Eric Traut
052260a50b Absolutize thread settings cwd before queueing 2026-05-18 18:42:41 -07:00
Eric Traut
654586eda6 Update TUI thread settings notification matches 2026-05-18 18:31:49 -07:00
Eric Traut
505a6dec64 Wait for accepted thread settings updates 2026-05-18 18:27:29 -07:00
sayan-oai
daa11820b0 Remove ToolSearch feature toggle (#23389)
## Summary
- mark `ToolSearch` as removed and ignore stale config writes for its
legacy key
- make search tool exposure depend only on model capability, not a
feature toggle
- remove app-server enablement support and prune now-obsolete test
coverage/setup

## Verification
- `cargo test -p codex-features`
- `cargo test -p codex-tools`
- `cargo test -p codex-core search_tool_requires_model_capability`
- `cargo test -p codex-app-server experimental_feature_enablement_set_`

## Notes
- This keeps the legacy config key as a no-op for compatibility while
removing the ability to toggle the behavior off cleanly.
- No developer-facing docs update outside the touched app-server README
was needed.
2026-05-19 01:24:39 +00:00
xl-openai
6b54ced108 cleanup: Remove skill env var dependency prompting (#22721)
Deletes the skill env var dependency prompt feature and its runtime
path. env_var entries in skill dependency metadata are now silently
ignored during skill loading.
2026-05-19 01:24:19 +00:00
Eric Traut
2de6572138 Fix thread settings notification client match 2026-05-18 18:20:24 -07:00
pakrym-oai
17d552fb4d [codex] Remove external websocket session resets (#23384)
## Why

Compaction now installs replacement history inside the session, but the
turn and compaction callers were still reaching into
`ModelClientSession` to reset websocket transport state after that
install. That made a transport-level reset part of the compaction API
even though websocket incremental request selection already checks
whether the next request is a strict extension of the previous one and
falls back to a full `response.create` when it is not.

## What changed

- Removed the compaction-side calls to `reset_websocket_session` from
`compact.rs` and `session/turn.rs`.
- Simplified pre-sampling and mid-turn compaction helpers so they return
`CodexResult<()>` instead of carrying a reset flag.
- Made `ModelClientSession::reset_websocket_session` private to
`client.rs`, leaving only the websocket timeout recovery path inside the
client as a caller.

## Validation

- `cargo test -p codex-core --test all
responses_websocket_creates_on_non_prefix`
- `cargo test -p codex-core --test all
steered_user_input_waits_for_model_continuation_after_mid_turn_compact`
- `cargo test -p codex-core --test all
pre_sampling_compact_runs_on_switch_to_smaller_context_model`
2026-05-19 01:13:38 +00:00
Eric Traut
0f422dd875 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-18 17:43:41 -07:00
Eric Traut
0a2c9aa9d9 Simplify thread settings core helpers 2026-05-18 17:42:36 -07:00
Michael Bolin
3fd79b7986 app-server: use profile ids in v2 permission params (#23360)
## Why

The v2 app-server permission profile fields are experimental, but the
previous migration kept a legacy object payload for profile selection.
That made clients aware of server-owned `activePermissionProfile`
metadata such as `extends`, and it kept a
`legacy_additional_writable_roots` path even though
`runtimeWorkspaceRoots` now owns runtime workspace-root selection.

This PR makes the client contract match the intended model: clients
select a permission profile by id, and the server resolves and reports
active profile provenance in response payloads.

Follow-up to #22611.

## What Changed

- Changed `thread/start`, `thread/resume`, `thread/fork`, and
`turn/start` permission profile selection to plain profile id strings.
- Changed `command/exec.permissionProfile` to a plain profile id string
for the same client/server ownership split.
- Removed `PermissionProfileSelectionParams` and the legacy `{ type:
"profile", modifications: [...] }` compatibility deserializer.
- Updated app-server, TUI, and `codex exec` call sites to send only ids,
while keeping `activePermissionProfile` as server response metadata.
- Updated app-server docs and schema fixtures for the revised
`command/exec.permissionProfile` shape.

## Verification

- `cargo test -p codex-app-server-protocol`
- `RUST_MIN_STACK=8388608 cargo test -p codex-app-server`
- `cargo test -p codex-exec`
- `RUST_MIN_STACK=8388608 cargo test -p codex-tui`

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/23360).
* #23368
* __->__ #23360
2026-05-18 17:28:50 -07:00
Eric Traut
ed2534f1c1 Merge branch 'etraut/next-turn-state-core' into etraut/next-turn-state-app-server 2026-05-18 17:15:30 -07:00
Eric Traut
5dc813bd16 Fix thread settings op kind test 2026-05-18 17:15:15 -07:00
marksteinbrick-oai
5696167fe8 [codex-analytics] preserve user thread source for exec threads (#23376)
## Why
- Follows #20949.
- The above moved `thread_source` attribution from the reducer to
explicit caller provided metadata
- The `codex exec` path still omitted this metadata, leaving
exec-created threads without `thread_source`


## What Changed
- Ensures exec threads are marked as user created (`thread_source =
"user"`)
- Preserves thread-source metadata in exec’s startup session event


## Verification
- Updated unit tests to validate exec `thread_source` propagation.
- `cargo +1.93.0 test -p codex-exec --manifest-path codex-rs/Cargo.toml`
- `cargo +1.93.1 build -p codex-cli --manifest-path codex-rs/Cargo.toml`
- Validated locally with a freshly built `codex exec` run:
  - Startup logs showed `thread_source: Some(User)`.
  - Rollout metadata recorded `"thread_source":"user"`.
2026-05-18 17:13:49 -07:00
Eric Traut
78dc40ac5c Merge branch 'etraut/next-turn-state-core' into etraut/next-turn-state-app-server 2026-05-18 16:46:53 -07:00
Eric Traut
c230815119 Merge branch 'etraut/next-turn-state-remove-override-context' into etraut/next-turn-state-core 2026-05-18 16:46:41 -07:00
Eric Traut
d58faa2abe Keep thread settings stack placeholder 2026-05-18 16:45:25 -07:00
Eric Traut
92d09dbb62 Merge branch 'etraut/next-turn-state-core' into etraut/next-turn-state-app-server 2026-05-18 16:32:07 -07:00
Eric Traut
a14199fbb6 Merge branch 'etraut/next-turn-state-remove-override-context' into etraut/next-turn-state-core 2026-05-18 16:31:20 -07:00
Eric Traut
d6ae36fd8d Merge branch 'etraut/next-turn-state-input-op-consolidation' into etraut/next-turn-state-remove-override-context 2026-05-18 16:30:45 -07:00
Eric Traut
4939645c44 Simplify thread settings test overrides 2026-05-18 16:30:08 -07:00
Felipe Coury
a66712c95d fix(tui): warn on unsupported iTerm2 pet versions (#23371)
## Why

Older iTerm2 builds can be detected as supporting the image transport
that terminal pets use, but in practice they fail to render the pet flow
correctly. Instead of silently attempting image rendering, Codex should
tell the user that their iTerm2 version is too old and that upgrading is
the fix.

## What Changed

- gate iTerm2 pet auto-detection on version `3.6.0` or newer
- show a dedicated upgrade message for older or unknown iTerm2 versions
instead of the generic unsupported-terminal warning
- keep the existing generic unsupported-terminal path for non-iTerm
terminals
- add regression coverage for iTerm2 version parsing and the old-iTerm
warning path

## How to Test

1. Start Codex in iTerm2 3.6 or newer.
2. Run `/pets`.
3. Confirm the pets picker opens instead of showing a warning.
4. Start Codex in an older iTerm2 build, or exercise the equivalent test
path.
5. Run `/pets`.
6. Confirm Codex warns that pets require iTerm2 3.6 or newer and tells
the user to upgrade.
7. Also verify that a non-iTerm unsupported terminal still shows the
generic unsupported-terminal message.

Targeted tests:
- `cargo test -p codex-terminal-detection`
- `cargo test -p codex-tui pets::`
- `cargo test -p codex-tui slash_pets_on_unsupported_terminal`
- `cargo test -p codex-tui slash_pets_on_old_iterm2`
2026-05-18 20:24:09 -03:00
Eric Traut
17816b6664 Merge branch 'etraut/next-turn-state-core' into etraut/next-turn-state-app-server 2026-05-18 16:17:54 -07:00
Eric Traut
0a2edb9e31 Merge branch 'etraut/next-turn-state-remove-override-context' into etraut/next-turn-state-core 2026-05-18 16:17:38 -07:00
Eric Traut
5ff0c296bb Merge branch 'etraut/next-turn-state-input-op-consolidation' into etraut/next-turn-state-remove-override-context 2026-05-18 16:17:20 -07:00
Eric Traut
2836662ea4 Fix thread settings field rename 2026-05-18 16:17:01 -07:00
Eric Traut
1484283d12 Merge branch 'etraut/next-turn-state-core' into etraut/next-turn-state-app-server 2026-05-18 16:09:25 -07:00
Eric Traut
b7d18d7606 Merge branch 'etraut/next-turn-state-remove-override-context' into etraut/next-turn-state-core
# Conflicts:
#	codex-rs/core/src/session/handlers.rs
2026-05-18 16:09:13 -07:00
Eric Traut
76447889f2 Merge branch 'etraut/next-turn-state-input-op-consolidation' into etraut/next-turn-state-remove-override-context 2026-05-18 16:08:16 -07:00
Eric Traut
dea732b035 Merge branch 'etraut/next-turn-state-remove-user-input-with-context' into etraut/next-turn-state-input-op-consolidation 2026-05-18 16:07:57 -07:00
Eric Traut
d3052c6136 Merge branch 'etraut/next-turn-state-user-input-context' into etraut/next-turn-state-remove-user-input-with-context 2026-05-18 16:07:45 -07:00
Eric Traut
9ad7f64d9d Clarify thread settings model updates 2026-05-18 16:06:51 -07:00
Eric Traut
fd4929c5b8 Rename app-server docs to thread settings 2026-05-18 15:58:04 -07:00
Eric Traut
e8e4502b64 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-18 15:46:18 -07:00
pakrym-oai
afa0101ae2 [codex] Move pending input into input queue (#22728)
## Why

Pending model input was split across `Session`, `TurnState`, and the
agent mailbox. That made it easy for new paths to manage queued user
input or mailbox delivery outside the intended ownership boundary.

This PR consolidates the model-facing input lifecycle behind the session
input queue so turn-local pending input, next-turn queued items, and
mailbox delivery coordination are owned in one place.

## What Changed

- Added `session/input_queue.rs` to own pending input queues and mailbox
delivery coordination.
- Removed the standalone `agent/mailbox.rs` channel wrapper and store
mailbox items directly in the input queue.
- Moved pending-input mutations off `TurnState`; `TurnState` now exposes
the queue-owned storage directly for now.
- Routed abort cleanup, mailbox delivery phase changes, next-turn queued
items, and active-turn pending input through `InputQueue`.
- Boxed stack-heavy agent resume/fork startup futures that the refactor
pushed over the default test stack.
- Updated session, task, goal, stream-event, and multi-agent call sites
and tests to use the new queue ownership.

## Verification

- `cargo test -p codex-core --lib agent::control::tests`
- `cargo test -p codex-core --lib
agent::control::tests::resume_closed_child_reopens_open_descendants --
--exact`
- `cargo test -p codex-core --lib
agent::control::tests::spawn_agent_fork_last_n_turns_keeps_only_recent_turns
-- --exact`
- `cargo test -p codex-core --lib
agent::control::tests::resume_thread_subagent_restores_stored_nickname_and_role
-- --exact`
- `cargo test -p codex-core` was also run; it completed with 1814
passed, 4 ignored, and one timeout in
`agent::control::tests::resume_thread_subagent_restores_stored_nickname_and_role`,
which passed when rerun in isolation.
2026-05-18 15:43:01 -07:00
Eric Traut
de38d2a98b Merge branch 'etraut/next-turn-state-remove-override-context' into etraut/next-turn-state-core
# Conflicts:
#	codex-rs/core/src/codex_thread.rs
#	codex-rs/core/src/session/handlers.rs
#	codex-rs/core/tests/suite/collaboration_instructions.rs
#	codex-rs/core/tests/suite/compact.rs
#	codex-rs/core/tests/suite/compact_remote.rs
#	codex-rs/core/tests/suite/compact_resume_fork.rs
#	codex-rs/core/tests/suite/model_overrides.rs
#	codex-rs/core/tests/suite/model_switching.rs
#	codex-rs/core/tests/suite/model_visible_layout.rs
#	codex-rs/core/tests/suite/override_updates.rs
#	codex-rs/core/tests/suite/permissions_messages.rs
#	codex-rs/core/tests/suite/personality.rs
#	codex-rs/core/tests/suite/prompt_caching.rs
#	codex-rs/core/tests/suite/remote_models.rs
#	codex-rs/core/tests/suite/resume.rs
#	codex-rs/core/tests/suite/review.rs
#	codex-rs/memories/write/src/startup_tests.rs
#	codex-rs/protocol/src/protocol.rs
2026-05-18 15:36:21 -07:00
Matthew Zeng
a66e0e9c4b Include plugin id in plugin MCP tool metadata (#23353)
Adding the id of the plugin that contains the MCP (if any) so we can
apply filters at plugin level.

## Summary
- carry the plugin owner into MCP runtime provenance
- attach `plugin_id` to outbound plugin-backed MCP tool-call `_meta`
- avoid misattributing user-configured MCP servers that shadow plugin
server names

## Testing
- `just fmt`
- `just fix -p codex-mcp`
- `just fix -p codex-core`
- `cargo test -p codex-mcp`
- `cargo test -p codex-core
plugin_mcp_tool_call_request_meta_includes_plugin_id`
- `cargo test -p codex-core
to_mcp_config_omits_plugin_id_when_user_server_shadows_plugin_mcp`
- `cargo test -p codex-core
rebuild_preserving_session_layers_refreshes_plugin_derived_mcp_config`
- `git diff --check`

## Notes
- Attempted `cargo test -p codex-core`; it aborted in
`agent::control::tests::resume_agent_from_rollout_skips_descendants_when_parent_resume_fails`
with a stack overflow before the full suite completed.
2026-05-18 15:33:33 -07:00
Eric Traut
a940c8db7b Merge branch 'etraut/next-turn-state-input-op-consolidation' into etraut/next-turn-state-remove-override-context
# Conflicts:
#	codex-rs/core/src/codex_thread.rs
#	codex-rs/core/src/session/tests.rs
#	codex-rs/protocol/src/protocol.rs
2026-05-18 15:29:58 -07:00
Eric Traut
50435559f4 Merge branch 'etraut/next-turn-state-remove-user-input-with-context' into etraut/next-turn-state-input-op-consolidation 2026-05-18 15:28:14 -07:00
Eric Traut
5946878f8e Merge branch 'etraut/next-turn-state-user-input-context' into etraut/next-turn-state-remove-user-input-with-context
# 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-18 15:28:05 -07:00
Eric Traut
14284fe5a7 Rename input settings override terminology 2026-05-18 15:27:06 -07:00
Eric Traut
5015aa97bf Merge branch 'etraut/next-turn-state-core' into etraut/next-turn-state-app-server 2026-05-18 15:21:02 -07:00
Eric Traut
0f483dd5d4 Use queued turn context op in tests 2026-05-18 15:20:43 -07:00
pakrym-oai
f2368b7de6 [codex] Trim unused TurnContextItem fields (#22709)
## Why

`TurnContextItem` is the durable baseline used to reconstruct context
diffs across resume/fork. Most of the old persisted-only fields on it
are no longer read, so keeping them in rollout snapshots adds schema
surface and state that can drift without affecting reconstruction.

`summary` is the exception: older Codex versions require it to
deserialize `turn_context` records, so keep writing a default
compatibility value until that schema surface can be removed safely.

## What changed

- Removed the unused persisted fields from `TurnContextItem`: trace ids,
user/developer instructions, output schema, and truncation policy.
- Kept `summary` with a compatibility comment and made
`TurnContext::to_turn_context_item` write `ReasoningSummary::Auto`
instead of live turn state.
- Updated rollout/context reconstruction fixtures for the retained
summary field.

## Verification

- `cargo test -p codex-protocol --lib turn_context_item`
- `cargo test -p codex-rollout
resume_candidate_matches_cwd_reads_latest_turn_context`
- `cargo test -p codex-state turn_context`
- `cargo test -p codex-core --lib
new_default_turn_captures_current_span_trace_id`
- `cargo test -p codex-core --lib
record_initial_history_resumed_turn_context_after_compaction_reestablishes_reference_context_item`
- `cargo test -p codex-core --test all
emits_warning_when_resumed_model_differs`
- `git diff --check`
2026-05-18 21:54:36 +00:00