Commit Graph
409 Commits
Author SHA1 Message Date
James Peter 818a0be00b Merge origin/code-merge-cwd-20260117: browser/tui updates 2026-01-17 14:36:48 +10:00
James Peter 4dc354943d Merge upstream/main: keep local workflows/docs 2026-01-17 10:22:16 +10:00
pakrym-oaiandGitHub de2c48c27e Rename hierarchical_agents to child_agents_md (#9215)
Clearer name
2026-01-14 19:14:24 +00:00
Josh McKinneyandGitHub 457732f151 tui: double-press Ctrl+C/Ctrl+D to quit (#8936)
## Problem

Codex’s TUI quit behavior has historically been easy to trigger
accidentally and hard to reason
about.

- `Ctrl+C`/`Ctrl+D` could terminate the UI immediately, which is a
common key to press while trying
  to dismiss a modal, cancel a command, or recover from a stuck state.
- “Quit” and “shutdown” were not consistently separated, so some exit
paths could bypass the
  shutdown/cleanup work that should run before the process terminates.

This PR makes quitting both safer (harder to do by accident) and more
uniform across quit
gestures, while keeping the shutdown-first semantics explicit.

## Mental model

After this change, the system treats quitting as a UI request that is
coordinated by the app
layer.

- The UI requests exit via `AppEvent::Exit(ExitMode)`.
- `ExitMode::ShutdownFirst` is the normal user path: the app triggers
`Op::Shutdown`, continues
rendering while shutdown runs, and only ends the UI loop once shutdown
has completed.
- `ExitMode::Immediate` exists as an escape hatch (and as the
post-shutdown “now actually exit”
signal); it bypasses cleanup and should not be the default for
user-triggered quits.

User-facing quit gestures are intentionally “two-step” for safety:

- `Ctrl+C` and `Ctrl+D` no longer exit immediately.
- The first press arms a 1-second window and shows a footer hint (“ctrl
+ <key> again to quit”).
- Pressing the same key again within the window requests a
shutdown-first quit; otherwise the
  hint expires and the next press starts a fresh window.

Key routing remains modal-first:

- A modal/popup gets first chance to consume `Ctrl+C`.
- If a modal handles `Ctrl+C`, any armed quit shortcut is cleared so
dismissing a modal cannot
  prime a subsequent `Ctrl+C` to quit.
- `Ctrl+D` only participates in quitting when the composer is empty and
no modal/popup is active.

The design doc `docs/exit-confirmation-prompt-design.md` captures the
intended routing and the
invariants the UI should maintain.

## Non-goals

- This does not attempt to redesign modal UX or make modals uniformly
dismissible via `Ctrl+C`.
It only ensures modals get priority and that quit arming does not leak
across modal handling.
- This does not introduce a persistent confirmation prompt/menu for
quitting; the goal is to keep
  the exit gesture lightweight and consistent.
- This does not change the semantics of core shutdown itself; it changes
how the UI requests and
  sequences it.

## Tradeoffs

- Quitting via `Ctrl+C`/`Ctrl+D` now requires a deliberate second
keypress, which adds friction for
  users who relied on the old “instant quit” behavior.
- The UI now maintains a small time-bounded state machine for the armed
shortcut, which increases
  complexity and introduces timing-dependent behavior.

This design was chosen over alternatives (a modal confirmation prompt or
a long-lived “are you
sure” state) because it provides an explicit safety barrier while
keeping the flow fast and
keyboard-native.

## Architecture

- `ChatWidget` owns the quit-shortcut state machine and decides when a
quit gesture is allowed
  (idle vs cancellable work, composer state, etc.).
- `BottomPane` owns rendering and local input routing for modals/popups.
It is responsible for
consuming cancellation keys when a view is active and for
showing/expiring the footer hint.
- `App` owns shutdown sequencing: translating
`AppEvent::Exit(ShutdownFirst)` into `Op::Shutdown`
  and only terminating the UI loop when exit is safe.

This keeps “what should happen” decisions (quit vs interrupt vs ignore)
in the chat/widget layer,
while keeping “how it looks and which view gets the key” in the
bottom-pane layer.

## Observability

You can tell this is working by running the TUIs and exercising the quit
gestures:

- While idle: pressing `Ctrl+C` (or `Ctrl+D` with an empty composer and
no modal) shows a footer
hint for ~1 second; pressing again within that window exits via
shutdown-first.
- While streaming/tools/review are active: `Ctrl+C` interrupts work
rather than quitting.
- With a modal/popup open: `Ctrl+C` dismisses/handles the modal (if it
chooses to) and does not
arm a quit shortcut; a subsequent quick `Ctrl+C` should not quit unless
the user re-arms it.

Failure modes are visible as:

- Quits that happen immediately (no hint window) from `Ctrl+C`/`Ctrl+D`.
- Quits that occur while a modal is open and consuming `Ctrl+C`.
- UI termination before shutdown completes (cleanup skipped).

## Tests

- Updated/added unit and snapshot coverage in `codex-tui` and
`codex-tui2` to validate:
  - The quit hint appears and expires on the expected key.
- Double-press within the window triggers a shutdown-first quit request.
- Modal-first routing prevents quit bypass and clears any armed shortcut
when a modal consumes
    `Ctrl+C`.

These tests focus on the UI-level invariants and rendered output; they
do not attempt to validate
real terminal key-repeat timing or end-to-end process shutdown behavior.

---
Screenshot:
<img width="912" height="740" alt="Screenshot 2026-01-13 at 1 05 28 PM"
src="https://github.com/user-attachments/assets/18f3d22e-2557-47f2-a369-ae7a9531f29f"
/>
2026-01-14 17:42:52 +00:00
Josh McKinneyandGitHub 5332a7f47b fix(tui): harden paste-burst state transitions (#9124)
User-facing symptom: On terminals that deliver pastes as rapid
KeyCode::Char/Enter streams (notably Windows), paste-burst transient
state
can leak into the next input. Users can see Enter insert a newline when
they meant to submit, or see characters appear late / handled through
the
wrong path.

System problem: PasteBurst is time-based. Clearing only the
classification window (e.g. via clear_window_after_non_char()) can erase
last_plain_char_time without emitting buffered text. If a buffer is
still
non-empty after that, flush_if_due() no longer has a timeout clock to
flush against, so the buffer can get "stuck" until another plain char
arrives.

This was surfaced while adding deterministic regression tests for
paste-burst behavior.

Fix: when disabling burst detection, defuse any in-flight burst state:
flush held/buffered text through handle_paste() (so it follows normal
paste integration), then clear timing and Enter suppression.

Document the rationale inline and update docs/tui-chat-composer.md so
"disable_paste_burst" matches the actual behavior.
2026-01-14 01:42:21 +00:00
GitHub Action 9ab3813e5c docs(changelog): update for v0.6.48 [skip ci] 2026-01-14 01:02:10 +00:00
GitHub Action ed8aa7789d docs(changelog): update for v0.6.47 [skip ci] 2026-01-13 21:28:46 +00:00
Josh McKinneyandGitHub 7bd5edee4f fix(tui): document paste-burst state machine (#9020)
Add a narrative doc and inline rustdoc explaining how `ChatComposer`
and `PasteBurst` compose into a single state machine on terminals that
lack reliable bracketed paste (notably Windows).

This documents the key states, invariants, and integration points
(`handle_input_basic`, `handle_non_ascii_char`, tick-driven flush) so
future changes are easier to reason about.
2026-01-13 11:48:31 -08:00
sayan-oaiandGitHub 4d91a753ff add generated jsonschema for config.toml (#8956)
### What
Add JSON Schema generation for `config.toml`, with checked‑in
`docs/config.schema.json`. We can move the schema elsewhere if preferred
(and host it if there's demand).

Add fixture test to prevent drift and `just write-config-schema` to
regenerate on schema changes.

Generate MCP config schema from `RawMcpServerConfig` instead of
`McpServerConfig` because that is the runtime type used for
deserialization.

Populate feature flag values into generated schema so they can be
autocompleted.

### Tests
Added tests + regenerate script to prevent drift. Tested autocompletions
using generated jsonschema locally with Even Better TOML.



https://github.com/user-attachments/assets/5aa7cd39-520c-4a63-96fb-63798183d0bc
2026-01-13 10:22:51 -08:00
James Peter 371f141167 Merge upstream/main: sync bazel and SDK updates 2026-01-12 08:38:00 +10:00
GitHub Action 1337814b00 docs(changelog): update for v0.6.46 [skip ci] 2026-01-11 22:23:59 +00:00
pakrym-oaiandGitHub 1fbd372999 Add hierarchical agent prompt (#8996) 2026-01-09 13:47:37 -08:00
0deb25b0d3 fix: add tui.alternate_screen config and --no-alt-screen CLI flag for Zellij scrollback (#8555)
Fixes #2558

Codex uses alternate screen mode (CSI 1049) which, per xterm spec,
doesn't support scrollback. Zellij follows this strictly, so users can't
scroll back through output.

**Changes:**
- Add `tui.alternate_screen` config: `auto` (default), `always`, `never`
- Add `--no-alt-screen` CLI flag
- Auto-detect Zellij and skip alt screen (uses existing `ZELLIJ` env var
detection)

**Usage:**
```bash
# CLI flag
codex --no-alt-screen

# Or in config.toml
[tui]
alternate_screen = "never"
```

With default `auto` mode, Zellij users get working scrollback without
any config changes.

---------

Co-authored-by: Josh McKinney <[email protected]>
2026-01-09 18:38:26 +00:00
jif-oaiandGitHub b2ccd04f46 chore: nuke telemetry file (#8985) 2026-01-09 08:55:21 -08:00
GitHub Action 3487ca6fb6 docs(changelog): update for v0.6.45 [skip ci] 2026-01-09 08:39:18 +00:00
jif-oaiandGitHub 353a011dc2 feat: add a few metrics (#8910) 2026-01-08 15:39:57 +00:00
jif-oaiandGitHub 99bc8a5975 feat: metrics capabilities (#8318)
Add metrics capabilities to Codex. The `README.md` is up to date.

This will not be merged with the metrics before this PR of course:
https://github.com/openai/codex/pull/8350
2026-01-08 11:47:36 +00:00
GitHub Action 80472284ab docs(changelog): update for v0.6.44 [skip ci] 2026-01-08 09:07:00 +00:00
GitHub Action 169f8a9dab docs(changelog): update for v0.6.43 [skip ci] 2026-01-08 04:52:28 +00:00
GitHub Action 40eb265431 docs(changelog): update for v0.6.42 [skip ci] 2026-01-08 02:53:21 +00:00
GitHub Action 8d740abb51 docs(changelog): update for v0.6.41 [skip ci] 2026-01-08 00:55:59 +00:00
GitHub Action d7de68dabf docs(changelog): update for v0.6.40 [skip ci] 2026-01-07 02:53:57 +00:00
GitHub Action 36de48c246 docs(changelog): update for v0.6.39 [skip ci] 2026-01-07 01:32:43 +00:00
James Peter bbeb797937 Merge branch 'main' of https://github.com/just-every/code 2026-01-07 11:05:35 +10:00
James Peter dc630c9893 Merge upstream/main: sync docs and tooling 2026-01-06 16:53:54 +10:00
GitHub Action de1e18aa0d docs(changelog): update for v0.6.38 [skip ci] 2026-01-06 03:30:55 +00:00
James Peter 7c45267eb8 Merge branch 'main' of https://github.com/just-every/code 2026-01-06 13:03:51 +10:00
James Peter cd65b453c6 docs(config): clarify openai-compatible providers 2026-01-06 13:03:36 +10:00
GitHub Action 6e3de981f2 docs(changelog): update for v0.6.37 [skip ci] 2026-01-06 00:28:23 +00:00
James Peter 982b18a89b Merge branch 'main' of https://github.com/just-every/code 2026-01-06 09:36:55 +10:00
James Peter 3cfa040776 fix(core/config): allow tool output size override (fixes #498) 2026-01-06 09:29:48 +10:00
GitHub Action 58d5d32241 docs(changelog): update for v0.6.36 [skip ci] 2026-01-05 19:25:40 +00:00
GitHub Action 4471f2ee8e docs(changelog): update for v0.6.35 [skip ci] 2026-01-05 11:03:27 +00:00
GitHub Action e395e03947 docs(changelog): update for v0.6.34 [skip ci] 2026-01-05 07:04:41 +00:00
GitHub Action cc0b175f22 docs(changelog): update for v0.6.33 [skip ci] 2026-01-05 05:27:17 +00:00
James Peter a06b084120 Merge origin/main: release metadata updates 2026-01-05 14:28:30 +10:00
James Peter a138ce6e5f feat(logging): overhaul debug log handling 2026-01-05 13:43:25 +10:00
GitHub Action a39f80a171 docs(changelog): update for v0.6.32 [skip ci] 2026-01-04 22:56:22 +00:00
GitHub Action 4ccf217fb0 docs(changelog): update for v0.6.31 [skip ci] 2026-01-04 12:50:15 +00:00
GitHub Action 2f0b04420f docs(changelog): update for v0.6.30 [skip ci] 2026-01-04 01:26:24 +00:00
Josh McKinneyandGitHub 21a7da1d33 perf(tui2): cache transcript view rendering (#8693)
The transcript viewport draws every frame. Ratatui's Line::render_ref
does grapheme segmentation and span layout, so repeated redraws can burn
CPU during streaming even when the visible transcript hasn't changed.

Introduce TranscriptViewCache to reduce per-frame work:
- WrappedTranscriptCache memoizes flattened+wrapped transcript lines per
width, appends incrementally as new cells arrive, and rebuilds on width
change, truncation (backtrack), or transcript replacement.
- TranscriptRasterCache caches rasterized rows (Vec<Cell>) per line
index and user-row styling; redraws copy cells instead of rerendering
spans.

The caches are width-scoped and store base transcript content only;
selection highlighting and copy affordances are applied after drawing.
User rows include the row-wide base style in the cached raster.

Refactor transcript_render to expose append_wrapped_transcript_cell for
incremental building and add a test that incremental append matches the
full build.

Add docs/tui2/performance-testing.md as a playbook for macOS sample
profiles and hotspot greps.

Expand transcript_view_cache tests to cover rebuild conditions, raster
equivalence vs direct rendering, user-row caching, and eviction.

Test: cargo test -p codex-tui2
2026-01-03 11:44:27 -08:00
Thibault SottiauxandGitHub ae310d42d2 chore: update outdated docs (#8701) 2026-01-03 02:19:52 -08:00
Eric TrautandGitHub 1019b9faae Replaced user documentation with links to developers docs site (#8662)
This eliminates redundant user documentation and allows us to focus our
documentation investments.

I left tombstone files for most of the existing ".md" docs files to
avoid broken links. These now contain brief links to the developers docs
site.
2026-01-02 13:01:53 -07:00
GitHub Action 41afc28793 docs(changelog): update for v0.6.29 [skip ci] 2026-01-02 06:38:01 +00:00
GitHub Action 9b2896aad4 docs(changelog): update for v0.6.27 [skip ci] 2026-01-02 01:58:24 +00:00
GitHub Action 6d149a1c72 docs(changelog): update for v0.6.26 [skip ci] 2026-01-01 11:11:02 +00:00
James Peter aec4754a6e Merge branch 'main' of https://github.com/just-every/code 2026-01-01 20:20:51 +10:00
James Peter 18cfce9fc9 feat(image_view): render local image attachments 2026-01-01 20:20:45 +10:00
GitHub Action 7281eb3c2e docs(changelog): update for v0.6.25 [skip ci] 2026-01-01 05:34:20 +00:00
GitHub Action 0df2a1f638 docs(changelog): update for v0.6.24 [skip ci] 2026-01-01 05:10:37 +00:00