Skip to content

feat(tui): add /statusline command for interactive status line configuration#10546

Merged
etraut-openai merged 63 commits intoopenai:mainfrom
fcoury:feat/status-line-builder
Feb 5, 2026
Merged

feat(tui): add /statusline command for interactive status line configuration#10546
etraut-openai merged 63 commits intoopenai:mainfrom
fcoury:feat/status-line-builder

Conversation

@fcoury
Copy link
Contributor

@fcoury fcoury commented Feb 3, 2026

Summary

  • Adds a new /statusline command to configure TUI footer status line

  • Introduces reusable MultiSelectPicker component with keyboard navigation, optional ordering and toggle support

  • Implement status line setup modal that persist configuration to config.toml

    Status Line Items

    The following items can be displayed in the status line:

    • Model: Current model name (with optional reasoning level)
    • Context: Remaining/used context window percentage
    • Rate Limits: 5-day and weekly usage limits
    • Git: Current branch (with optimized lookups)
    • Tokens: Used tokens, input/output token counts
    • Session: Session ID (full or shortened prefix)
    • Paths: Current directory, project root
    • Version: Codex version

    Features

    • Live preview while configuring status line items
    • Fuzzy search filtering in the picker
    • Intelligent truncation when items don't fit
    • Items gracefully omit when data is unavailable
    • Configuration persists to config.toml
    • Validates and warns about invalid status line items

    Test plan

    • Run /statusline and verify picker UI appears
    • Toggle items on/off and verify live preview updates
    • Confirm selection persists after restart
    • Verify truncation behavior with many items selected
    • Test git branch detection in and out of git repos

Copilot AI review requested due to automatic review settings February 3, 2026 19:58
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an interactive /statusline workflow to configure and persist a customizable TUI footer status line, including a new reusable multi-select picker UI and supporting rendering/truncation logic.

Changes:

  • Introduces /statusline slash command and a status line setup modal with live preview and ordering.
  • Implements status line rendering in the bottom pane/footer (including truncation to preserve right-side indicators) and refresh hooks in the app/widget.
  • Persists configuration to config.toml and updates config types/schema and edit helpers.

Reviewed changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
codex-rs/tui/src/text_formatting.rs Adds proper_join helper and tests used for user-facing warnings.
codex-rs/tui/src/status/rate_limits.rs Refactors reset timestamp handling for rate limit window display.
codex-rs/tui/src/status/mod.rs Exposes additional status helpers/types for status line rendering.
codex-rs/tui/src/slash_command.rs Adds Statusline slash command metadata/help text.
codex-rs/tui/src/diff_render.rs Exports diff add/remove calculator for reuse in status context.
codex-rs/tui/src/chatwidget/tests.rs Extends tests and adds new ones for status line warning/branch state behavior.
codex-rs/tui/src/chatwidget.rs Implements status line item selection/validation, rendering values, and async git branch lookup plumbing.
codex-rs/tui/src/bottom_pane/status_line_setup.rs New status line setup view powered by the multi-select picker.
codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__footer__tests__footer_status_line_truncated_with_gap.snap Snapshot coverage for status line truncation with right-side indicator.
codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__footer__tests__footer_status_line_overrides_shortcuts.snap Snapshot coverage ensuring status line overrides shortcut hints.
codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__footer__tests__footer_status_line_overrides_context.snap Snapshot coverage for status line overriding other footer content.
codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__footer__tests__footer_status_line_enabled_no_mode_right.snap Snapshot coverage for enabled status line with no mode indicator.
codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__footer__tests__footer_status_line_enabled_mode_right.snap Snapshot coverage for enabled status line with mode indicator on the right.
codex-rs/tui/src/bottom_pane/snapshots/codex_tui__bottom_pane__footer__tests__footer_status_line_disabled_context_right.snap Snapshot coverage for disabled status line preserving context indicator.
codex-rs/tui/src/bottom_pane/selection_popup_common.rs Exposes line truncation helpers for reuse by footer/status line rendering.
codex-rs/tui/src/bottom_pane/multi_select_picker.rs New reusable picker component with fuzzy filtering, ordering, preview, and callbacks.
codex-rs/tui/src/bottom_pane/mod.rs Wires new views/components and adds bottom pane status line setters.
codex-rs/tui/src/bottom_pane/footer.rs Adds status line rendering paths and truncation/layout helpers plus tests/snapshots.
codex-rs/tui/src/bottom_pane/chat_composer.rs Integrates status line display/enable flags into composer footer rendering logic.
codex-rs/tui/src/app_event.rs Adds app events for status line setup and async git branch updates.
codex-rs/tui/src/app.rs Handles new app events, persists config edits, and refreshes status line on relevant state changes.
codex-rs/core/src/config/types.rs Adds tui.status_line to config TOML types.
codex-rs/core/src/config/mod.rs Plumbs tui_status_line into runtime config and defaults/tests.
codex-rs/core/src/config/edit.rs Adds config edit helper to write/clear tui.status_line in config.toml.
codex-rs/core/config.schema.json Updates JSON schema to include tui.status_line.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@etraut-openai
Copy link
Collaborator

