Commit Graph

9 Commits

  • Rename tui_app_server to tui (#16104)
    This is a follow-up to https://github.com/openai/codex/pull/15922. That
    previous PR deleted the old `tui` directory and left the new
    `tui_app_server` directory in place. This PR renames `tui_app_server` to
    `tui` and fixes up all references.
  • Remove the legacy TUI split (#15922)
    This is the part 1 of 2 PRs that will delete the `tui` /
    `tui_app_server` split. This part simply deletes the existing `tui`
    directory and marks the `tui_app_server` feature flag as removed. I left
    the `tui_app_server` feature flag in place for now so its presence
    doesn't result in an error. It is simply ignored.
    
    Part 2 will rename the `tui_app_server` directory `tui`. I did this as
    two parts to reduce visible code churn.
  • TUI: fix request_user_input wrapping for long option labels (#11123)
    ## Summary
    
    This PR fixes long-text rendering in the `request_user_input` TUI
    overlay while preserving a clear two-column option layout. (Issue
    https://github.com/openai/codex/issues/11093)
    
    Before:
    - very long option labels could push description text into a narrow
    right-edge strip
    - option labels were effectively single-line when descriptions were
    present, causing truncation/poor readability
    - label and description wrapping interacted in one combined wrapped line
    
    <img width="504" height="409" alt="Screenshot 2026-02-08 at 2 27 25 PM"
    src="https://github.com/user-attachments/assets/a9afd108-d792-4522-bce1-e43b3cce882b"
    />
    
    After:
    - option labels wrap inside the left column
    - descriptions wrap independently inside the right column
    - row measurement and row rendering use the same wrapping path, so
    layout stays stable
    
    <img width="582" height="211" alt="Screenshot 2026-02-09 at 10 28 02 AM"
    src="https://github.com/user-attachments/assets/47885a1c-07e5-4b0f-b992-032b149f1b0d"
    />
    
    ## Problem
    
    `request_user_input` needs to handle verbose prompts/options. With
    oversized labels:
    - descriptions could collapse into a thin, hard-to-read column
    - important label context was lost
    
    ## Root Cause
    
    In shared row rendering (`selection_popup_common`):
    - rows were wrapped as a single combined line
    - auto column sizing could still place `desc_col` too far right for long
    labels
    - `request_user_input` rows did not provide wrap metadata to align
    continuation lines after the option prefix
    
    ## What Changed
    
    ### 1) `request_user_input` rows opt into wrapped labels
    File: `codex-rs/tui/src/bottom_pane/request_user_input/mod.rs`
    
    - In `option_rows()`, compute the rendered option prefix (`› 1. ` / ` 2.
    `) and set `wrap_indent` from its display width.
    - Apply the same behavior to the synthetic “None of the above” row.
    - Add long-text snapshot test coverage
    (`question_with_very_long_option_text` +
    `request_user_input_long_option_text_snapshot`).
    
    ### 2) Shared renderer now has an opt-in two-column wrapping path
    File: `codex-rs/tui/src/bottom_pane/selection_popup_common.rs`
    
    - Add focused helpers:
      - `should_wrap_name_in_column`
      - `wrap_two_column_row`
      - `wrap_standard_row`
      - `wrap_row_lines`
      - `apply_row_state_style`
    - For opted-in rows (plain option rows with `wrap_indent` +
    description), wrap label and description independently in their own
    columns.
    - Keep the legacy standard wrapping path for non-opted rows.
    - Use the same `wrap_row_lines` function in both rendering and height
    measurement to keep them in sync.
    
    ### 3) Keep column sizing simple and derived from existing fixed split
    constants
    File: `codex-rs/tui/src/bottom_pane/selection_popup_common.rs`
    
    - Keep fixed mode at `3/10` left column (`30/70` split).
    - In auto modes, cap label width using those same fixed constants (max
    70% label, min 30% description), instead of extra special-case
    constants/branches.
    - Add/keep narrow-width safety guard in `wrap_two_column_row` so
    extremely small widths do not panic.
    
    ### 4) Snapshot coverage
    File: `codex-rs/tui/src/bottom_pane/request_user_input/snapshots/
    
    codex_tui__bottom_pane__request_user_input__tests__request_user_input_long_option_text.snap`
    
    - Add snapshot for long-label/long-description two-column rendering
    behavior.
  • Better handling skill depdenencies on ENV VAR. (#9017)
    An experimental flow for env var skill dependencies. Skills can now
    declare required env vars in SKILL.md; if missing, the CLI prompts the
    user to get the value, and Core will store it in memory (eventually to a
    local persistent store)
    <img width="790" height="169" alt="image"
    src="https://github.com/user-attachments/assets/cd928918-9403-43cb-a7e7-b8d59bcccd9a"
    />
  • Refine request_user_input TUI interactions and option UX (#10025)
    ## Summary
    Overhaul the ask‑user‑questions TUI to support “Other/None” answers,
    better notes handling, improved option selection
    UX, and a safer submission flow with confirmation for unanswered
    questions.
    
    Multiple choice (number keys for quick selection, up/down or jk for
    cycling through options):
    <img width="856" height="169" alt="Screenshot 2026-01-27 at 7 22 29 PM"
    src="https://github.com/user-attachments/assets/cabd1b0e-25e0-4859-bd8f-9941192ca274"
    />
    
    Tab to add notes:
    <img width="856" height="197" alt="Screenshot 2026-01-27 at 7 22 45 PM"
    src="https://github.com/user-attachments/assets/a807db5e-e966-412c-af91-6edc60062f35"
    />
    
    Freeform (also note enter tooltip is highlighted on last question to
    indicate questions UI will be exited upon submission):
    <img width="854" height="112" alt="Screenshot 2026-01-27 at 7 23 13 PM"
    src="https://github.com/user-attachments/assets/2e7b88bf-062b-4b9f-a9da-c9d8c8a59643"
    />
    
    Confirmation dialogue (submitting with unanswered questions):
    <img width="854" height="126" alt="Screenshot 2026-01-27 at 7 23 29 PM"
    src="https://github.com/user-attachments/assets/93965c8f-54ac-45bc-a660-9625bcd101f8"
    />
    
    ## Key Changes
    - **Options UI refresh**
    - Render options as numbered entries; allow number keys to select &
    submit.
    - Remove “Option X/Y” header and allow the question UI height to expand
    naturally.
    - Keep spacing between question, options, and notes even when notes are
    visible.
    - Hide the title line and render the question prompt in cyan **only when
    uncommitted**.
    
    - **“Other / None of the above” support**
      - Wire `isOther` to add “None of the above”.
      - Add guidance text: “Optionally, add details in notes (tab).”
    
    - **Notes composer UX**
    - Remove “Notes” heading; place composer directly under the selected
    option.
    - Preserve pending paste placeholders across question navigation and
    after submission.
      - Ctrl+C clears notes **only when the notes composer has focus**.
      - Ctrl+C now triggers an immediate redraw so the clear is visible.
    
    - **Committed vs uncommitted state**
      - Introduce a unified `answer_committed` flag per question.
    - Editing notes (including adding text or pastes) marks the answer
    uncommitted.
    - Changing the option highlight (j/k, up/down) marks the answer
    uncommitted.
      - Clearing options (Backspace/Delete) also clears pending notes.
      - Question prompt turns cyan only when the answer is uncommitted.
    
    - **Submission safety & confirmation**
      - Only submit notes/freeform text once explicitly committed.
    - Last-question submit with unanswered questions shows a confirmation
    dialog.
      - Confirmation options:
        1. **Proceed** (default)
        2. **Go back**
      - Description reflects count: “Submit with N unanswered question(s).”
      - Esc/Backspace in confirmation returns to first unanswered question.
      - Ctrl+C in confirmation interrupts and exits the overlay.
    
    - **Footer hints**
    - Cyan highlight restored for “enter to submit answer” / “enter to
    submit all”.
    
    ## Codex author
    `codex fork 019c00ed-323a-7000-bdb5-9f9c5a635bd9`
  • Ask user question UI footer improvements (#9949)
    ## Summary
    
    Polishes the `request_user_input` TUI overlay
    
    Question 1 (unanswered)
    <img width="853" height="167" alt="Screenshot 2026-01-27 at 1 30 09 PM"
    src="https://github.com/user-attachments/assets/3c305644-449e-4e8d-a47b-d689ebd8702c"
    />
    
    Tab to add notes
    <img width="856" height="198" alt="Screenshot 2026-01-27 at 1 30 25 PM"
    src="https://github.com/user-attachments/assets/0d2801b0-df0c-49ae-85af-e6d56fc2c67c"
    />
    
    Question 2 (unanswered)
    <img width="854" height="168" alt="Screenshot 2026-01-27 at 1 30 55 PM"
    src="https://github.com/user-attachments/assets/b3723062-51f9-49c9-a9ab-bb1b32964542"
    />
    
    Ctrl+p or h to go back to q1 (answered)
    <img width="853" height="195" alt="Screenshot 2026-01-27 at 1 31 27 PM"
    src="https://github.com/user-attachments/assets/c602f183-1c25-4c51-8f9f-e565cb6bd637"
    />
    
    Unanswered freeform
    <img width="856" height="126" alt="Screenshot 2026-01-27 at 1 31 42 PM"
    src="https://github.com/user-attachments/assets/7e3d9d8b-820b-4b9a-9ef2-4699eed484c5"
    />
    
    ## Key changes
    
    - Footer tips wrap at tip boundaries (no truncation mid‑tip); footer
    height scales to wrapped tips.
    - Keep tooltip text as Esc: interrupt in all states.
    - Make the full Tab: add notes tip cyan/bold when applicable; hide notes
    UI by default.
    - Notes toggling/backspace:
    - Tab opens notes when an option is selected; Tab again clears notes and
    hides the notes UI.
        - Backspace in options clears the current selection.
        - Backspace in empty notes closes notes and returns to options.
    - Selection/answering behavior:
    - Option questions highlight a default option but are not answered until
    Enter.
    - Enter no longer auto‑selects when there’s no selection (prevents
    accidental answers).
        - Notes submission can commit the selected option when present.
    - Freeform questions require Enter with non‑empty text to mark answered;
    drafts are not submitted unless committed.
    - Unanswered cues:
        - Skipped option questions count as unanswered.
        - Unanswered question titles are highlighted for visibility.
    - Typing/navigation in options:
        - Typing no longer opens notes; notes are Tab‑only.
    - j/k move option selection; h/l switch questions (Ctrl+n/Ctrl+p still
    work).
    
    ## Tests
    
    - Added unit coverage for:
        - tip‑level wrapping
        - focus reset when switching questions with existing drafts
        - backspace clearing selection
        - backspace closing empty notes
        - typing in options does not open notes
        - freeform draft submission gating
        - h/l question navigation in options
    - Updated snapshots, including narrow footer wrap.
    
    ## Why
    
    These changes make the ask‑user‑question overlay:
    
    - safer (no silent auto‑selection or accidental freeform submission),
    - clearer (tips wrap cleanly and unanswered states stand out),
    - more ergonomic (Tab explicitly controls notes; backspace acts like
    undo/close).
    
    ## Codex author
    `codex fork 019bfc3c-2c42-7982-9119-fee8b9315c2f`
    
    ---------
    
    Co-authored-by: Ahmed Ibrahim <aibrahim@openai.com>
  • Reuse ChatComposer in request_user_input overlay (#9892)
    Reuse the shared chat composer for notes and freeform answers in
    request_user_input.
    
    - Build the overlay composer with ChatComposerConfig::plain_text.
    - Wire paste-burst flushing + menu surface sizing through the bottom
    pane.
  • Add request-user-input overlay (#9585)
    - Add request-user-input overlay and routing in the TUI