Commit Graph

6019 Commits

Author SHA1 Message Date
Michael Bolin
dafc0124ff merge commit for archive created by Sapling 2025-12-23 21:55:08 -08:00
Michael Bolin
ec91a296ee feat: support local development using Buck2 2025-12-23 21:55:02 -08:00
Michael Bolin
421cfd6555 merge commit for archive created by Sapling 2025-12-23 21:29:19 -08:00
Michael Bolin
295b53165b feat: support local development using Buck2 2025-12-23 21:29:13 -08:00
Michael Bolin
b984010361 merge commit for archive created by Sapling 2025-12-23 21:28:40 -08:00
Michael Bolin
a142df397f feat: support local development using Buck2 2025-12-23 21:28:33 -08:00
Michael Bolin
2c7957327e merge commit for archive created by Sapling 2025-12-23 20:41:28 -08:00
Michael Bolin
5a4ed55ff1 feat: support local development using Buck2 2025-12-23 20:41:23 -08:00
Michael Bolin
c59f005ac1 merge commit for archive created by Sapling 2025-12-23 20:29:03 -08:00
Michael Bolin
6beca893ed feat: support local development using Buck2 2025-12-23 20:28:56 -08:00
Michael Bolin
0b21dc24be merge commit for archive created by Sapling 2025-12-23 20:17:32 -08:00
Michael Bolin
b66eb68ea2 feat: support local development using Buck2 2025-12-23 20:17:26 -08:00
Michael Bolin
defd880806 merge commit for archive created by Sapling 2025-12-23 19:44:58 -08:00
Michael Bolin
d2aa6f33d7 feat: support local development using Buck2 2025-12-23 19:44:52 -08:00
Michael Bolin
8baed57218 merge commit for archive created by Sapling 2025-12-23 19:43:30 -08:00
Michael Bolin
25d28ed9fa feat: support local development using Buck2 2025-12-23 19:43:24 -08:00
Michael Bolin
659e8b0cb9 Merge e9ffd4da86 into sapling-pr-archive-bolinfest 2025-12-23 19:40:58 -08:00
Michael Bolin
e9ffd4da86 feat: support local development using Buck2 2025-12-23 19:40:51 -08:00
Michael Bolin
38de0a1de4 fix: declare test path relative to $CARGO_MANIFEST_DIR (#8498)
This is another fix to prepare for Buck2. See #8496 for related changes.

---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/8498).
* __->__ #8498
* #8496
2025-12-23 19:29:48 -08:00
Michael Bolin
e61bae12e3 feat: introduce codex-utils-cargo-bin as an alternative to assert_cmd::Command (#8496)
This PR introduces a `codex-utils-cargo-bin` utility crate that
wraps/replaces our use of `assert_cmd::Command` and
`escargot::CargoBuild`.

As you can infer from the introduction of `buck_project_root()` in this
PR, I am attempting to make it possible to build Codex under
[Buck2](https://buck2.build) as well as `cargo`. With Buck2, I hope to
achieve faster incremental local builds (largely due to Buck2's
[dice](https://buck2.build/docs/insights_and_knowledge/modern_dice/)
build strategy, as well as benefits from its local build daemon) as well
as faster CI builds if we invest in remote execution and caching.

See
https://buck2.build/docs/getting_started/what_is_buck2/#why-use-buck2-key-advantages
for more details about the performance advantages of Buck2.

Buck2 enforces stronger requirements in terms of build and test
isolation. It discourages assumptions about absolute paths (which is key
to enabling remote execution). Because the `CARGO_BIN_EXE_*` environment
variables that Cargo provides are absolute paths (which
`assert_cmd::Command` reads), this is a problem for Buck2, which is why
we need this `codex-utils-cargo-bin` utility.

My WIP-Buck2 setup sets the `CARGO_BIN_EXE_*` environment variables
passed to a `rust_test()` build rule as relative paths.
`codex-utils-cargo-bin` will resolve these values to absolute paths,
when necessary.


---
[//]: # (BEGIN SAPLING FOOTER)
Stack created with [Sapling](https://sapling-scm.com). Best reviewed
with [ReviewStack](https://reviewstack.dev/openai/codex/pull/8496).
* #8498
* __->__ #8496
2025-12-23 19:29:32 -08:00
Josh McKinney
96a65ff0ed perf(tui): cap redraw scheduling to 60fps (#8499)
Clamp frame draw notifications in the `FrameRequester` scheduler so we
don't redraw more frequently than a user can perceive.

This applies to both `codex-tui` and `codex-tui2`, and keeps the
draw/dispatch loops simple by centralizing the rate limiting in a small
helper module.

- Add `FrameRateLimiter` (pure, unit-tested) to clamp draw deadlines
- Apply the limiter in the scheduler before emitting `TuiEvent::Draw`
- Use immediate redraw requests for scroll paths (scheduler now
coalesces + clamps)
- Add scheduler tests covering immediate/delayed interactions
2025-12-23 19:10:15 -08:00
Michael Bolin
af3b8e7761 merge commit for archive created by Sapling 2025-12-23 19:04:50 -08:00
Michael Bolin
97e8a1bd29 fix: clean up tests so they pass under Buck2 2025-12-23 18:56:34 -08:00
Michael Bolin
46d432e484 feat: introduce codex-utils-cargo-bin as an alternative to assert_cmd::Command 2025-12-23 18:56:34 -08:00
Michael Bolin
ee9c29cae9 Merge 81e40c8162 into sapling-pr-archive-bolinfest 2025-12-23 17:56:33 -08:00
Michael Bolin
81e40c8162 fix: clean up tests so they pass under Buck2 2025-12-23 17:56:15 -08:00
Michael Bolin
4911fd93e7 merge commit for archive created by Sapling 2025-12-23 17:32:56 -08:00
Michael Bolin
fd72889794 feat: introduce codex-utils-cargo-bin as an alternative to assert_cmd::Command 2025-12-23 17:32:47 -08:00
Michael Bolin
f80d16a93d merge commit for archive created by Sapling 2025-12-23 17:28:29 -08:00
Michael Bolin
5e23e4dcd3 feat: introduce codex-utils-cargo-bin as an alternative to assert_cmd::Command 2025-12-23 17:28:13 -08:00
Michael Bolin
841b6c4a82 Merge 36d67372d7 into sapling-pr-archive-bolinfest 2025-12-23 17:06:21 -08:00
Michael Bolin
36d67372d7 feat: introduce codex-utils-cargo-bin as an alternative to assert_cmd::Command 2025-12-23 17:06:01 -08:00
Michael Bolin
29ff4bbd7c merge commit for archive created by Sapling 2025-12-23 16:58:37 -08:00
Michael Bolin
28ac4f8453 feat: introduce codex-utils-cargo-bin as an alternative to assert_cmd::Command 2025-12-23 16:58:28 -08:00
Michael Bolin
3184358056 Merge fade06193e into sapling-pr-archive-bolinfest 2025-12-23 16:55:49 -08:00
Michael Bolin
fade06193e feat: introduce codex-utils-cargo-bin as an alternative to assert_cmd::Command 2025-12-23 16:52:26 -08:00
Ahmed Ibrahim
40de81e7af Remove reasoning format (#8484)
This isn't very useful parameter. 

logic:
```
if model puts `**` in their reasoning, trim it and visualize the header.
if couldn't trim: don't render
if model doesn't support: don't render
```

We can simplify to:
```
if could trim, visualize header.
if not, don't render
```
2025-12-23 16:01:46 -08:00
Michael Bolin
972b5853a0 fix: fix test that was writing temp file to cwd instead of TMPDIR (#8493)
I am trying to support building with [Buck2](https://buck2.build), which
reports which files have changed between invocations of `buck2 test` and
`tmp_delete_example.txt` came up. This turned out to be the reason.
2025-12-23 15:48:06 -08:00
Michael Bolin
6173892d70 Merge 2f103365d7 into sapling-pr-archive-bolinfest 2025-12-23 15:29:49 -08:00
Michael Bolin
2f103365d7 fix: fix test that was writing temp file to cwd instead of TMPDIR 2025-12-23 15:29:43 -08:00
Shijie Rao
fb24c47bea fix: limit output size for exec command in unified exec (#8460)
### Issue
[Investigation
thread](https://openai.slack.com/archives/C095U48JNL9/p1766426234975789)

Github issue: [issue one](https://github.com/openai/codex/issues/8197),
[issue two](https://github.com/openai/codex/issues/8358), [issue
three](https://github.com/openai/codex/issues/7585)
Commonality: working in monorepo and large projects. Multiple threads
going and showing sluggishness ending with a crash and grey background.
Potential high usage of context.
How to reproduce:
* Open the whole monorepo with cursor or VSC on the latest extension.
* Run ls -R in current CWD.

### Change
In unified exec, we do not have max output check to the delta we ouput
for shell commands. This causes issue with our VSCE UI which take the
delta and construct the shell output.
2025-12-23 14:36:15 -08:00
Josh McKinney
f2b740c95d fix(codex-cli): improve ripgrep download diagnostics (#8486)
When rg download fails during npm package staging, log the
target/platform/url and preserve the original exception as the cause.
Emit GitHub Actions log groups and error annotations so the failure is
easier to spot.

Document why a urlopen timeout is set (the default can hang
indefinitely).

This is to make failures in the specific build step easier to understand
/ work out what's failing rather than having a big wall of text (or at
least having an obvious part of it that helps narrow that wall)

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
2025-12-23 21:18:35 +00:00
Josh McKinney
0130a2fa40 feat(tui2): add multi-click transcript selection (#8471)
Support multi-click transcript selection using transcript/viewport
coordinates
(wrapped visual line index + content column), not terminal buffer
positions.

Gestures:
- double click: select word-ish token under cursor
- triple click: select entire wrapped line
- quad click: select paragraph (contiguous non-empty wrapped lines)
- quint+ click: select the entire history cell (all wrapped lines
belonging to a
  single `HistoryCell`, including blank lines inside the cell)

Selection expansion rebuilds the wrapped transcript view from
`HistoryCell::display_lines(width)` so boundaries match on-screen
wrapping during
scroll/resize/streaming reflow. Click grouping is resilient to minor
drag jitter
(some terminals emit tiny Drag events during clicks) and becomes more
tolerant as
the sequence progresses so quad/quint clicks are practical.

Tests cover expansion (word/line/paragraph/cell), sequence resets
(timing, motion,
line changes, real drags), drag jitter, and behavior on spacer lines
between
history cells (paragraph/cell selection prefers the cell above).
2025-12-23 21:05:06 +00:00
sayan-oai
53eb2e9f27 [tui] add optional details to TUI status header (#8293)
### What

Add optional `details` field to TUI's status indicator header. `details`
is shown under the header with text wrapping and a max height of 3
lines.

Duplicated changes to `tui2`.

### Why

Groundwork for displaying error details under `Reconnecting...` for
clarity with retryable errors.

Basic examples
<img width="1012" height="326" alt="image"
src="https://github.com/user-attachments/assets/dd751ceb-b179-4fb2-8fd1-e4784d6366fb"
/>

<img width="1526" height="358" alt="image"
src="https://github.com/user-attachments/assets/bbe466fc-faff-4a78-af7f-3073ccdd8e34"
/>

Truncation example
<img width="936" height="189" alt="image"
src="https://github.com/user-attachments/assets/f3f1b5dd-9050-438b-bb07-bd833c03e889"
/>

### Tests
Tested locally, added tests for truncation.
2025-12-23 12:40:40 -08:00
Josh McKinney
2828549323 fix(tui2): start transcript selection on drag (#8466)
Avoid distracting 1-cell highlights on simple click by tracking an
anchor on mouse down and only creating a visible selection once the
mouse is dragged (selection head set).

When dragging while following the bottom during streaming, request a
scroll lock so the viewport stops moving under the active selection.

Move selection state transitions into transcript_selection helpers
(returning change/lock outcomes for the caller) and add unit tests for
the state machine.
2025-12-22 21:15:57 -08:00
Anton Panasenko
cbc5fb9acf chore: save more about turn context in rollout log file (#8458)
### Motivation
- Persist richer per-turn configuration in rollouts so resumed/forked
sessions and tooling can reason about the exact instruction inputs and
output constraints used for a turn.

### Description
- Extend `TurnContextItem` to include optional `base_instructions`,
`user_instructions`, and `developer_instructions`.
- Record the optional `final_output_json_schema` associated with a turn.
- Add an optional `truncation_policy` to `TurnContextItem` and populate
it when writing turn-context rollout items.
- Introduce a protocol-level `TruncationPolicy` representation and
convert from core truncation policy when recording.

### Testing
- `cargo test -p codex-protocol` (pass)
2025-12-22 19:51:07 -08:00
Josh McKinney
310f2114ae fix(tui2): fix screen corruption (#8463)
Summary

Fixes intermittent screen corruption in tui2 (random stale characters)
by
addressing two terminal state desyncs: nested alt-screen transitions and
the
first-draw viewport clear.

- Make alt-screen enter/leave re-entrant via a small nesting guard so
closing
- Ensure the first viewport draw clears after the viewport is sized,
preventing
old terminal contents from leaking through when diff-based rendering
skips
  space cells.
- Add docs + a small unit test for the alt-screen nesting behavior.

Testing

- cargo test -p codex-tui2
- cargo clippy -p codex-tui2 --all-features --tests
- Manual:
- Opened the transcript overlay and dismissed it repeatedly; verified
the
      normal view redraws cleanly with no leftover characters.
- Ran tui2 in a new folder with no trust settings (and also cleared the
trust setting from config to re-trigger the prompt); verified the
initial
      trust/onboarding screen renders without artifacts.
2025-12-22 19:15:23 -08:00
Michael Bolin
e27d9bd88f feat: honor /etc/codex/config.toml (#8461)
This adds logic to load `/etc/codex/config.toml` and associate it with
`ConfigLayerSource::System` on UNIX. I refactored the code so it shares
logic with the creation of the `ConfigLayerSource::User` layer.
2025-12-22 19:06:04 -08:00
Josh McKinney
414fbe0da9 feat(tui2): add copy selection shortcut + UI affordance (#8462)
- Detect Ctrl+Shift+C vs VS Code Ctrl+Y and surface in footer hints
- Render clickable “⧉ copy” pill near transcript selection (hidden while
dragging)
- Handle copy hotkey + click to copy selection
- Document updated copy UX

VSCode:
<img width="1095" height="413" alt="image"
src="https://github.com/user-attachments/assets/84be0c82-4762-4c3e-80a4-c751c078bdaa"
/>

Ghosty:
<img width="505" height="68" alt="image"
src="https://github.com/user-attachments/assets/109cc1a1-f029-4f7e-a141-4c6ed2da7338"
/>
2025-12-22 18:54:58 -08:00
Michael Bolin
76a580caa3 Merge f759baa269 into sapling-pr-archive-bolinfest 2025-12-22 18:15:48 -08:00