@codex review

Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4b9ccb6136

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@fcoury fcoury marked this pull request as draft February 3, 2026 20:42
@fcoury fcoury force-pushed the feat/status-line-builder branch from 39a913a to ebb3308 Compare February 4, 2026 14:35
@fcoury fcoury marked this pull request as ready for review February 4, 2026 14:36
@fcoury fcoury force-pushed the feat/status-line-builder branch from 5aaf2c1 to bf88ef7 Compare February 4, 2026 14:56
@etraut-openai
Copy link
Collaborator

@codex review

Copy link
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 12ba10e5b8

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Collaborator

@etraut-openai etraut-openai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! This looks really good. I appreciate the attention to detail. Nicely commented, good error handling, good structure.

I added a few really minor suggestions, but I think this is nearly ready to go. I'm going to see if joshka wants to do a quick review.

fcoury added 18 commits February 4, 2026 21:23
Adds configurable status line that executes external commands with session context.

- Add tui_status_line config option accepting command in argv form
- Implement StatusLineRunner with async execution and timeout handling
- Pass JSON payload with session_id, cwd, model, context_window, and workspace info
- Track current_cwd in ChatWidget for accurate directory reporting
- Integrate StatusLineRunner into App lifecycle
- Add comprehensive tests for command execution and error handling

Commands receive JSON on stdin and first line of stdout is rendered as status line.
- Send StatusLineUpdated events from status_line runner to UI
- Display status line content in footer when available
- Refresh status line after model/effort/collab mode changes
- Add ANSI escape parsing for styled status line output
- Thread status_line_value through ChatWidget and BottomPane
- Track lines added/removed from diffs and expose as cost metrics
- Auto-refresh status line when terminal is resized
- Increase status line command timeout to 500ms for stability
- Add tests for status line display priority over shortcuts/context
Allow users to configure status_line_timeout_ms in tui config. Show an informational warning on first timeout suggesting users increase the timeout or optimize their command. Default remains 500ms.
- Move collaboration mode indicator to right when status line enabled
- Fix swapped used/remaining percentage in status line payload
- Add debug logging for status line payload
- Update footer tests and snapshots for new layout behavior
- Add dynamic truncation of status line content to fit available width
- Intelligently choose between full and compact mode indicators based on space
- Fix width calculations to prevent footer content overflow
- Make truncation helpers public for reuse across modules
- Update test snapshots for new footer layout behavior
Properly close the stdin pipe after writing the payload to ensure
the child process receives EOF and can proceed with processing.
- Remove obsolete TODO comments for caching
- Change status line payload logging from info to debug level
- Add missing is_wsl field to footer test cases
@fcoury fcoury force-pushed the feat/status-line-builder branch from 08c599c to e76baee Compare February 5, 2026 00:30
Document status-line setup and rendering flow without behavior changes.
Clarify rate-limit display shaping and stale-data classification, plus
status-line event semantics and git-branch lookup invariants.
@joshka-oai
Copy link
Collaborator

problem

The TUI footer needed a user-configurable status line so people can choose which
session/runtime signals matter to them without hardcoding one fixed layout.
The previous setup also lacked a dedicated configuration flow and clear
handling for unavailable values (for example, branch/session-dependent data).

mental model

/statusline opens a picker that defines an ordered list of item ids persisted
in config. At render time, ChatWidget treats that list as intent, resolves
each item against current runtime data, and omits items that are temporarily
unavailable. Git branch is resolved asynchronously and cached per cwd so the
footer can stay responsive while still updating when branch data arrives.

non-goals

This change does not introduce custom external status-line commands, does not
guarantee all selected items are always visible at all times, and does not
redesign the footer collapse/truncation system beyond integrating status-line
output with existing width constraints.

