Commit Graph

4556 Commits

Author SHA1 Message Date
Charles Cunningham
72d53a2c9b Add ephemeral turn context support
Introduce app-server ephemeralContext, render it as additional_context_for_this_turn fragments, and strip it correctly across contextual-user diffing and compaction flows.

Regenerate app-server schema fixtures and add coverage for model-visible layout, compaction, oversize validation, and resumed/forked context reconstruction.

Co-authored-by: Codex <noreply@openai.com>
2026-03-13 11:41:35 -07:00
Charles Cunningham
4bcfdafd01 Fix post-rebase test fallout
Co-authored-by: Codex <noreply@openai.com>
2026-03-13 11:30:45 -07:00
Charles Cunningham
fe982f5fb6 Gate additional-permission guidance on exec approvals only
Co-authored-by: Codex <noreply@openai.com>
2026-03-13 11:25:15 -07:00
Charles Cunningham
43fb746077 Restore image output dir helper after rebase
Co-authored-by: Codex <noreply@openai.com>
2026-03-13 11:10:17 -07:00
Charles Cunningham
34e707738f Update tests for split contextual-user fragments
Co-authored-by: Codex <noreply@openai.com>
2026-03-13 11:02:37 -07:00
Charles Cunningham
93e16c39cc Emit AGENTS reset when project docs disappear
Co-authored-by: Codex <noreply@openai.com>
2026-03-13 11:02:37 -07:00
Charles Cunningham
28bf5ab632 Fix core tests after context fragment split
Co-authored-by: Codex <noreply@openai.com>
2026-03-13 11:02:37 -07:00
Charles Cunningham
0961e40158 Backfill project doc instructions in tui tests
Co-authored-by: Codex <noreply@openai.com>
2026-03-13 11:02:11 -07:00
Charles Cunningham
c62ecd4e17 Emit collaboration updates for legacy baselines
Co-authored-by: Codex <noreply@openai.com>
2026-03-13 11:02:11 -07:00
Charles Cunningham
0a8e3f62d3 Backfill project doc instructions in state tests
Co-authored-by: Codex <noreply@openai.com>
2026-03-13 11:01:49 -07:00
Charles Cunningham
105c20a522 Split aggregated user instructions into contextual fragments
Co-authored-by: Codex <noreply@openai.com>
2026-03-13 11:01:49 -07:00
Charles Cunningham
73ee483833 Revert client test churn
Co-authored-by: Codex <noreply@openai.com>
2026-03-13 11:01:49 -07:00
Charles Cunningham
0be022063b Tighten model-visible context guide
Co-authored-by: Codex <noreply@openai.com>
2026-03-13 11:01:48 -07:00
Charles Cunningham
f29fa0abe0 Remove DeveloperInstructions alias
Co-authored-by: Codex <noreply@openai.com>
2026-03-13 11:01:48 -07:00
Charles Cunningham
38de034847 Drop lockfile drift
Co-authored-by: Codex <noreply@openai.com>
2026-03-13 11:01:30 -07:00
Charles Cunningham
24bc139c89 Refresh model-visible context docs
Co-authored-by: Codex <noreply@openai.com>
2026-03-13 11:01:30 -07:00
Charles Cunningham
56f5f6346a Relax AGENTS wrapper assertions in client tests
Co-authored-by: Codex <noreply@openai.com>
2026-03-13 11:01:30 -07:00
Charles Cunningham
217eeaee9c Disambiguate snapshot cwd placeholders
Co-authored-by: Codex <noreply@openai.com>
2026-03-13 11:01:30 -07:00
Charles Cunningham
85880b4495 Document model-visible fragment rules
Co-authored-by: Codex <noreply@openai.com>
2026-03-13 11:01:30 -07:00
Charles Cunningham
5edd095068 Standardize model-visible fragment registration
Co-authored-by: Codex <noreply@openai.com>
2026-03-13 11:01:30 -07:00
Charles Cunningham
54260252db Preserve custom realtime start instructions
Restore the configured experimental realtime start instructions when realtime activates, while keeping the default helper for the normal path.

Co-authored-by: Codex <noreply@openai.com>
2026-03-13 11:01:30 -07:00
Charles Cunningham
f17ae06ae3 Mention legacy exec permission flow in prompt guidance
Include with_additional_permissions guidance when either exec permission approvals or the request-permissions tool path is enabled, and add a permissions-message regression test for the legacy exec approvals flow.

