Commit Graph
13653 Commits
Author SHA1 Message Date
Michael Bolin 1b67eded62 merge commit for archive created by Sapling 2026-04-27 15:16:09 -07:00
Michael Bolin cfbde9db2d permissions: store thread sessions as profiles 2026-04-27 15:15:49 -07:00
Michael Bolin e209ae7a4f permissions: derive snapshot sandbox projections 2026-04-27 15:15:49 -07:00
Michael Bolin 4797158043 permissions: make SessionConfigured profile-only 2026-04-27 15:15:49 -07:00
Michael Bolin a6e3203326 permissions: require profiles in TUI thread state 2026-04-27 15:15:49 -07:00
Michael Bolin 5357a4aad8 permissions: derive config defaults as profiles 2026-04-27 15:15:49 -07:00
Michael Bolin da1cd3be74 Merge 996db1ced0 into sapling-pr-archive-bolinfest 2026-04-27 15:03:53 -07:00
Michael Bolin 996db1ced0 permissions: store thread sessions as profiles 2026-04-27 15:03:44 -07:00
Michael Bolin b28f2ae1c0 permissions: derive snapshot sandbox projections 2026-04-27 15:03:44 -07:00
Michael Bolin 0f66fbac84 permissions: make SessionConfigured profile-only 2026-04-27 15:03:44 -07:00
Michael Bolin 95aae38103 permissions: require profiles in TUI thread state 2026-04-27 15:03:44 -07:00
Michael Bolin 0b51e47a32 permissions: derive config defaults as profiles 2026-04-27 15:03:44 -07:00
Michael Bolin b7069e43a6 merge commit for archive created by Sapling 2026-04-27 14:46:38 -07:00
Michael Bolin 9d2eb00777 permissions: store thread sessions as profiles 2026-04-27 14:46:11 -07:00
Michael Bolin c2b1d352fb permissions: derive snapshot sandbox projections 2026-04-27 14:46:11 -07:00
Michael Bolin bbec1f19f7 permissions: make SessionConfigured profile-only 2026-04-27 14:46:11 -07:00
Michael Bolin 333c2c3d73 permissions: require profiles in TUI thread state 2026-04-27 14:46:11 -07:00
Michael Bolin db964e3533 permissions: derive config defaults as profiles 2026-04-27 14:46:11 -07:00
Michael Bolin d950f2c441 merge commit for archive created by Sapling 2026-04-27 14:39:23 -07:00
Michael Bolin 64679ec8a5 permissions: store thread sessions as profiles 2026-04-27 14:39:07 -07:00
Michael Bolin 7aed116fa5 permissions: derive snapshot sandbox projections 2026-04-27 14:39:07 -07:00
Michael Bolin 68fb758131 permissions: make SessionConfigured profile-only 2026-04-27 14:39:07 -07:00
Michael Bolin df27892772 permissions: require profiles in TUI thread state 2026-04-27 14:39:07 -07:00
Michael Bolin 87b6e80217 permissions: derive config defaults as profiles 2026-04-27 14:39:07 -07:00
Michael Bolin 26f06ba352 merge commit for archive created by Sapling 2026-04-27 14:05:31 -07:00
Michael Bolin 0eda02507b permissions: store thread sessions as profiles 2026-04-27 14:05:17 -07:00
Michael Bolin 5f890db19e permissions: derive snapshot sandbox projections 2026-04-27 14:05:17 -07:00
Michael Bolin 3f5620eb7d permissions: make SessionConfigured profile-only 2026-04-27 14:05:17 -07:00
Michael Bolin ef36313337 permissions: require profiles in TUI thread state 2026-04-27 14:05:17 -07:00
Michael Bolin bd9c490884 permissions: derive config defaults as profiles 2026-04-27 14:05:17 -07:00
Michael Bolin 604f179cfe merge commit for archive created by Sapling 2026-04-27 13:42:14 -07:00
Michael Bolin 6fa843e207 permissions: store thread sessions as profiles 2026-04-27 13:41:37 -07:00
Michael Bolin b77b4d5241 permissions: derive snapshot sandbox projections 2026-04-27 13:41:37 -07:00
Michael Bolin bb529f66ea permissions: make SessionConfigured profile-only 2026-04-27 13:41:37 -07:00
Michael Bolin 536ab2d0c8 permissions: require profiles in TUI thread state 2026-04-27 13:41:37 -07:00
Michael Bolin eec6237918 permissions: derive config defaults as profiles 2026-04-27 13:41:37 -07:00
Michael Bolin 4b55979755 permissions: remove cwd special path (#19841)
## Why

The experimental `PermissionProfile` API had both `:cwd` and
`:project_roots` special filesystem paths, which made the permission
root ambiguous. This PR removes the unstable `current_working_directory`
special path before the permissions API is stabilized, so callers use
`:project_roots` for symbolic project-root access.

## What changed

- Removes `FileSystemSpecialPath::CurrentWorkingDirectory` from protocol
and app-server protocol models, plus regenerated app-server
JSON/TypeScript schemas.
- Replaces internal `:cwd` permission entries with `:project_roots`
entries.
- Keeps the existing cwd-update behavior for legacy-shaped
workspace-write profiles, while removing the deleted
`CurrentWorkingDirectory` case from that compatibility path.
- Keeps `PermissionProfile::workspace_write()` as the reusable symbolic
workspace-write helper, with docs noting that `:project_roots` entries
resolve at enforcement time.
- Updates app-server docs/examples and approval UI labeling to stop
advertising `:cwd` as a permission token.

## Compatibility

Persisted rollout items may contain the old
`{"kind":"current_working_directory"}` tag from earlier experimental
`permissionProfile` snapshots. This PR keeps that tag as a
deserialize-only alias for `ProjectRoots { subpath: None }`, while
continuing to serialize only the new `project_roots` tag.

## Follow-up

This PR intentionally does not introduce an explicit project-root set on
`SessionConfiguration` or runtime sandbox resolution. Today, the
resolver still uses the active cwd as the single implicit project root.
A follow-up should model project roots separately from tool cwd so
`:project_roots` entries can resolve against the configured project
roots, and resolve to no entries when there are no project roots.

## Verification

- `cargo test -p codex-protocol permissions:: --lib`
- `cargo test -p codex-app-server-protocol`
- `cargo test -p codex-sandboxing -p codex-exec-server --lib`
- `cargo test -p codex-core session_configuration_apply_ --lib`
- `cargo test -p codex-app-server
command_exec_permission_profile_project_roots_use_command_cwd --test
all`
- `cargo test -p codex-tui
thread_read_session_state_does_not_reuse_primary_permission_profile
--lib`
- `cargo test -p codex-tui
preset_matching_accepts_workspace_write_with_extra_roots --lib`
- `cargo test -p codex-config --lib`
2026-04-27 13:41:27 -07:00
Eric Traut 52c06b8759 Preserve TUI markdown list spacing after code blocks (#19706)
## Why

Fixes #19702.

The TUI markdown renderer could visually attach the next list marker to
a fenced code block inside the previous list item, even when the source
markdown included a blank line before the next item. That made
block-heavy loose lists harder to read, while the desired behavior is
still to keep simple lists compact.

## What changed

- Track whether the current rendered list item contains a code block.
- Preserve one blank separator before the following list marker only
when the previous item contained a code block.
- Add regression coverage for both paths: code-block list items keep the
separator, and simple loose list items stay compact.

## Verification

- `cargo test -p codex-tui markdown_render`

I also manually verified that the bug exists before and is fixed after.

## Before
<img width="437" height="240" alt="Screenshot 2026-04-26 at 1 19 01 PM"
src="https://github.com/user-attachments/assets/3bc9d64d-2dba-40d9-9d6b-a1d0b3c0f728"
/>

## After
<img width="410" height="269" alt="Screenshot 2026-04-26 at 1 18 54 PM"
src="https://github.com/user-attachments/assets/19c15bee-da32-455e-a7cb-e05eb85f4ea0"
/>
2026-04-27 13:40:46 -07:00
Eric Traut 0bd25ab374 Delay approval prompts while typing (#19513)
## Why

Fixes #7744. Approval modals can currently appear while the user is
typing ahead in the TUI composer, which lets plain letters like `y` or
`a` get consumed as approval shortcuts instead of staying in the draft
input.

## What changed

- Track recent composer typing activity in `bottom_pane/mod.rs`.
- Delay new approval overlays for 1 second while the composer is active,
keeping delayed requests queued until the user is idle.
- Preserve the existing active-overlay behavior so approvals that arrive
while an approval modal is already open are still queued into that
overlay.
- Prune delayed approvals when app-server resolution says the request
has already been handled.

## Verification

Added unit coverage for immediate approvals, delayed approvals, idle
deadline reset, typed shortcut letters staying in the composer, shortcut
handling after the delay, and resolved delayed-request pruning.

Focused `codex-tui` test groups pass locally. The full `cargo test -p
codex-tui` run currently aborts in
`app::tests::attach_live_thread_for_selection_rejects_unmaterialized_fallback_threads`;
that same test also fails when run alone with the same stack overflow.

Manual reviewer check:

1. Start the TUI from the repo root:

   ```bash
   RUST_LOG=trace just codex \
     -c log_dir=<temp-log-dir> \
     --ask-for-approval untrusted \
     --sandbox workspace-write
   ```

2. Submit this prompt:

   ```text
   create a file text.txt on my desktop
   ```

3. While the agent is preparing the approval request, immediately type
text such as `ya this should stay in the composer`.
4. Confirm the typed-ahead `y`/`a` remains in the composer instead of
approving the request.
5. Stop typing for about 1 second; the approval modal should then
appear.
6. Once the modal is visible, press `y` and confirm the approval
shortcut works normally.
2026-04-27 13:20:55 -07:00
Michael Bolin ebbd616c4a merge commit for archive created by Sapling 2026-04-27 13:05:03 -07:00
Michael Bolin f7d5c241cd permissions: remove cwd special path 2026-04-27 13:04:16 -07:00
Eric Traut 850f035b8c Fix filtered thread-list resume regression in TUI (#19591)
## Why

`codex resume` regressed after
[#18502](https://github.com/openai/codex/pull/18502) changed the default
`thread/list` scan-and-repair path for metadata-filtered listings. The
TUI resume picker uses `thread/list` with source/provider/cwd filters
and `useStateDbOnly: false`, which is the intended
correctness-preserving mode: it should still consult the filesystem so
healthy, missing, or stale SQLite state can be repaired.

The regression was that #18502 made that filtered, filesystem-backed
path call `reconcile_rollout` for every filesystem hit, and then call it
again for each SQLite hit. When `reconcile_rollout` does not already
have extracted rollout items, it falls back to loading the full JSONL
rollout. That changed the resume picker’s first page from a cheap
rollout-head scan plus SQLite read-repair into full-file reads for large
sessions, so a few long threads could dominate TUI startup/resume
latency.

This change addresses the regression by keeping `useStateDbOnly: false`
on the correctness-preserving path while avoiding unnecessary full JSONL
reads for rows the filesystem scan has already validated.
Source/provider/cwd filters can be decided from rollout-head metadata,
so non-search resume listings only need the lightweight read-repair path
for filesystem hits. Full reconciliation is still used for DB-only
filtered rows because those can be stale false positives, and for search
listings because search can depend on title metadata that may require
scanning the full rollout.

This fixes #19483.

## What changed

- For non-search filtered listings, repair filesystem hits with the
lightweight `read_repair_rollout_path` path instead of full
`reconcile_rollout`.
- Track thread IDs proven by the filesystem scan and only fully
reconcile SQLite-filtered hits that the filesystem scan did not return,
preserving stale-DB false-positive cleanup without full-reading every
healthy rollout.
- Leave search listings on full reconciliation, since search depends on
full title metadata rather than only source/provider/cwd metadata from
the rollout head.

## Verification

- `cargo test -p codex-rollout list_threads`
- `cargo test -p codex-app-server thread_list`
2026-04-27 13:02:39 -07:00
Curtis 'Fjord' Hawthorne 277186ec85 Cap original-detail image token estimates (#19865)
Clamp original-detail image patch estimates to the current 10k patch
budget so large images cannot inflate local context accounting without
bound. Add regression coverage for an over-budget image.

Fixes openai/codex#19806.
2026-04-27 12:39:24 -07:00
rhan-oai 215d5a8f7c [codex-analytics] remove ga flag (#19863) 2026-04-27 19:29:19 +00:00
sayan-oai 85c1500569 fix: filter dynamic deferred tools from model_visible_specs (#19771)
fixes #19486

### Problem
Right now dynamic deferred tools are filtered at normal-turn prompt
building time, rather than upstream while building the `ToolRouter`
itself. This causes issues because dynamic deferred tools are then
wrongly included in the router's `model_visible_specs`, which is what
the compaction request-building flow relies on.

### Fix
Move the dynamic deferred tool filtering to `ToolRouter` creation time
to solve this problem for every request that relies on `ToolRouter` for
`model_visible_specs`, which solves the issue generically.

### Tests
Added unit + integration tests to ensure dynamic deferred tools are
omitted from `model_visible_specs` and compaction request respectively.

Tested against live `/compact` endpoint; raw deferred dynamic tools
without `tool_search` returned `400` (current bug), while the filtered
payload (this fix) returns `200`.
2026-04-27 19:09:02 +00:00
Michael Bolin 7f4a1dab2f merge commit for archive created by Sapling 2026-04-27 12:05:07 -07:00
Michael Bolin 6aaaea4736 permissions: remove cwd special path 2026-04-27 12:04:48 -07:00
pakrym-oai e5709db6dc Streamline account and command handlers (#19491)
## Why

Account login/logout and command exec handlers were doing local error
sends in the middle of each handler. That made these request flows
branch heavily even though most of the logic is validate, perform the
operation, and return the response.

## What Changed

- Converted ChatGPT/API-key login, login cancel, logout, rate-limit, and
add-credit handlers in
`codex-rs/app-server/src/codex_message_processor.rs` to compute `Result`
values and send them once at the request boundary.
- Applied the same shape to command exec start/write/resize/terminate
handlers.
- Kept side-effect notifications in the same places after successful
request handling.

## Verification

- `cargo check -p codex-app-server`
- `cargo test -p codex-app-server --test all v2::account --
--test-threads=1`
- `cargo test -p codex-app-server --test all v2::command_exec --
--test-threads=1`
2026-04-27 12:03:49 -07:00
Michael Bolin 4e569d6eec merge commit for archive created by Sapling 2026-04-27 11:48:41 -07:00
Michael Bolin 876bda90c7 permissions: remove cwd special path 2026-04-27 11:46:39 -07:00