tradeoffs

The design prefers omission over placeholders when data is missing, which keeps
the footer compact but can make item absence look implicit. Branch lookup is
async and guarded against stale cwd updates, which improves responsiveness but
adds state tracking complexity. Invalid configured item ids are tolerated and
warned once rather than hard-failing startup.

architecture

The feature is split across reusable and feature-specific layers:
MultiSelectPicker provides searchable, reorderable multi-select UI;
StatusLineSetupView maps picker selection to StatusLineItem; AppEvent
carries setup/branch update events; ChatWidget owns status-line orchestration
(config parsing, warning policy, branch lookup lifecycle, item rendering); and
status helpers shape rate-limit/context/token values for display. Footer
rendering remains the presentation layer and consumes the resulting line.

observability

User-visible warnings are emitted for invalid configured item ids (once per
session after thread start). Setup confirm/cancel paths emit info logs. Branch
updates flow through StatusLineBranchUpdated events, and stale async branch
results are ignored when cwd no longer matches.

tests

Validated with just fmt and cargo test -p codex-tui (full suite,
including integration/doc tests for the crate). Existing snapshot-framework
legacy-format notices remain informational and did not indicate behavioral
regressions.

design inconsistencies / risks

  • PR text says "5-day" in one place, but implementation and labels are
    5h/"5-hour".
  • Invalid status-line ids are only warned after session/thread exists;
    pre-session misconfig can stay silent.
  • tui.status_line remains free-form string ids at config boundary, so
    correctness is mostly runtime-validated rather than schema-enforced.

Copy link
Collaborator

@joshka-oai joshka-oai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Things I noted in manual testing.

  • Wasn't clear how to reorder
  • session id prefix shouldn't be there (we use the full id for linking feedback right now and resuming)
  • wasn't sure about the project item
  • used / avail tokens need some extra text (just numbers)

I pushed some extra doc comments for future maintenance

Otherwise LGTM

@fcoury
Copy link
Contributor Author

fcoury commented Feb 5, 2026

Things I noted in manual testing.

  • Wasn't clear how to reorder

I added instructions to the footer, but open to other ideas.

  • session id prefix shouldn't be there (we use the full id for linking feedback right now and resuming)

I'll take it out.

  • wasn't sure about the project item

Do you mean project-root? That's the root folder of the current project. It's a short and canonical name for the project. I added it because, in my case, when I am working with paths outside the home folder using cwd gets extremely long (see below). I always always had this single identifier when using other harnesses and they worked as a fast and reliable way to spot which project and/or worktree I was working on.

image

See codex-status-line-builder vs /Volumes/External/code-external/codex-status-line-builder/codex-rs.

  • used / avail tokens need some extra text (just numbers)

Agreed. I will use "used" and "avail" for shortness. Any concerns?

I pushed some extra doc comments for future maintenance

I got them, thank you!

OK one question, I really really liked the other comment you sent before with the problem, mental model, etc. and I have to ask: do you use AI to generate those? I would love to get something similar if you can share.

Other than that, thank you very much for the review!

@fcoury
Copy link
Contributor Author

fcoury commented Feb 5, 2026

  • used / avail tokens need some extra text (just numbers)

Actually the context used already had text, just added to all the others that were missing:

image

@joshka-oai
Copy link
Collaborator

OK one question, I really really liked the other comment you sent before with the problem, mental model, etc. and I have to ask: do you use AI to generate those? I would love to get something similar if you can share.

https://gist.github.com/joshka-oai/4262dc0a09067971738ccea774449ded

I use it for my own work and reviewing other work. Add comments either with your context and history while developing with the model's Chain of Thought available, or after without it and inferred. It's not perfect, but it's got a lot of value in accelerating from idkwtf to tillgtm

@joshka-oai
Copy link
Collaborator

Do you mean project-root? That's the root folder of the current project. It's a short and canonical name for the project. I added it because, in my case, when I am working with paths outside the home folder using cwd gets extremely long (see below). I always always had this single identifier when using other harnesses and they worked as a fast and reliable way to spot which project and/or worktree I was working on.

yep - for some reason I wasn't seeing any text on this when I tested - likely because I usually use jujutsu not git

@etraut-openai etraut-openai merged commit b0e5a63 into openai:main Feb 5, 2026
26 of 32 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Feb 5, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments