Commit Graph

13956 Commits

Author SHA1 Message Date
Michael Bolin
68711d079f Merge deea4c5d91 into sapling-pr-archive-bolinfest 2026-04-28 11:25:09 -07:00
Michael Bolin
deea4c5d91 core tests: migrate hook turns to profiles 2026-04-28 11:24:40 -07:00
Michael Bolin
8ca63b2584 core tests: migrate apply patch turns to profiles 2026-04-28 11:24:40 -07:00
Michael Bolin
a4e38414fd core tests: migrate rmcp turns to profiles 2026-04-28 11:24:40 -07:00
Michael Bolin
d0d44e1980 core tests: migrate compact turns to profiles 2026-04-28 11:24:40 -07:00
Michael Bolin
2b49557202 core tests: migrate zsh-fork permissions to profiles 2026-04-28 11:24:40 -07:00
Michael Bolin
5a30ba5944 core tests: migrate request permissions tool turns to profiles 2026-04-28 11:24:40 -07:00
Michael Bolin
858792b8a6 core tests: migrate prompt caching turns to profiles 2026-04-28 11:24:40 -07:00
Michael Bolin
894acd7916 core tests: migrate exec policy turns to profiles 2026-04-28 11:24:40 -07:00
Michael Bolin
d08a6fcb3d core tests: migrate permissions message tests to profiles 2026-04-28 11:24:40 -07:00
Michael Bolin
c118ae3774 core tests: migrate tools tests to permission profiles 2026-04-28 11:24:40 -07:00
Michael Bolin
075cc47dbc core tests: migrate plan item turns to profiles 2026-04-28 11:24:40 -07:00
Michael Bolin
7487c90ec0 core tests: migrate safety check turns to profiles 2026-04-28 11:24:40 -07:00
Michael Bolin
0361f3b36d core tests: migrate view image turns to profiles 2026-04-28 11:24:40 -07:00
Michael Bolin
03cfed4866 core tests: migrate model/personality turns to profiles 2026-04-28 11:24:40 -07:00
Michael Bolin
a0fde92b48 core tests: send model turns with permission profiles 2026-04-28 11:24:40 -07:00
Michael Bolin
46ecb96e2d core tests: configure profiles directly 2026-04-28 11:24:40 -07:00
Michael Bolin
841c720fea core tests: migrate more turns to permission profiles 2026-04-28 11:24:40 -07:00
Michael Bolin
868b85bac6 core tests: build user turns from permission profiles 2026-04-28 11:24:40 -07:00
Michael Bolin
74da55d952 core tests: submit turns with permission profiles 2026-04-28 11:24:40 -07:00
Michael Bolin
2c32c5fa60 tui: use permission profiles for sandbox state 2026-04-28 11:24:40 -07:00
canvrno-oai
640a1b23ea Fix plan mode nudge test after task completion signature change (#20045)
Updates the plan mode nudge test to pass the new `duration_ms` argument
to task completion.

Co-authored-by: Codex <noreply@openai.com>
2026-04-28 11:24:22 -07:00
Michael Bolin
9e26613657 permissions: add built-in default profiles (#19900)
## Why

The migration away from `SandboxPolicy` needs new configs to start from
permissions profiles instead of deriving profiles from legacy sandbox
modes. Existing users can have empty `config.toml` files, and we should
not rewrite user-owned config files that may live in shared
repositories.

This PR introduces built-in profile names so an empty config can resolve
to a canonical `PermissionProfile`, while explicit named `[permissions]`
profiles still behave predictably.

## What changed

- Adds built-in `default_permissions` profile names:
  - `:read-only` maps to `PermissionProfile::read_only()`.
- `:workspace` maps to the workspace-write profile, including
project-root metadata carveouts.
- `:danger-no-sandbox` maps to `PermissionProfile::Disabled`, preserving
the distinction between no sandbox and a broad managed sandbox.
- Reserves the `:` prefix for built-in profiles so user-defined
`[permissions]` profiles cannot collide with future built-ins.
- Allows `default_permissions` to reference a built-in profile without
requiring a `[permissions]` table.
- Makes an otherwise empty config choose a built-in profile by
trust/platform context: trusted or untrusted project roots use
`:workspace` when the platform supports that sandbox, while roots
without a trust decision use `:read-only`.
- Keeps legacy `sandbox_mode` configs on the legacy path, and still
rejects user-defined `[permissions]` profiles that omit
`default_permissions` so we do not silently guess among custom profiles.
- Preserves compatibility behavior for implicit defaults: bare
`network.enabled = true` allows runtime network without starting the
managed proxy, explicit profile proxy policy still starts the proxy, and
implicit workspace/add-dir roots keep legacy metadata carveouts.

## Verification

- `cargo test -p codex-core builtin --lib`
- `cargo test -p codex-core profile_network_proxy_config`
- `cargo test -p codex-core
implicit_builtin_workspace_profile_preserves_add_dir_metadata_carveouts`
- `cargo test -p codex-core
permissions_profiles_network_enabled_allows_runtime_network_without_proxy`
- `cargo test -p codex-core
permissions_profiles_proxy_policy_starts_managed_network_proxy`

## Documentation

Public Codex config docs should mention these built-in names when the
`[permissions]` config format is ready to document as stable.









---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/19900).
* #20041
* #20040
* #20037
* #20035
* #20034
* #20033
* #20032
* #20030
* #20028
* #20027
* #20026
* #20024
* #20021
* #20018
* #20016
* #20015
* #20013
* #20011
* #20010
* #20008
* __->__ #19900
2026-04-28 11:21:39 -07:00
viyatb-oai
3afb185a4f fix(network-proxy): tighten network proxy bypass defaults (#20002)
## Why
Managed sessions use `NO_PROXY` to keep a small set of destinations on
the direct path by default. The old default also bypassed all IPv4
link-local addresses in `169.254.0.0/16`, which includes metadata
endpoints such as `169.254.169.254`. Because `NO_PROXY` is evaluated by
the client before the request reaches the managed proxy, requests to
that range could skip proxy-side allowlist and local-binding checks
entirely. On hosts where a link-local metadata service is reachable,
that creates a path to sensitive environment metadata or credentials
outside the intended enforcement point.

## What changed
- remove the default IPv4 link-local `169.254.0.0/16` bypass from the
managed proxy environment
- keep the existing loopback and private-network defaults unchanged
- update the regression assertion to lock in the narrower default

## Security impact
Link-local requests now stay on the managed-proxy path by default, so
the proxy can apply configured policy before they reach metadata-style
endpoints or other link-local services.

## Verification
- `cargo test -p codex-network-proxy`

Co-authored-by: Codex <noreply@openai.com>
2026-04-28 10:51:43 -07:00
stefanstokic-oai
4c68bd728f External agent session support (#19895)
## Summary

This extends external agent detection/import beyond config artifacts so
Codex can detect recent sessions files from the external agent home and
import them into Codex rollout history.

## What changed

- Added a focused `external_agent_sessions` module for:
  - session discovery
  - source-record parsing
  - rollout construction
  - import ledger tracking
- Wired session detection/import into the app-server external agent
config API.
- Added compaction handling so large imported sessions can be resumed
safely before the first follow-up turn.

## Testing

Added coverage for:
- recent-session detection
- custom-title handling
- recency filtering
- dedupe and re-detect-after-source-change behavior
- visible imported turn construction
- backward-compatible import payload deserialization
- end-to-end RPC import flow
- rejection of undetected session paths
- repeat-import behavior
- large-session compaction before first follow-up

Ran:
- `cargo test -p codex-app-server external_agent_config_import_ --test
all`
2026-04-28 17:42:36 +00:00
Felipe Coury
a036584104 fix(tui): let esc exit empty shell mode (#19986)
## Summary

- exit shell mode when `Esc` is pressed while the absorbed `!` is the
only input
- add direct regression coverage plus a composer snapshot for the
restored normal prompt state

## Root cause

Shell mode stores the leading `!` outside the editable textarea. After
typing only `!`, the textarea is empty but the composer is still in bash
mode, so the existing empty-composer `Esc` handling never runs.

## Validation

- `just fmt`
- `cargo test -p codex-tui
bottom_pane::chat_composer::tests::esc_exits_empty_shell_mode`
- `cargo test -p codex-tui
bottom_pane::chat_composer::tests::footer_mode_snapshots`
- `cargo insta pending-snapshots`

`cargo test -p codex-tui` still reports unrelated existing `/status`
snapshot drift in this local environment because the rendered
permissions text is `workspace-write with network access` instead of the
older `read-only` fixture text.
2026-04-28 14:35:24 -03:00
Michael Bolin
fe5bf89abc Merge 56ffe41e00 into sapling-pr-archive-bolinfest 2026-04-28 10:35:21 -07:00
canvrno-oai
bc5a1b961e Move local /resume cwd filtering into thread/list (#19931)
Move local resume and fork cwd filtering to `thread/list` instead of
filtering in the TUI. This makes the `/resume` menu feel slightly faster
to load when working in repos with many historical threads, and
centralizes the cwd filtering in app-server.

**Affected:**
- /resume from inside the TUI.
- codex resume with no session ID and without --last
- codex resume --all
- codex fork with no session ID and without --last
- codex fork --all

**Not affected:**
- codex resume <id>
- codex fork <id>
- codex resume --last
- codex fork --last

Steps to test performance improvement in a real Codex environment:
- Launch `codex resume` using compiled binary in a directory that has
seen many threads.
- Launch `codex resume` using release binary in same directory.
- Observe difference in time-to-full-page as threads load.
2026-04-28 10:35:10 -07:00
Michael Bolin
56ffe41e00 core tests: migrate hook turns to profiles 2026-04-28 10:35:10 -07:00
Felipe Coury
c6bcd27832 feat(tui): suggest plan mode from composer drafts (#19901)
## Summary

- suggest Plan mode when the current composer draft contains the
standalone word `plan`
- shares the Codex App heuristics for detection
- excludes things line `/plan` and the word plan in shell mode
- reuse the existing `Shift+Tab` mode cycle and add thread-scoped
dismissal with `Esc`
- replace the normal footer hint while the reminder is visible so the
statusline stays anchored


https://github.com/user-attachments/assets/01123ae8-cee6-4e95-b563-44655c071cde

## Why

The desktop app already nudges users toward Plan mode when their draft
clearly signals planning intent. The TUI had the underlying `/plan` and
`Shift+Tab` flows, but no equivalent reminder at the moment the user was
most likely to benefit from them.

## Details

The reminder is shown only when Plan mode is available, the draft
contains standalone `plan`, the user is not already in Plan mode, the
composer is actionable, and the current thread has not dismissed the
reminder. Slash-command and shell-command drafts are excluded.

The first implementation used an extra composer row, but that moved the
statusline whenever the heuristic fired. This version keeps the layout
stable by rendering the reminder in the existing footer row instead.

## Validation

- `INSTA_UPDATE=always cargo test -p codex-tui
chatwidget::tests::plan_mode::plan_mode_nudge -- --nocapture`
- `just fmt`
- `just fix -p codex-tui`
- `./tools/argument-comment-lint/run.py -p codex-tui`
- `cargo insta pending-snapshots`
- `git diff --check`
2026-04-28 14:34:10 -03:00
Michael Bolin
b30bb955cf Merge d6e5ae9981 into sapling-pr-archive-bolinfest 2026-04-28 10:33:06 -07:00
Michael Bolin
d6e5ae9981 core tests: migrate apply patch turns to profiles 2026-04-28 10:32:55 -07:00
Michael Bolin
c6059382fe Merge c30257d56c into sapling-pr-archive-bolinfest 2026-04-28 10:29:27 -07:00
Michael Bolin
c30257d56c core tests: migrate rmcp turns to profiles 2026-04-28 10:29:15 -07:00
Michael Bolin
cdecd5a325 Merge 21f7501abf into sapling-pr-archive-bolinfest 2026-04-28 10:26:36 -07:00
Michael Bolin
21f7501abf core tests: migrate compact turns to profiles 2026-04-28 10:26:26 -07:00
maja-openai
273c2e21a9 Clarify network approval auto-review prompts (#19907)
## Why

Network access approval prompts were showing the generic retry reason,
which made auto-review focus on the blocked connection instead of the
command that caused it. This makes network approvals easier to assess by
telling the reviewer to evaluate whether the triggering command was
authorised by the user and within policy, and to treat the network call
as acceptable when it is a reasonable consequence of that command.

## What changed

- Split guardian approval request prompt rendering so `NetworkAccess`
has a dedicated branch.
- For network requests, show `Network approval context` and `Network
access JSON` instead of `Retry reason` / `Planned action JSON`.
- Added regression coverage for the network approval prompt wording and
for omitting retry reason in this case.

## Verification

- `cargo test -p codex-core
guardian::tests::build_guardian_prompt_items_explains_network_access_review_scope`
2026-04-28 10:25:37 -07:00
Michael Bolin
5d42ea1837 Merge 38caa7d8c1 into sapling-pr-archive-bolinfest 2026-04-28 10:23:53 -07:00
Michael Bolin
38caa7d8c1 core tests: migrate zsh-fork permissions to profiles 2026-04-28 10:23:39 -07:00
Michael Bolin
7342edf379 merge commit for archive created by Sapling 2026-04-28 10:21:20 -07:00
Michael Bolin
b85a6b6f17 core tests: migrate request permissions tool turns to profiles 2026-04-28 10:21:03 -07:00
Michael Bolin
6b7b40d51d core tests: migrate prompt caching turns to profiles 2026-04-28 10:21:03 -07:00
Michael Bolin
07c9577355 core tests: migrate exec policy turns to profiles 2026-04-28 10:21:03 -07:00
Michael Bolin
90067c1167 core tests: migrate permissions message tests to profiles 2026-04-28 10:21:03 -07:00
Michael Bolin
85e6d3e615 core tests: migrate tools tests to permission profiles 2026-04-28 10:21:03 -07:00
Michael Bolin
ace786c7a8 core tests: migrate plan item turns to profiles 2026-04-28 10:21:03 -07:00
Michael Bolin
11be2a3a96 core tests: migrate safety check turns to profiles 2026-04-28 10:21:03 -07:00
Michael Bolin
6cee4c433b core tests: migrate view image turns to profiles 2026-04-28 10:21:03 -07:00
Michael Bolin
5b25b27207 core tests: migrate model/personality turns to profiles 2026-04-28 10:21:03 -07:00
Michael Bolin
1803bb3583 core tests: send model turns with permission profiles 2026-04-28 10:21:03 -07:00