Co-authored-by: Codex <noreply@openai.com>
2026-03-13 11:01:13 -07:00
Charles Cunningham
fc3caab095 Remove expect from contextual fragment wrapper
Replace the expect call in ContextualUserFragment::wrap_contextual_user_body with an explicit pattern match so the code stays compatible with the repo's clippy policy.

Co-authored-by: Codex <noreply@openai.com>
2026-03-13 11:01:13 -07:00
Charles Cunningham
877d86ac78 Fix post-rebase merge fallout
Clean up leftover conflict markers and restore the current sandbox-permissions helper calls after rebasing context fragment work onto origin/main.

Co-authored-by: Codex <noreply@openai.com>
2026-03-13 11:01:13 -07:00
Charles Cunningham
0e77d775e0 Simplify contextual fragment registry imports
Import the registered contextual-user fragment types at the top of model_visible_context.rs so the registry reads directly without repeated inline crate paths.

Co-authored-by: Codex <noreply@openai.com>
2026-03-13 11:01:13 -07:00
Charles Cunningham
fff5f28ce1 Unify contextual user fragment detection
Collapse the contextual-user detection APIs into a single ContextualUserFragment trait with default marker-based matching and wrapping. Update the fragment docs and registry naming to match the new blessed path, and fix the stale arc monitor test reference exposed by the refactor.

Co-authored-by: Codex <noreply@openai.com>
2026-03-13 11:01:13 -07:00
Charles Cunningham
4f554b902a Clarify contextual user fragment registry docs
Document the contextual user registry with the same level of guidance as the developer registry, including detection-only fragments versus turn-state diff fragments.

Co-authored-by: Codex <noreply@openai.com>
2026-03-13 11:01:12 -07:00
Charles Cunningham
6b40e2a99d Drop stray lockfile drift
Restore Cargo.lock to origin/main so this PR does not carry an unrelated dependency lockfile delta.

Co-authored-by: Codex <noreply@openai.com>
2026-03-13 11:01:12 -07:00
Charles Cunningham
9874d961ff Tighten context fragment PR diff
Restore extracted core test modules instead of carrying inline test churn in production files. This keeps the actual fragment changes intact while dropping unrelated restack noise.

Co-authored-by: Codex <noreply@openai.com>
2026-03-13 11:01:12 -07:00
Charles Cunningham
560d66b430 Drop arc monitor test churn from context fragment PR
Co-authored-by: Codex <noreply@openai.com>
2026-03-13 11:01:12 -07:00
Charles Cunningham
a000166a4d Drop permission policy changes from context fragment PR
Co-authored-by: Codex <noreply@openai.com>
2026-03-13 11:01:12 -07:00
Charles Cunningham
3954e00f53 Restack context fragment standardization
Reapply the standardized model-visible context fragment work on top of the latest origin/main as a clean squashed restack.

