Commit Graph
5095 Commits
Author SHA1 Message Date
rhan-oai 20819dc0c7 merge commit for archive created by Sapling 2026-04-04 15:43:32 -07:00
rhan-oai f80f096edb [codex-analytics] add steering metadata 2026-04-04 11:39:16 -07:00
rhan-oai 24ded922f5 [codex-analytics] add queued submission metadata 2026-04-04 11:39:16 -07:00
rhan-oai 7d63da2c64 [codex-analytics] add token usage metadata 2026-04-04 11:39:16 -07:00
rhan-oai 5603659dbd [codex-analytics] feature plumbing and emittance 2026-04-04 11:39:16 -07:00
rhan-oai d0b66a403a [codex-analytics] add protocol-native turn timestamps 2026-04-04 11:39:15 -07:00
rhan-oai c655e205cd merge commit for archive created by Sapling 2026-04-04 10:00:38 -07:00
rhan-oai 2238d006d7 [codex-analytics] add steering metadata 2026-04-04 09:59:27 -07:00
rhan-oai 7039a97208 [codex-analytics] add queued submission metadata 2026-04-04 09:59:27 -07:00
rhan-oai 9f40c2751f [codex-analytics] add token usage metadata 2026-04-04 09:59:27 -07:00
rhan-oai 830f8efa5f [codex-analytics] feature plumbing and emittance 2026-04-04 09:59:24 -07:00
rhan-oai 06a062d6e2 merge commit for archive created by Sapling 2026-04-04 09:55:00 -07:00
rhan-oai 128930a1d6 [codex-analytics] add steering metadata 2026-04-04 09:54:41 -07:00
rhan-oai faaf46a071 [codex-analytics] add queued submission metadata 2026-04-04 09:54:41 -07:00
rhan-oai 0e0fbc3c29 [codex-analytics] add token usage metadata 2026-04-04 09:54:41 -07:00
rhan-oai 09129d4b85 [codex-analytics] feature plumbing and emittance 2026-04-04 09:54:41 -07:00
rhan-oai b7cbb2ac9a merge commit for archive created by Sapling 2026-04-04 09:50:40 -07:00
rhan-oai 8e7d02ff1b [codex-analytics] add steering metadata 2026-04-03 18:42:06 -07:00
rhan-oai 62c424f017 [codex-analytics] add queued submission metadata 2026-04-03 18:42:06 -07:00
rhan-oai aa37e4f154 [codex-analytics] add token usage metadata 2026-04-03 18:42:06 -07:00
rhan-oai a80ff24a2c [codex-analytics] feature plumbing and emittance 2026-04-03 18:42:05 -07:00
rhan-oai ab101d9811 Merge b7537fec0a into sapling-pr-archive-rhan-oai 2026-04-03 18:04:16 -07:00
rhan-oai b7537fec0a [codex-analytics] add steering metadata 2026-04-03 18:03:52 -07:00
rhan-oai 532e1b35f7 merge commit for archive created by Sapling 2026-04-03 15:52:47 -07:00
rhan-oai ce5325ff24 [codex-analytics] add steering metadata 2026-04-03 15:52:07 -07:00
rhan-oai 2a2a8c83a1 [codex-analytics] add queued submission metadata 2026-04-03 15:36:56 -07:00
rhan-oai 660111f723 [codex-analytics] add token usage metadata 2026-04-03 15:36:56 -07:00
rhan-oai 8fb8f6dd00 [codex-analytics] feature plumbing and emittance 2026-04-03 15:36:56 -07:00
rhan-oai 975856478d Merge f750e127f4 into sapling-pr-archive-rhan-oai 2026-04-03 11:51:34 -07:00
rhan-oai f750e127f4 [codex-analytics] add steering metadata 2026-04-03 11:48:15 -07:00
rhan-oai 48a7e70eec [codex-analytics] add queued submission metadata 2026-04-03 11:48:15 -07:00
rhan-oai 357c1bbd38 merge commit for archive created by Sapling 2026-04-03 11:37:40 -07:00
rhan-oai 065a5e7131 [codex-analytics] add steering metadata 2026-04-03 11:35:57 -07:00
rhan-oai f474fc164e Merge eb06bb1186 into sapling-pr-archive-rhan-oai 2026-04-03 11:33:01 -07:00
rhan-oai eb06bb1186 [codex-analytics] add steering metadata 2026-04-02 22:46:36 -07:00
rhan-oai 831cc44cda Merge 98ecd0a770 into sapling-pr-archive-rhan-oai 2026-04-02 22:32:21 -07:00
rhan-oai 98ecd0a770 [codex-analytics] add queued submission metadata 2026-04-02 22:06:56 -07:00
rhan-oai ff88fbbbe4 Merge 0e16d53fb7 into sapling-pr-archive-rhan-oai 2026-04-02 18:55:58 -07:00
rhan-oai 0e16d53fb7 [codex-analytics] add token usage metadata 2026-04-02 18:55:43 -07:00
rhan-oai 37390db009 [codex-analytics] feature plumbing and emittance 2026-04-02 18:55:43 -07:00
rhan-oai 9a2fbe7521 merge commit for archive created by Sapling 2026-04-02 18:53:11 -07:00
rhan-oai 3d1314ca03 [codex-analytics] add protocol-native turn timestamps 2026-04-02 18:52:39 -07:00
rhan-oai 426b81a41b [codex-analytics] add token usage metadata 2026-04-02 18:52:39 -07:00
rhan-oai f7d1f45775 [codex-analytics] feature plumbing and emittance 2026-04-02 18:52:39 -07:00
rhan-oai d180b0846c [codex-analytics] add token usage metadata 2026-04-02 17:11:09 -07:00
rhan-oai 8068f5dc2c [codex-analytics] feature plumbing and emittance 2026-04-02 16:52:32 -07:00
rhan-oai bd8a3ac0f9 [codex-analytics] add protocol-native turn timestamps 2026-04-02 16:14:41 -07:00
fcoury-oaiandClaude Opus 4.6 0bd31dc382 fix(tui): handle zellij redraw and composer rendering (#16578)
## TL;DR

Fixes the issues when using Codex CLI with Zellij multiplexer. Before
this PR there would be no scrollback when using it inside a zellij
terminal.

## Problem

Addresses #2558

Zellij does not support ANSI scroll-region manipulation (`DECSTBM` /
Reverse Index) or the alternate screen buffer in the way traditional
terminals do. When codex's TUI runs inside Zellij, two things break: (1)
inline history insertion corrupts the display because the scroll-region
escape sequences are silently dropped or mishandled, and (2) the
composer textarea renders with inherited background/foreground styles
that produce unreadable text against Zellij's pane chrome.

## Mental model

The fix introduces a **Zellij mode** — a runtime boolean detected once
at startup via `codex_terminal_detection::terminal_info().is_zellij()` —
that gates two subsystems onto Zellij-safe terminal strategies:

- **History insertion** (`insert_history.rs`): Instead of using
`DECSTBM` scroll regions and Reverse Index (`ESC M`) to slide content
above the viewport, Zellij mode scrolls the screen by emitting `\n` at
the bottom row and then writes history lines at absolute positions. This
avoids every escape sequence Zellij mishandles.
- **Viewport expansion** (`tui.rs`): When the viewport grows taller than
available space, the standard path uses `scroll_region_up` on the
backend. Zellij mode instead emits newlines at the screen bottom to push
content up, then invalidates the ratatui diff buffer so the next draw is
a full repaint.
- **Composer rendering** (`chat_composer.rs`, `textarea.rs`): All text
rendering in the input area uses an explicit `base_style` with
`Color::Reset` foreground, preventing Zellij's pane styling from
bleeding into the textarea. The prompt chevron (`›`) and placeholder
text use explicit color constants instead of relying on `.bold()` /
`.dim()` modifiers that render inconsistently under Zellij.

## Non-goals

- This change does not fix or improve Zellij's terminal emulation
itself.
- It does not rearchitect the inline viewport model; it adds a parallel
code path gated on detection.
- It does not touch the alternate-screen disable logic (that already
existed and continues to use `is_zellij` via the same detection).

## Tradeoffs

- **Code duplication in `insert_history.rs`**: The Zellij and Standard
branches share the line-rendering loop (color setup, span merging,
`write_spans`) but differ in the scrolling preamble. The duplication is
intentional — merging them would force a complex conditional state
machine that's harder to reason about than two flat sequences.
- **`invalidate_viewport` after every Zellij history flush or viewport
expansion**: This forces a full repaint on every draw cycle in Zellij,
which is more expensive than ratatui's normal diff-based rendering. This
is necessary because Zellij's lack of scroll-region support means the
diff buffer's assumptions about what's on screen are invalid after we
manually move content.
- **Explicit colors vs semantic modifiers**: Replacing `.bold()` /
`.dim()` with `Color::Cyan` / `Color::DarkGray` / `Color::White` in the
Zellij branch sacrifices theme-awareness for correctness. If the project
ever adopts a theming system, Zellij styling will need to participate.

## Architecture

The Zellij detection flag flows through three layers:

1. **`codex_terminal_detection`** — `TerminalInfo::is_zellij()` (new
convenience method) reads the already-detected `Multiplexer` variant.
2. **`Tui` struct** — caches `is_zellij` at construction; passes it into
`update_inline_viewport`, `flush_pending_history_lines`, and
`insert_history_lines_with_mode`.
3. **`ChatComposer` struct** — independently caches `is_zellij` at
construction; uses it in `render_textarea` for style decisions.

The two caches (`Tui.is_zellij` and `ChatComposer.is_zellij`) are read
from the same global `OnceLock<TerminalInfo>`, so they always agree.

## Observability

No new logging, metrics, or tracing is introduced. Diagnosis depends on:
- Whether `ZELLIJ` or `ZELLIJ_SESSION_NAME` env vars are set (the
detection heuristic).
- Visual inspection of the rendered TUI inside Zellij vs a standard
terminal.
- The insta snapshot `zellij_empty_composer` captures the Zellij-mode
render path.

## Tests

- `terminal_info_reports_is_zellij` — unit test in `terminal-detection`
confirming the convenience method.
- `zellij_empty_composer_snapshot` — insta snapshot in `chat_composer`
validating the Zellij render path for an empty composer.
- `vt100_zellij_mode_inserts_history_and_updates_viewport` — integration
test in `insert_history` verifying that Zellij-mode history insertion
writes content and shifts the viewport.

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 18:07:05 -03:00
Eric Traut 9bb7f0a694 Fix fork source display in /status (expose forked_from_id in app server) (#16596)
Addresses #16560

Problem: `/status` stopped showing the source thread id in forked TUI
sessions after the app-server migration.

Solution: Carry fork source ids through app-server v2 thread data and
the TUI session adapter, and update TUI fixtures so `/status` matches
the old TUI behavior.
2026-04-02 14:05:29 -07:00
Michael Bolin 93380a6fac fix: add shell fallback paths for pwsh/powershell that work on GitHub Actions Windows runners (#16617)
Recently, I merged a number of PRs to increase startup timeouts for
scripts that ran under PowerShell, but in the failure for
`suite::codex_tool::test_shell_command_approval_triggers_elicitation`, I
found this in the error logs when running on Bazel with BuildBuddy:

```
[mcp stderr] 2026-04-02T19:54:10.758951Z ERROR codex_core::tools::router: error=Exit code: 1
[mcp stderr] Wall time: 0.2 seconds
[mcp stderr] Output:
[mcp stderr] 'New-Item' is not recognized as an internal or external command,
[mcp stderr] operable program or batch file.
[mcp stderr] 
```

This error implies that the command was run under `cmd.exe` instead of
`pwsh.exe`. Under GitHub Actions, I suspect that the `%PATH%` that is
passed to our Bazel builder is scrubbed such that our tests cannot find
PowerShell where GitHub installs it. Having these explicit fallback
paths should help.

While we could enable these only for tests, I don't see any harm in
keeping them in production, as well.
2026-04-02 13:47:10 -07:00