Commit Graph

1542 Commits

  • fix(tui): remove duplicate context statusline item (#18054)
    Addresses #18045
    
    Problem: `/statusline` exposed both `context-remaining` and
    `context-remaining-percent` after conflicting PRs attempted to address
    the same context-status issue, including #17637, allowing duplicate
    footer segments.
    
    Solution: Remove the duplicate `context-remaining-percent` status-line
    item and update status-line tests and snapshots to use only canonical
    `context-remaining`.
  • Fix MCP startup cancellation through app server (#18078)
    Addresses https://github.com/openai/codex/issues/17143
    
    Problem: TUI interrupts without an active turn stopped cancelling slow
    MCP startup after routing through the app-server APIs.
    
    Solution: Route no-active-turn interrupts through app-server as startup
    cancels, acknowledge them immediately, and emit cancelled MCP startup
    updates.
    
    Testing: I manually confirmed that MCP cancellation didn't work prior to
    this PR and works after the fix was in place.
  • [codex][mcp] Add resource uri meta to tool call item. (#17831)
    - [x] Add resource uri meta to tool call item so that the app-server
    client can start prefetching resources immediately without loading mcp
    server status.
  • Async config loading (#18022)
    Parts of config will come from executor. Prepare for that by making
    config loading methods async.
  • Display YOLO mode permissions if set when launching TUI (#17877)
    - When launching the TUI client, if YOLO mode is enabled, display this
    in the header.
    - Eligibility is determined by `approval_policy = "never"` and
    `sandbox_mode = "danger-full-access"`
    
    <img width="886" height="230" alt="image"
    src="https://github.com/user-attachments/assets/d7064778-e32c-4123-8e44-ca0c9016ab09"
    />
  • Significantly improve standalone installer (#17022)
    ## Summary
    
    This PR significantly improves the standalone installer experience.
    
    The main changes are:
    
    1. We now install the codex binary and other dependencies in a
    subdirectory under CODEX_HOME.
    (`CODEX_HOME/packages/standalone/releases/...`)
    
    2. We replace the `codex.js` launcher that npm/bun rely on with logic in
    the Rust binary that automatically resolves its dependencies (like
    ripgrep)
    
    ## Motivation
    
    A few design constraints pushed this work.
    
    1. Currently, the entrypoint to codex is through `codex.js`, which
    forces a node dependency to kick off our rust app. We want to move away
    from this so that the entrypoint to codex does not rely on node or
    external package managers.
    2. Right now, the native script adds codex and its dependencies directly
    to user PATH. Given that codex is likely to add more binary dependencies
    than ripgrep, we want a solution which does not add arbitrary binaries
    to user PATH -- the only one we want to add is the `codex` command
    itself.
    3. We want upgrades to be atomic. We do not want scenarios where
    interrupting an upgrade command can move codex into undefined state (for
    example, having a new codex binary but an old ripgrep binary). This was
    ~possible with the old script.
    4. Currently, the Rust binary uses heuristics to determine which
    installer created it. These heuristics are flaky and are tied to the
    `codex.js` launcher. We need a more stable/deterministic way to
    determine how the binary was installed for standalone.
    5. We do not want conflicting codex installations on PATH. For example,
    the user installing via npm, then installing via brew, then installing
    via standalone would make it unclear which version of codex is being
    launched and make it tough for us to determine the right upgrade
    command.
    
    ## Design
    
    ### Standalone package layout
    
    Standalone installs now live under `CODEX_HOME/packages/standalone`:
    
    ```text
    $CODEX_HOME/
      packages/
        standalone/
          current -> releases/0.111.0-x86_64-unknown-linux-musl
          releases/
            0.111.0-x86_64-unknown-linux-musl/
              codex
              codex-resources/
                rg
    ```
    
    where `standalone/current` is a symlink to a release directory.
    
    On Windows, the release directory has the same shape, with `.exe` names
    and Windows helpers in `codex-resources`:
    
    ```text
    %CODEX_HOME%\
      packages\
        standalone\
          current -> releases\0.111.0-x86_64-pc-windows-msvc
          releases\
            0.111.0-x86_64-pc-windows-msvc\
              codex.exe
              codex-resources\
                rg.exe
                codex-command-runner.exe
                codex-windows-sandbox-setup.exe
    ```
    
    This gives us:
    - atomic upgrades because we can fully stage a release before switching
    `standalone/current`
    - a stable way for the binary to recognize a standalone install from its
    canonical `current_exe()` path under CODEX_HOME
    - a clean place for binary dependencies like `rg`, Windows sandbox
    helpers, and, in the future, our custom `zsh` etc
    
    ### Command location
    
    On Unix, we add a symlink at `~/.local/bin/codex` which points directly
    to the `$CODEX_HOME/packages/standalone/current/codex` binary. This
    becomes the main entrypoint for the CLI.
    
    On Windows, we store the link at
    `%LOCALAPPDATA%\Programs\OpenAI\Codex\bin`.
    
    ### PATH persistence
    
    This is a tricky part of the PR, as there's no ~super reliable way to
    ensure that we end up on PATH without significant tradeoffs.
    
    Most Unix variants will have `~/.local/bin` on PATH already, which means
    we *should* be fine simply registering the command there in most cases.
    However, there are cases where this is not the case. In these cases, we
    directly edit the profile depending on the shell we're in.
    
    - macOS zsh: `~/.zprofile`
    - macOS bash: `~/.bash_profile`
    - Linux zsh: `~/.zshrc`
    - Linux bash: `~/.bashrc`
    - fallback: `~/.profile`
    
    On Windows, we update the User `Path` environment variable directly and
    we don't need to worry about shell profiles.
    
    ### Standalone runtime detection
    
    This PR adds a new shared crate, `codex-install-context`, which computes
    install ownership once per process and caches it in a `OnceLock`.
    
    That context includes:
    - install manager (`Standalone`, `Npm`, `Bun`, `Brew`, `Other`)
    - the managed standalone release directory, when applicable
    - the managed standalone `codex-resources` directory, when present
    - the resolved `rg_command`
    
    The standalone path is detected by canonicalizing `current_exe()`,
    canonicalizing CODEX_HOME via `find_codex_home()`, and checking whether
    the binary is running from under
    `$CODEX_HOME/packages/standalone/releases`.
    
    We intentionally do not use a release metadata file. The binary path is
    the source of truth.
    
    ### Dependency resolution
    
    For standalone installs, `grep_files` now resolves bundled `rg` from
    `codex-resources` next to the Codex binary.
    
    For npm/bun/brew/other installs, `grep_files` falls back to resolving
    `rg` from PATH.
    
    For Windows standalone installs, Windows sandbox helpers are still found
    as direct siblings when present. If they are not direct siblings, the
    lookup also checks the sibling `codex-resources` directory.
    
    ### TUI update path
    
    The TUI now has `UpdateAction::StandaloneUnix` and
    `UpdateAction::StandaloneWindows`, which rerun the standalone install
    commands.
    
    Unix update command:
    
    ```sh
    sh -c "curl -fsSL https://chatgpt.com/codex/install.sh | sh"
    ```
    
    Windows update command:
    
    ```powershell
    powershell -c "irm https://chatgpt.com/codex/install.ps1|iex"
    ```
    
    The Windows updater runs PowerShell directly. We do this because `cmd
    /C` would parse the `|iex` as a cmd pipeline instead of passing it to
    PowerShell.
    
    ## Additional installer behavior
    
    - standalone installs now warn about conflicting npm/bun/brew-managed
    `codex` installs and offer to uninstall them
    - same-version reruns do not redownload the release if it is already
    staged locally
    
    ## Testing
    
    Installer smoke tests run:
    - macOS: fresh install into isolated `HOME` and `CODEX_HOME` with
    `scripts/install/install.sh --release latest`
    - macOS: reran the installer against the same isolated install to verify
    the same-version/update path and PATH block idempotence
    - macOS: verified the installed `codex --version` and bundled
    `codex-resources/rg --version`
    - Windows: parsed `scripts/install/install.ps1` with PowerShell via
    `[scriptblock]::Create(...)`
    - Windows: verified the standalone update action builds a direct
    PowerShell command and does not route the `irm ...|iex` command through
    `cmd /C`
    
    ---------
    
    Co-authored-by: Codex <noreply@openai.com>
  • [docs] Revert extra changes from PR 17848 (#18003)
    ## Summary
    
    1. Revert https://github.com/openai/codex/pull/17848 so the Bazel and
    `BUILD` file changes leave `main`.
    2. Prepare for a narrower follow up that restores only `SECURITY.md`.
    
    ## Validation
    
    1. Reviewed the revert diff against `main`.
    2. Ran a clean diff check before push.
  • Dismiss stale app-server requests after remote resolution (#15134)
    Dismiss stale TUI app-server approvals after remote resolution
    
    When an approval, user-input prompt, or elicitation request is resolved
    by another client, the TUI now dismisses the matching local UI instead
    of leaving stale prompts behind and emitting a misleading local
    cancellation.
    
    This change teaches pending app-server request tracking to map
    `serverRequest/resolved` notifications back to the concrete request type
    and stable request key, then propagates that resolved request into TUI
    prompt state. Approval, request-user-input, and MCP elicitation overlays
    now drop the resolved current or queued request quietly, advance to the
    next queued request when present, and avoid emitting abort/cancel events
    for stale UI.
    
    The latest update also retires matching prompts while they are still
    deferred behind active streaming and suppresses buffered active-thread
    requests whose app-server request id has already been resolved before
    drain. `ChatWidget` removes a resolved request from both the deferred
    interrupt queue and the materialized bottom-pane stack, while
    active-thread request handling verifies the app-server request is still
    pending before showing a prompt. Lifecycle events such as exec begin/end
    remain queued so approved work can still render normally.
    
    Tests cover resolved-request mapping, overlay dismissal behavior,
    deferred prompt pruning for same-turn user input, exec approval IDs,
    lifecycle-event retention, and the buffered active-thread ordering
    regression.
    
    Validation:
    - `just fmt`
    - `git diff --check`
    - `cargo test -p codex-tui
    resolved_buffered_approval_does_not_become_actionable_after_drain`
    - `cargo test -p codex-tui
    enqueue_primary_thread_session_replays_buffered_approval_after_attach`
    - `cargo test -p codex-tui chatwidget::interrupts`
    - `just fix -p codex-tui`
    
    ---------
    
    Co-authored-by: Codex <noreply@openai.com>
  • [docs] Add security boundaries reference in SECURITY.md (#17848)
    ## Summary
    1. Add a Security Boundaries section to `SECURITY.md`.
    2. Point readers to the Codex Agent approvals and security documentation
    for sandboxing, approvals, and network controls.
    
    ## Validation
    1. Reviewed the `SECURITY.md` diff in a clean worktree.
    2. No tests run. Docs only change.
  • chore(tui) cleanup (#17920)
    ## Summary
    Cleanup extraneous plugins.
  • Register agent identities behind use_agent_identity (#17386)
    ## Summary
    
    Stack PR 2 of 4 for feature-gated agent identity support.
    
    This PR adds agent identity registration behind
    `features.use_agent_identity`. It keeps the app-server protocol
    unchanged and starts registration after ChatGPT auth exists rather than
    requiring a client restart.
    
    ## Stack
    
    - PR1: https://github.com/openai/codex/pull/17385 - add
    `features.use_agent_identity`
    - PR2: https://github.com/openai/codex/pull/17386 - this PR
    - PR3: https://github.com/openai/codex/pull/17387 - register agent tasks
    when enabled
    - PR4: https://github.com/openai/codex/pull/17388 - use `AgentAssertion`
    downstream when enabled
    
    ## Validation
    
    Covered as part of the local stack validation pass:
    
    - `just fmt`
    - `cargo test -p codex-core --lib agent_identity`
    - `cargo test -p codex-core --lib agent_assertion`
    - `cargo test -p codex-core --lib websocket_agent_task`
    - `cargo test -p codex-api api_bridge`
    - `cargo build -p codex-cli --bin codex`
    
    ## Notes
    
    The full local app-server E2E path is still being debugged after PR
    creation. The current branch stack is directionally ready for review
    while that follow-up continues.
  • feat: reset memories button (#17937)
    <img width="720" height="175" alt="Screenshot 2026-04-15 at 14 35 02"
    src="https://github.com/user-attachments/assets/041d73ff-8c16-42a9-8e92-c245805084f0"
    />
  • feat: memories menu (#17632)
    Add menu that:
    1. If memories feature is not enabled, propose to enable it
    2. Let you choose if you want to generate memories and to use memories
  • Spread AbsolutePathBuf (#17792)
    Mechanical change to promote absolute paths through code.
  • Fix remote skill popup loading (#17702)
    ## Summary
    
    Fix the TUI `$` skill popup so personal skills appear reliably when
    Codex is connected to a remote app-server.
    
    ## What changed
    
    - load skills on TUI startup with an explicit forced refresh
    - refresh skills using the actual current cwd instead of an empty `cwds`
    list
    - resync an already-open `$` popup when skill mentions are updated
    - add a regression test for refreshing an open mention popup
    
    ## Root cause
    
    The TUI was sometimes sending `list_skills` with `cwds: []` after
    `SessionConfigured`.
    
    For the launchd app-server flow, the server resolved that empty cwd list
    to its own process cwd, which was `/`. The response therefore came back
    tagged with `cwd: "/"`, and the TUI later filtered skills by exact cwd
    match against the actual project cwd such as `/Users/starr/code/dream`.
    That dropped all personal skills from the mention list, so `$` only
    showed plugins/apps.
    
    ## Verification
    
    Built successfully with remote cache disabled:
    
    ```bash
    cd /Users/starr/code/codex-worktrees/starr-skill-popup-20260413130509
    bazel --output_base=/tmp/codex-bazel-verify-starr-skill-popup build //codex-rs/cli:codex --noremote_accept_cached --noremote_upload_local_results --disk_cache=
    ```
    
    Also verified interactively in a PTY against the live app-server at
    `ws://127.0.0.1:4511`:
    - launched the built TUI
    - typed `$`
    - confirmed personal skills appeared in the popup, including entries
    such as `Applied Devbox`, `CI Debug`, `Channel Summarization`, `Codex PR
    Review`, and `Daily Digest`
    
    ## Files changed
    
    - `codex-rs/tui/src/app.rs`
    - `codex-rs/tui/src/chatwidget.rs`
    - `codex-rs/tui/src/bottom_pane/chat_composer.rs`
    
    Co-authored-by: Codex <noreply@openai.com>
  • fix: Revert danger-full-access denylist-only mode (#17732)
    ## Summary
    
    - Reverts openai/codex#16946 and removes the danger-full-access
    denylist-only network mode.
    - Removes the corresponding config requirements, app-server
    protocol/schema, config API, TUI debug output, and network proxy
    behavior.
    - Drops stale tests that depended on the reverted mode while preserving
    newer managed allowlist-only coverage.
    
    ## Verification
    
    - `just write-app-server-schema`
    - `just fmt`
    - `cargo test -p codex-config network_requirements`
    - `cargo test -p codex-core network_proxy_spec`
    - `cargo test -p codex-core
    managed_network_proxy_decider_survives_full_access_start`
    - `cargo test -p codex-app-server map_requirements_toml_to_api`
    - `cargo test -p codex-tui debug_config_output`
    - `cargo test -p codex-app-server-protocol`
    - `just fix -p codex-config -p codex-core -p codex-app-server-protocol
    -p codex-app-server -p codex-tui`
    - `git diff --cached --check`
    
    Not run: full workspace `cargo test` (repo instructions ask for
    confirmation before that broader run).
  • Add realtime output modality and transcript events (#17701)
    - Add outputModality to thread/realtime/start and wire text/audio output
    selection through app-server, core, API, and TUI.\n- Rename the realtime
    transcript delta notification and add a separate transcript done
    notification that forwards final text from item done without correlating
    it with deltas.
  • Refactor plugin loading to async (#17747)
    Simplifies skills migration.
  • [codex] Remove unused Rust helpers (#17146)
    ## Summary
    
    Removes high-confidence unused Rust helper functions and exports across
    `codex-tui`, `codex-shell-command`, and utility crates.
    
    The cleanup includes dead TUI helper methods, unused
    path/string/elapsed/fuzzy-match utilities, an unused Windows PowerShell
    lookup helper, and the unused terminal palette version counter. This
    keeps the remaining public surface smaller without changing behavior.
    
    ## Validation
    
    - `just fmt`
    - `cargo test -p codex-tui -p codex-shell-command -p codex-utils-elapsed
    -p codex-utils-fuzzy-match -p codex-utils-string -p codex-utils-path`
    - `just fix -p codex-tui -p codex-shell-command -p codex-utils-elapsed
    -p codex-utils-fuzzy-match -p codex-utils-string -p codex-utils-path`
    - `git diff --check`
  • guardian timeout fix pr 3 - ux touch for timeouts (#17557)
    This PR teaches the TUI to render guardian review timeouts as explicit
    terminal history entries instead of dropping them from the live
    timeline.
    It adds timeout-specific history cells for command, patch, MCP tool, and
    network approval reviews.
    It also adds snapshot tests covering both the direct guardian event path
    and the app-server notification path.
  • Fix tui compilation (#17691)
    The recent release broke, codex suggested this as the fix
    
    Source failure:
    https://github.com/openai/codex/actions/runs/24362949066/job/71147202092
    
    Probably from
    https://github.com/openai/codex/commit/ac82443d073f7f9a2248bad51bae2fa424ef4946
    
    For why it got in:
    ```
    The relevant setup:
    
    .github/workflows/rust-ci.yml (line 1) runs on PRs, but for codex-rs it only does:
    
    cargo fmt --check
    cargo shear
    argument-comment lint via Bazel
    no cargo check, no cargo clippy over the workspace, no cargo test over codex-tui
    .github/workflows/rust-ci-full.yml (line 1) runs on pushes to main and branches matching **full-ci**. That one does compile TUI because:
    
    codex-rs/Cargo.toml includes "tui" as a workspace member
    lint_build runs cargo clippy --target ... --tests --profile ...
    the matrix includes both dev and release profiles
    tests runs cargo nextest run ..., but only dev-profile tests
    Release CI also compiles it indirectly. .github/workflows/rust-release.yml (line 235) builds --bin codex, and cli/Cargo.toml (line 46) depends on codex-tui.
    ```
    
    Codex tested locally with `cargo check -p codex-tui --release` and was
    able to repro, and verified that this fixed it
  • Fix TUI compaction item replay (#17657)
    Problem: PR #17601 updated context-compaction replay to call a new
    ChatWidget handler, but the handler was never implemented, breaking
    codex-tui compilation on main.
    
    Solution: Render context-compaction replay through the existing
    info-message path, preserving the intended `Context compacted` UI marker
    without adding a one-off handler.
  • Suppress duplicate compaction and terminal wait events (#17601)
    Addresses #17514
    
    Problem: PR #16966 made the TUI render the deprecated context-compaction
    notification, while v2 could also receive legacy unified-exec
    interaction items alongside terminal-interaction notifications, causing
    duplicate "Context compacted" and "Waited for background terminal"
    messages.
    
    Solution: Suppress deprecated context-compaction notifications and
    legacy unified-exec interaction command items from the app-server v2
    projection, and render canonical context-compaction items through the
    existing TUI info-event path.
  • Wrap status reset timestamps in narrow layouts (#17481)
    Addresses #17453
    
    Problem: /status rate-limit reset timestamps can be truncated in narrow
    layouts, leaving users with partial times or dates.
    
    Solution: Let narrow rate-limit rows drop the fixed progress bar to
    preserve the percent summary, and wrap reset timestamps onto
    continuation lines instead of truncating them.
  • Emit plan-mode prompt notifications for questionnaires (#17417)
    Addresses #17252
    
    Problem: Plan-mode clarification questionnaires used the generic
    user-input notification type, so configs listening for plan-mode-prompt
    did not fire when request_user_input waited for an answer.
    
    Solution: Map request_user_input prompts to the plan-mode-prompt
    notification and remove the obsolete user-input TUI notification
    variant.
  • Run exec-server fs operations through sandbox helper (#17294)
    ## Summary
    - run exec-server filesystem RPCs requiring sandboxing through a
    `codex-fs` arg0 helper over stdin/stdout
    - keep direct local filesystem execution for `DangerFullAccess` and
    external sandbox policies
    - remove the standalone exec-server binary path in favor of top-level
    arg0 dispatch/runtime paths
    - add sandbox escape regression coverage for local and remote filesystem
    paths
    
    ## Validation
    - `just fmt`
    - `git diff --check`
    - remote devbox: `cd codex-rs && bazel test --bes_backend=
    --bes_results_url= //codex-rs/exec-server:all` (6/6 passed)
    
    ---------
    
    Co-authored-by: Codex <noreply@openai.com>
  • Expose instruction sources (AGENTS.md) via app server (#17506)
    Addresses #17498
    
    Problem: The TUI derived /status instruction source paths from the local
    client environment, which could show stale <none> output or incorrect
    paths when connected to a remote app server.
    
    Solution: Add an app-server v2 instructionSources snapshot to thread
    start/resume/fork responses, default it to an empty list when older
    servers omit it, and render TUI /status from that server-provided
    session data.
    
    Additional context: The app-server field is intentionally named
    instructionSources rather than AGENTS.md-specific terminology because
    the loaded instruction sources can include global instructions, project
    AGENTS.md files, AGENTS.override.md, user-defined instruction files, and
    future dynamic sources.
  • Remove context status-line meter (#17420)
    Addresses #17313
    
    Problem: The visual context meter in the status line was confusing and
    continued to draw negative feedback, and context reporting should remain
    an explicit opt-in rather than part of the default footer.
    
    Solution: Remove the visual meter, restore opt-in context remaining/used
    percentage items that explicitly say "Context", keep existing
    context-usage configs working as a hidden alias, and update the setup
    text and snapshots.
  • feat(tui): add reverse history search to composer (#17550)
    ## Problem
    
    The TUI had shell-style Up/Down history recall, but `Ctrl+R` did not
    provide the reverse incremental search workflow users expect from
    shells. Users needed a way to search older prompts without immediately
    replacing the current draft, and the interaction needed to handle async
    persistent history, repeated navigation keys, duplicate prompt text,
    footer hints, and preview highlighting without making the main composer
    file even harder to review.
    
    
    https://github.com/user-attachments/assets/5165affd-4c9a-46e9-adbd-89088f5f7b6b
    
    <img width="1227" height="722" alt="image"
    src="https://github.com/user-attachments/assets/8bc83289-eeca-47c7-b0c3-8975101901af"
    />
    
    ## Mental model
    
    `Ctrl+R` opens a temporary search session owned by the composer. The
    footer line becomes the search input, the composer body previews the
    current match only after the query has text, and `Enter` accepts that
    preview as an editable draft while `Esc` restores the draft that existed
    before search started. The history layer provides a combined offset
    space over persistent and local history, but search navigation exposes
    unique prompt text rather than every physical history row.
    
    ## Non-goals
    
    This change does not rewrite stored history, change normal Up/Down
    browsing semantics, add fuzzy matching, or add persistent metadata for
    attachments in cross-session history. Search deduplication is
    deliberately scoped to the active Ctrl+R search session and uses exact
    prompt text, so case, whitespace, punctuation, and attachment-only
    differences are not normalized.
    
    ## Tradeoffs
    
    The implementation keeps search state in the existing composer and
    history state machines instead of adding a new cross-module controller.
    That keeps ownership local and testable, but it means the composer still
    coordinates visible search status, draft restoration, footer rendering,
    cursor placement, and match highlighting while `ChatComposerHistory`
    owns traversal, async fetch continuation, boundary clamping, and
    unique-result caching. Unique-result caching stores cloned
    `HistoryEntry` values so known matches can be revisited without cache
    lookups; this is simple and robust for interactive search sizes, but it
    is not a global history index.
    
    ## Architecture
    
    `ChatComposer` detects `Ctrl+R`, snapshots the current draft, switches
    the footer to `FooterMode::HistorySearch`, and routes search-mode keys
    before normal editing. Query edits call `ChatComposerHistory::search`
    with `restart = true`, which starts from the newest combined-history
    offset. Repeated `Ctrl+R` or Up searches older; Down searches newer
    through already discovered unique matches or continues the scan.
    Persistent history entries still arrive asynchronously through
    `on_entry_response`, where a pending search either accepts the response,
    skips a duplicate, or requests the next offset.
    
    The composer-facing pieces now live in
    `codex-rs/tui/src/bottom_pane/chat_composer/history_search.rs`, leaving
    `chat_composer.rs` responsible for routing and rendering integration
    instead of owning every search helper inline.
    `codex-rs/tui/src/bottom_pane/chat_composer_history.rs` remains the
    owner of stored history, combined offsets, async fetch state, boundary
    semantics, and duplicate suppression. Match highlighting is computed
    from the current composer text while search is active and disappears
    when the match is accepted.
    
    ## Observability
    
    There are no new logs or telemetry. The practical debug path is state
    inspection: `ChatComposer.history_search` tells whether the footer query
    is idle, searching, matched, or unmatched; `ChatComposerHistory.search`
    tracks selected raw offsets, pending persistent fetches, exhausted
    directions, and unique match cache state. If a user reports skipped or
    repeated results, first inspect the exact stored prompt text, the
    selected offset, whether an async persistent response is still pending,
    and whether a query edit restarted the search session.
    
    ## Tests
    
    The change is covered by focused `codex-tui` unit tests for opening
    search without previewing the latest entry, accepting and canceling
    search, no-match restoration, boundary clamping, footer hints,
    case-insensitive highlighting, local duplicate skipping, and persistent
    duplicate skipping through async responses. Snapshot coverage captures
    the footer-mode visual changes. Local verification used `just fmt`,
    `cargo test -p codex-tui history_search`, `cargo test -p codex-tui`, and
    `just fix -p codex-tui`.
  • Mirror user text into realtime (#17520)
    - Let typed user messages submit while realtime is active and mirror
    accepted text into the realtime text stream.
    - Add integration coverage and snapshot for outbound realtime text.
  • Restore codex-tui resume hint on exit (#17415)
    Addresses #17303
    
    Problem: The standalone codex-tui entrypoint only printed token usage on
    exit, so resumable sessions could omit the codex resume footer even when
    thread metadata was available.
    
    Solution: Format codex-tui exit output from AppExitInfo so it includes
    the same resume hint as the main CLI and reports fatal exits
    consistently.
  • Clear /ps after /stop (#17416)
    Addresses #17311
    
    Problem: `/stop` stops background terminals, but `/ps` can still show
    stale entries because the TUI process cache is cleared only after later
    exec end events arrive.
    
    Solution: Clear the TUI's tracked unified exec process list and footer
    immediately when `/stop` submits background terminal cleanup.
  • Support prolite plan type (#17419)
    Addresses #17353
    
    Problem: Codex rate-limit fetching failed when the backend returned the
    new `prolite` subscription plan type.
    
    Solution: Add `prolite` to the backend/account/auth plan mappings, keep
    unknown WHAM plan values decodable, and regenerate app-server plan
    schemas.
  • Handle closed TUI input stream as shutdown (#17430)
    Addresses #17276
    
    Problem: Closing the terminal while the TUI input stream is pending
    could leave the app outside the normal shutdown path, which is risky
    when an approval prompt is active.
    
    Solution: Treat a closed TUI input stream as ShutdownFirst so existing
    thread shutdown behavior cancels pending work and approvals before exit.
  • fix(tui): recall accepted slash commands locally (#17336)
    # TL;DR
    
    - Adds recognized slash commands to the TUI's local in-session recall
    history.
    - This is the MVP of the whole feature: it keeps slash-command recall
    local only: nothing is written to persistent history, app-server
    history, or core history storage.
    - Treats slash commands like submitted text once they parse as a known
    built-in command, regardless of whether command dispatch later succeeds.
    
    # Problem
    
    Slash commands are handled outside the normal message submission path,
    so they could clear the composer without becoming part of the local
    Up-arrow recall list. That made command-heavy workflows awkward: after
    running `/diff`, `/rename Better title`, `/plan investigate this`, or
    even a valid command that reports a usage error, users had to retype the
    command instead of recalling and editing it like a normal prompt.
    
    The goal of this PR is to make slash commands feel like submitted input
    inside the current TUI session while keeping the change deliberately
    local. This is not persistent history yet; it only affects the
    composer's in-memory recall behavior.
    
    # Mental model
    
    The composer owns draft state and local recall. When slash input parses
    as a recognized built-in command, the composer stages the submitted
    command text before returning `InputResult::Command` or
    `InputResult::CommandWithArgs`. `ChatWidget` then dispatches the command
    and records the staged entry once dispatch returns to the input-result
    path.
    
    Command-name recognition is the only validation before local recall. A
    valid slash command is recallable whether it succeeds, fails with a
    usage error, no-ops, is unavailable while a task is running, or is
    skipped by command-specific logic. An unrecognized slash command is
    different: it is restored as a draft, surfaces the existing
    unrecognized-command message, and is not added to recall.
    
    Bare commands recalled from typed text use the trimmed submitted draft.
    Commands selected from the popup record the canonical command text, such
    as `/diff`, rather than the partial filter text the user typed. Inline
    commands with arguments keep the original command invocation available
    locally even when their arguments are later prepared through the normal
    submission pipeline.
    
    # Non-goals
    
    Persisting slash commands across sessions is intentionally out of scope.
    This change does not modify app-server history, core history storage,
    protocol events, or message submission semantics.
    
    This does not change command availability, command side effects, popup
    filtering, command parsing, or the semantics of unsupported commands. It
    only changes whether recognized slash-command invocations are available
    through local Up-arrow recall after the user submits them.
    
    # Tradeoffs
    
    The main tradeoff is that recall is based on command recognition, not
    command outcome. This intentionally favors a simpler user model: if the
    TUI accepted the input as a slash command, the user can recall and edit
    that input just like plain text. That means valid-but-unsuccessful
    invocations such as usage errors are recallable, which is useful when
    the next action is usually to edit and retry.
    
    The previous accept/reject design required command dispatch to report a
    boolean outcome, which made the dispatcher API noisier and forced every
    branch to decide history behavior. This version keeps the dispatch APIs
    as side-effect-only methods and localizes history recording to the
    slash-command input path.
    
    Inline command handling still avoids double-recording by preparing
    inline arguments without using the normal message-submission history
    path. The staged slash-command entry remains the single local recall
    record for the command invocation.
    
    # Architecture
    
    `ChatComposer` stages a pending `HistoryEntry` when recognized
    slash-command input is promoted into an input result. The pending entry
    mirrors the existing local history payload shape so recall can restore
    text elements, local images, remote images, mention bindings, and
    pending paste state when those are present.
    
    `BottomPane` exposes a narrow method for recording that staged command
    entry because it owns the composer. `ChatWidget` records the staged
    entry after dispatching a recognized command from the input-result
    match. Valid commands rejected before they reach `ChatWidget`, such as
    commands unavailable while a task is running, are staged and recorded in
    the composer path that detects the rejection.
    
    Slash-command dispatch itself now lives in
    `chatwidget/slash_dispatch.rs` so the behavior is reviewable without
    adding more weight to `chatwidget.rs`. The extraction is
    behavior-preserving: the dispatch match arms stay intact, while the
    input flow in `chatwidget.rs` remains the single place that connects
    submitted slash-command input to dispatch.
    
    # Observability
    
    There is no new logging because this is a local UI recall behavior and
    the result is directly visible through Up-arrow recall. The practical
    debug path is to trace Enter through
    `ChatComposer::try_dispatch_bare_slash_command`,
    `ChatComposer::try_dispatch_slash_command_with_args`, or popup Enter/Tab
    handling, then confirm the recognized command is staged before dispatch
    and recorded exactly once afterward.
    
    If a valid command unexpectedly does not appear in recall, check whether
    the input path staged slash history before clearing the composer and
    whether it used the `ChatWidget` slash-dispatch wrapper. If an
    unrecognized command unexpectedly appears in recall, check the parser
    branch that should restore the draft instead of staging history.
    
    # Tests
    
    Composer-level tests cover staging and recording for a bare typed slash
    command, a popup-selected command, and an inline command with arguments.
    
    Chat-widget tests cover valid commands being recallable after normal
    dispatch, inline dispatch, usage errors, task-running unavailability,
    no-op stub dispatch, and command-specific skip behavior such as `/init`
    when an instructions file already exists. They also cover the negative
    case: unrecognized slash commands are not added to local recall.
  • Pass turn id with feedback uploads (#17314)
    ## Summary
    - Add an optional `tags` dictionary to feedback upload params.
    - Capture the active app-server turn id in the TUI and submit it as
    `tags.turn_id` with `/feedback` uploads.
    - Merge client-provided feedback tags into Sentry feedback tags while
    preserving reserved system fields like `thread_id`, `classification`,
    `cli_version`, `session_source`, and `reason`.
    
    ## Behavior / impact
    Existing feedback upload callers remain compatible because `tags` is
    optional and nullable. The wire shape is still a normal JSON object /
    TypeScript dictionary, so adding future feedback metadata will not
    require a new top-level protocol field each time. This change only adds
    feedback metadata for Codex CLI/TUI uploads; it does not affect existing
    pipelines, DAGs, exports, or downstream consumers unless they choose to
    read the new `turn_id` feedback tag.
    
    ## Tests
    - `cargo fmt -- --config imports_granularity=Item` passed; stable
    rustfmt warned that `imports_granularity` is nightly-only.
    - `cargo run -p codex-app-server-protocol --bin write_schema_fixtures`
    - `cargo test -p codex-feedback
    upload_tags_include_client_tags_and_preserve_reserved_fields`
    - `cargo test -p codex-app-server-protocol
    schema_fixtures_match_generated`
    - `cargo test -p codex-tui build_feedback_upload_params`
    - `cargo test -p codex-tui
    live_app_server_turn_started_sets_feedback_turn_id`
    - `cargo check -p codex-app-server --tests`
    - `git diff --check`
    
    ---------
    
    Co-authored-by: Codex <noreply@openai.com>
  • Fix thread/list cwd filtering for Windows verbatim paths (#17414)
    Addresses #17302
    
    Problem: `thread/list` compared cwd filters with raw path equality, so
    `resume --last` could miss Windows sessions when the saved cwd used a
    verbatim path form and the current cwd did not.
    
    Solution: Normalize cwd comparisons through the existing path comparison
    utilities before falling back to direct equality, and add Windows
    regression coverage for verbatim paths. I made this a general utility
    function and replaced all of the duplicated instance of it across the
    code base.
  • TUI: enforce core boundary (#17399)
    Problem: The TUI still depended on `codex-core` directly in a number of
    places, and we had no enforcement from keeping this problem from getting
    worse.
    
    Solution: Route TUI core access through
    `codex-app-server-client::legacy_core`, add CI enforcement for that
    boundary, and re-export this legacy bridge inside the TUI as
    `crate::legacy_core` so the remaining call sites stay readable. There is
    no functional change in this PR — just changes to import targets.
    
    Over time, we can whittle away at the remaining symbols in this legacy
    namespace with the eventual goal of removing them all. In the meantime,
    this linter rule will prevent us from inadvertently importing new
    symbols from core.
  • representing guardian review timeouts in protocol types (#17381)
    ## Summary
    
    - Add `TimedOut` to Guardian/review carrier types:
      - `ReviewDecision::TimedOut`
      - `GuardianAssessmentStatus::TimedOut`
      - app-server v2 `GuardianApprovalReviewStatus::TimedOut`
    - Regenerate app-server JSON/TypeScript schemas for the new wire shape.
    - Wire the new status through core/app-server/TUI mappings with
    conservative fail-closed handling.
    - Keep `TimedOut` non-user-selectable in the approval UI.
    
    **Does not change runtime behavior yet; emitting `TimeOut` and
    parent-model timeout messaging will come in followup PRs**
  • fix(permissions): fix symlinked writable roots in sandbox permissions (#15981)
    ## Summary
    - preserve logical symlink paths during permission normalization and
    config cwd handling
    - bind real targets for symlinked readable/writable roots in bwrap and
    remap carveouts and unreadable roots there
    - add regressions for symlinked carveouts and nested symlink escape
    masking
    
    ## Root cause
    Permission normalization canonicalized symlinked writable roots and cwd
    to their real targets too early. That drifted policy checks away from
    the logical paths the sandboxed process can actually address, while
    bwrap still needed the real targets for mounts. The mismatch caused
    shell and apply_patch failures on symlinked writable roots.
    
    ## Impact
    Fixes #15781.
    
    Also fixes #17079:
    - #17079 is the protected symlinked carveout side: bwrap now binds the
    real symlinked writable-root target and remaps carveouts before masking.
    
    Related to #15157:
    - #15157 is the broader permission-check side of this path-identity
    problem. This PR addresses the shared logical-vs-canonical normalization
    issue, but the reported Darwin prompt behavior should be validated
    separately before auto-closing it.
    
    This should also fix #14672, #14694, #14715, and #15725:
    - #14672, #14694, and #14715 are the same Linux
    symlinked-writable-root/bwrap family as #15781.
    - #15725 is the protected symlinked workspace path variant; the PR
    preserves the protected logical path in policy space while bwrap applies
    read-only or unreadable treatment to the resolved target so
    file-vs-directory bind mismatches do not abort sandbox setup.
    
    ## Notes
    - Added Linux-only regressions for symlinked writable ancestors and
    protected symlinked directory targets, including nested symlink escape
    masking without rebinding the escape target writable.
    
    ---------
    
    Co-authored-by: Codex <noreply@openai.com>
  • Revert "Option to Notify Workspace Owner When Usage Limit is Reached" (#17391)
    Reverts openai/codex#16969
    
    #sev3-2026-04-10-accountscheckversion-500s-for-openai-workspace-7300
  • fix(guardian, app-server): introduce guardian review ids (#17298)
    ## Description
    
    This PR introduces `review_id` as the stable identifier for guardian
    reviews and exposes it in app-server `item/autoApprovalReview/started`
    and `item/autoApprovalReview/completed` events.
    
    Internally, guardian rejection state is now keyed by `review_id` instead
    of the reviewed tool item ID. `target_item_id` is still included when a
    review maps to a concrete thread item, but it is no longer overloaded as
    the review lifecycle identifier.
    
    ## Motivation
    
    We'd like to give users the ability to preempt a guardian review while
    it's running (approve or decline).
    
    However, we can't implement the API that allows the user to override a
    running guardian review because we didn't have a unique `review_id` per
    guardian review. Using `target_item_id` is not correct since:
    - with execve reviews, there can be multiple execve calls (and therefore
    guardian reviews) per shell command
    - with network policy reviews, there is no target item ID
    
    The PR that actually implements user overrides will use `review_id` as
    the stable identifier.
  • Support clear SessionStart source (#17073)
    ## Motivation
    
    The `SessionStart` hook already receives `startup` and `resume` sources,
    but sessions created from `/clear` previously looked like normal startup
    sessions. This makes it impossible for hook authors to distinguish
    between these with the matcher.
    
    ## Summary
    
    - Add `InitialHistory::Cleared` so `/clear`-created sessions can be
    distinguished from ordinary startup sessions.
    - Add `SessionStartSource::Clear` and wire it through core, app-server
    thread start params, and TUI clear-session flow.
    - Update app-server protocol schemas, generated TypeScript, docs, and
    related tests.
    
    
    https://github.com/user-attachments/assets/9cae3cb4-41c7-4d06-b34f-966252442e5c