Co-authored-by: Codex <noreply@openai.com>
2026-03-13 11:01:12 -07:00
sayan-oai
9f2da5a9ce chore: clarify plugin + app copy in model instructions (#14541)
- clarify app mentions are in user messages
- clarify what it means for tools to be provided via `codex_apps` MCP
- add plugin descriptions (with basic sanitization) to top-level `##
Plugins` section alongside the corresponding plugin names
- explain that skills from plugins are prefixed with `plugin_name:` in
top-level `##Plugins` section

changes to more logically organize `Apps`, `Skills`, and `Plugins`
instructions will be in a separate PR, as that shuffles dev + user
instructions in ways that change tests broadly.

### Tests
confirmed in local rollout, some new tests.
2026-03-13 10:57:41 -07:00
Jack Mousseau
59b588b8ec Improve granular approval policy prompt (#14553) 2026-03-13 10:42:17 -07:00
Won Park
958f93f899 sending back imagaegencall response back to responseapi (#14558)
Sending back the ResponseItem::ImageGenerationCall as is, because it is
now supported from the API-side.
2026-03-13 17:29:19 +00:00
iceweasel-oai
6b3d82daca Use a private desktop for Windows sandbox instead of Winsta0\Default (#14400)
## Summary
- launch Windows sandboxed children on a private desktop instead of
`Winsta0\Default`
- make private desktop the default while keeping
`windows.sandbox_private_desktop=false` as the escape hatch
- centralize process launch through the shared
`create_process_as_user(...)` path
- scope the private desktop ACL to the launching logon SID

## Why
Today sandboxed Windows commands run on the visible shared desktop. That
leaves an avoidable same-desktop attack surface for window interaction,
spoofing, and related UI/input issues. This change moves sandboxed
commands onto a dedicated per-launch desktop by default so the sandbox
no longer shares `Winsta0\Default` with the user session.

The implementation stays conservative on security with no silent
fallback back to `Winsta0\Default`

If private-desktop setup fails on a machine, users can still opt out
explicitly with `windows.sandbox_private_desktop=false`.

## Validation
- `cargo build -p codex-cli`
- elevated-path `codex exec` desktop-name probe returned
`CodexSandboxDesktop-*`
- elevated-path `codex exec` smoke sweep for shell commands, nested
`pwsh`, jobs, and hidden `notepad` launch
- unelevated-path full private-desktop compatibility sweep via `codex
exec` with `-c windows.sandbox=unelevated`
2026-03-13 10:13:39 -07:00
pakrym-oai
9c9867c9fa code mode: single line tool declarations (#14526)
## Summary
- render code mode tool declarations as single-line TypeScript snippets
- make the JSON schema renderer emit inline object shapes for these
declarations
- update code mode/spec expectations to match the new inline rendering

## Testing
- `just fmt`
- `cargo test -p codex-core render_json_schema_to_typescript`
- `cargo test -p codex-core code_mode_augments_`
- `cargo test -p codex-core --test all exports_all_tools_metadata --
--nocapture`
2026-03-13 10:08:34 -07:00
pakrym-oai
8e89e9eded Split multi-agent handler into dedicated files (#14603)
## Summary
- move the multi-agent handlers suite into its own files for spawn,
wait, resume, send input, and close logic
- keep the aggregated module in place while delegating each handler to
its new file to keep things organized per handler

## Testing
- Not run (not requested)
2026-03-13 09:11:03 -07:00
Ahmed Ibrahim
c7e847aaeb Add diagnostics for read_only_unless_trusted timeout flake (#14518)
## Summary
- add targeted diagnostic logging for the
read_only_unless_trusted_requires_approval scenarios in
approval_matrix_covers_all_modes
- add a scoped timeout buffer only for ro_unless_trusted write-file
scenarios: 1000ms -> 2000ms
- keep all other write-file scenarios at 1000ms

## Why
The last two main failures were both in codex-core::all
suite::approvals::approval_matrix_covers_all_modes with exit_code=124 in
the same scenario. This points to execution-time jitter in CI rather
than a semantic approval-policy mismatch.

## Notes
- This does not introduce any >5s timeout and does not
disable/quarantine tests.
- The timeout increase is tightly scoped to the single flaky path and
keeps the matrix deterministic under CI scheduling variance.
2026-03-12 23:51:03 -07:00
Ahmed Ibrahim
2253a9d1d7 Add realtime transcription mode for websocket sessions (#14556)
- add experimental_realtime_ws_mode (conversational/transcription) and
plumb it into realtime conversation session config
- switch realtime websocket intent and session.update payload shape
based on mode
- update config schema and realtime/config tests

---------

Co-authored-by: Codex <noreply@openai.com>
2026-03-12 23:50:30 -07:00
Ahmed Ibrahim
eaf81d3f6f Add codex tool support for realtime v2 handoff (#14554)
- Advertise a `codex` function tool in realtime v2 session updates.
- Emit handoff replies as `function_call_output` items while keeping v1
behavior unchanged.
- Split realtime event parsing into explicit v1/v2 modules with shared
common helpers.

---------

Co-authored-by: Codex <noreply@openai.com>
2026-03-12 23:30:02 -07:00
Celia Chen
0c60eea4a5 feat: support skill-scoped managed network domain overrides in skill config (#14522)
## Summary

This lets skill loading split `permissions.network` into two distinct
pieces:

- `permissions.network.enabled` still feeds the skill
`PermissionProfile` and remains the coarse gate for whether the skill
can use network access at all.
- `permissions.network.allowed_domains` and
`permissions.network.denied_domains` are lifted into a new
`SkillManagedNetworkOverride` so managed-network sessions can start
per-skill scoped proxies with the right domain overrides.

The change also updates `SkillMetadata` construction sites and adds
loader tests covering YAML parsing plus normalization of the network
gate vs. domain override fields.

## Follow-up
A PR that uses the network_override to spin up a skill-specific proxy if
network_override is not none.
2026-03-13 04:45:14 +00:00
Jack Mousseau
7c7e267501 Simplify permissions available in request permissions tool (#14529) 2026-03-12 21:13:17 -07:00
Ahmed Ibrahim
3e8f47169e Add realtime v2 event parser behind feature flag (#14537)
- Add a feature-flagged realtime v2 parser on the existing
websocket/session pipeline.
- Wire parser selection from core feature flags and map the codex
handoff tool-call path into existing handoff events.

---------

Co-authored-by: Codex <noreply@openai.com>
2026-03-12 21:12:40 -07:00
alexsong-oai
650beb177e Refactor cloud requirements error and surface in JSON-RPC error (#14504)
Refactors cloud requirements error handling to carry structured error
metadata and surfaces that metadata through JSON-RPC config-load
failures, including:
* adds typed CloudRequirementsLoadErrorCode values plus optional
statusCode
* marks thread/start, thread/resume, and thread/fork config failures
with structured cloud-requirements error data
2026-03-13 03:30:51 +00:00
Channing Conger
0daffe667a code_mode: Move exec params from runtime declarations to @pragma (#14511)
This change moves code_mode exec session settings out of the runtime API
and into an optional first-line pragma, so instead of calling runtime
helpers like set_yield_time() or set_max_output_tokens_per_exec_call(),
the model can write // @exec: {"yield_time_ms": ...,
"max_output_tokens": ...} at the top of the freeform exec source. Rust
now parses that pragma before building the source, validates it, and
passes the values directly in the exec start message to the code-mode
broker, which applies them at session start without any worker-runtime
mutation path. The @openai/code_mode module no longer exposes those
setter functions, the docs and grammar were updated to describe the
pragma form, and the existing code_mode tests were converted to use
pragma-based configuration instead.
2026-03-13 03:27:42 +00:00
alexsong-oai
1a363d5fcf Add plugin usage telemetry (#14531)
adding metrics including: 
* plugin used
* plugin installed/uninstalled
* plugin enabled/disabled
2026-03-12 19:22:30 -07:00
viyatb-oai
f194d4b115 fix: reopen writable linux carveouts under denied parents (#14514)
## Summary
- preserve Linux bubblewrap semantics for `write -> none -> write`
filesystem policies by recreating masked mount targets before rebinding
narrower writable descendants
- add a Linux runtime regression for `/repo = write`, `/repo/a = none`,
`/repo/a/b = write` so the nested writable child is exercised under
bubblewrap
- document the supported legacy Landlock fallback and the split-policy
bubblewrap behavior for overlapping carveouts

## Example
Given a split filesystem policy like:

```toml
"/repo" = "write"
"/repo/a" = "none"
"/repo/a/b" = "write"
```

this PR keeps `/repo` writable, masks `/repo/a`, and still reopens
`/repo/a/b` as writable again under bubblewrap.

## Testing
- `just fmt`
- `cargo test -p codex-linux-sandbox`
- `cargo clippy -p codex-linux-sandbox --tests -- -D warnings`
2026-03-13 01:36:06 +00:00
pakrym-oai
7626f61274 Add typed multi-agent tool outputs (#14536)
## Summary
- return typed `ToolOutput` values from the multi-agent handlers instead
of plain `FunctionToolOutput`
- keep the regular function-call response shape as JSON text while
exposing structured values to code mode
- add output schemas for `spawn_agent`, `send_input`, `resume_agent`,
`wait`, and `close_agent`

## Verification
- `just fmt`
- focused multi-agent and integration tests passed earlier in this
branch during iteration
- after the final edit, I only reran formatting before opening this PR
2026-03-13 01:10:10 +00:00
Josh McKinney
6912da84a8 client: extend custom CA handling across HTTPS and websocket clients (#14239)
## Stacked PRs

This work is now effectively split across two steps:

- #14178: add custom CA support for browser and device-code login flows,
docs, and hermetic subprocess tests
- #14239: extend that shared custom CA handling across Codex HTTPS
clients and secure websocket TLS

Note: #14240 was merged into this branch while it was stacked on top of
this PR. This PR now subsumes that websocket follow-up and should be
treated as the combined change.

Builds on top of #14178.

## Problem

Custom CA support landed first in the login path, but the real
requirement is broader. Codex constructs outbound TLS clients in
multiple places, and both HTTPS and secure websocket paths can fail
behind enterprise TLS interception if they do not honor
`CODEX_CA_CERTIFICATE` or `SSL_CERT_FILE` consistently.

This PR broadens the shared custom-CA logic beyond login and applies the
same policy to websocket TLS, so the enterprise-proxy story is no longer
split between “HTTPS works” and “websockets still fail”.

## What This Delivers

Custom CA support is no longer limited to login. Codex outbound HTTPS
clients and secure websocket connections can now honor the same
`CODEX_CA_CERTIFICATE` / `SSL_CERT_FILE` configuration, so enterprise
proxy/intercept setups work more consistently end-to-end.

For users and operators, nothing new needs to be configured beyond the
same CA env vars introduced in #14178. The change is that more of Codex
now respects them, including websocket-backed flows that were previously
still using default trust roots.

I also manually validated the proxy path locally with mitmproxy using:
`CODEX_CA_CERTIFICATE=~/.mitmproxy/mitmproxy-ca-cert.pem
HTTPS_PROXY=http://127.0.0.1:8080 just codex`
with mitmproxy installed via `brew install mitmproxy` and configured as
the macOS system proxy.

## Mental model

`codex-client` is now the owner of shared custom-CA policy for outbound
TLS client construction. Reqwest callers start from the builder
configuration they already need, then pass that builder through
`build_reqwest_client_with_custom_ca(...)`. Websocket callers ask the
same module for a rustls client config when a custom CA bundle is
configured.

The env precedence is the same everywhere:
- `CODEX_CA_CERTIFICATE` wins
- otherwise fall back to `SSL_CERT_FILE`
- otherwise use system roots

The helper is intentionally narrow. It loads every usable certificate
from the configured PEM bundle into the appropriate root store and
returns either a configured transport or a typed error that explains
what went wrong.

## Non-goals

This does not add handshake-level integration tests against a live TLS
endpoint. It does not validate that the configured bundle forms a
meaningful certificate chain. It also does not try to force every
transport in the repo through one abstraction; it extends the shared CA
policy across the reqwest and websocket paths that actually needed it.

## Tradeoffs

The main tradeoff is centralizing CA behavior in `codex-client` while
still leaving adoption up to call sites. That keeps the implementation
additive and reviewable, but it means the rule "outbound Codex TLS that
should honor enterprise roots must use the shared helper" is still
partly enforced socially rather than by types.

For websockets, the shared helper only builds an explicit rustls config
when a custom CA bundle is configured. When no override env var is set,
websocket callers still use their ordinary default connector path.

## Architecture

`codex-client::custom_ca` now owns CA bundle selection, PEM
normalization, mixed-section parsing, certificate extraction, typed
CA-loading errors, and optional rustls client-config construction for
websocket TLS.

The affected consumers now call into that shared helper directly rather
than carrying login-local CA behavior:
- backend-client
- cloud-tasks
- RMCP client paths that use `reqwest`
- TUI voice HTTP paths
- `codex-core` default reqwest client construction
- `codex-api` websocket clients for both responses and realtime
websocket connections

The subprocess CA probe, env-sensitive integration tests, and shared PEM
fixtures also live in `codex-client`, which is now the actual owner of
the behavior they exercise.

## Observability

The shared CA path logs:
- which environment variable selected the bundle
- which path was loaded
- how many certificates were accepted
- when `TRUSTED CERTIFICATE` labels were normalized
- when CRLs were ignored
- where client construction failed

Returned errors remain user-facing and include the relevant env var,
path, and remediation hint. That same error model now applies whether
the failure surfaced while building a reqwest client or websocket TLS
configuration.

## Tests

Pure unit tests in `codex-client` cover env precedence and PEM
normalization behavior. Real client construction remains in subprocess
tests so the suite can control process env and avoid the macOS seatbelt
panic path that motivated the hermetic test split.

The subprocess coverage verifies:
- `CODEX_CA_CERTIFICATE` precedence over `SSL_CERT_FILE`
- fallback to `SSL_CERT_FILE`
- single-cert and multi-cert bundles
- malformed and empty-file errors
- OpenSSL `TRUSTED CERTIFICATE` handling
- CRL tolerance for well-formed CRL sections

The websocket side is covered by the existing `codex-api` / `codex-core`
websocket test suites plus the manual mitmproxy validation above.

---------

Co-authored-by: Ivan Zakharchanka <3axap4eHko@gmail.com>
Co-authored-by: Codex <noreply@openai.com>
2026-03-13 00:59:26 +00:00