Skip to content

feat(tui): guide the first session and explain read-only denials (OB8) - #146

Merged
lg2m merged 1 commit into
mainfrom
feat/eng-882-first-session-guidance
Sep 23, 2026
Merged

lg2m merged 1 commit into
mainfrom
feat/eng-882-first-session-guidance

Conversation

@lg2m

@lg2m lg2m commented Sep 23, 2026 •

Copy link
Copy Markdown
Collaborator

Stack: #146 (OB8) → #147 (OB5) → #148 (OB9). Merge in that order; each PR is based on the previous branch and shows only its own diff. After merging one, retarget the next to main (GitHub does this automatically when the base branch is deleted on merge).

Plan slice OB8 of docs/plans/onboarding-ux.md. Linear: ENG-882.

User-visible behavior

First session shows what to try. When a workspace has exactly one session and no prompt has been sent yet, the empty transcript reads:

  Try one of these:
    /models    choose a model
    /approval  choose an approval mode
    /skills    list workspace commands and skills
    @path      mention a file in your prompt

The slash rows are read from COMMANDS, so the text cannot drift from the real command table. If the configured provider has no credential, that remedy paints directly above the list (it previously appeared only when no session was focused). Later empty sessions keep Ask QQ to begin this session.

? help on an empty composer. The composer rule advertises ? help while the composer is empty (pressing ? already opened help), and reverts to F1 help once typing starts or in approval mode.

qq run explains read-only denials. In text mode, when --approval read-only (the default) denied at least one call, stderr ends with

held calls were denied under --approval read-only; rerun with --approval auto to allow workspace edits

after the answer and before the resume hint. Exit status is unchanged. JSONL output is untouched (each denied call already carries state: denied).

Design notes

  • The try-these cell is a pure render-time predicate (sessions.len() == 1 && prompt_history.is_empty()), no new state. record_prompt runs synchronously on Enter, so the cell is gone in the same frame the pending prompt appears.
  • The denial count rides on RunEnd.denied_calls, incremented in the existing ToolCallFinished arm; the hint is gated on the approval mode so auto-mode denials (forbidden shapes, blocked hosts) don't get a misleading remedy.
  • 34 golden files re-recorded; every diff line is exactly the F1 help → ? help swap on the rule (verified by normalizing both spellings and comparing).

Docs

docs/guide/tui.md (layout diagram fixed from the never-existent ^? help; new "Your first session" paragraph), docs/guide/headless.md (denial hint under the approval table and exit codes). Ledger: OB8 → In review; OB0 → Shipped (#128); OB6 → Shipped (#139).

Verification

  • cargo fmt --all -- --check, cargo clippy --workspace --all-targets --all-features -- -D warnings
  • cargo test --workspace — 1781 passed
  • New tests: the_first_session_offers_try_these_until_the_first_prompt, a_second_empty_session_says_ask_qq_instead_of_try_these, the_try_these_cell_keeps_the_credential_remedy_above_it, text_read_only_denials_end_with_the_approval_auto_hint_before_the_resume_hint, the_denial_hint_is_silent_under_auto, the_denial_hint_is_silent_in_jsonl_where_records_carry_the_denials, the_denial_hint_is_silent_when_read_only_denied_nothing

Performance / compatibility

No hot-path change: one usize increment per finished tool call in headless; the transcript branch only runs when the body is empty. No wire or persisted format changes.

Follow-ups

  • No golden scene renders a first empty session; the cell's layout is covered by unit tests only.

The first session in a workspace shows a "Try one of these" cell naming
/models, /approval, /skills, and @path mentions; it is a pure render-time
predicate (one session, no prompt recorded) so it vanishes on the first
Enter and never appears in later sessions. The composer rule advertises
`? help` while the composer is empty, since `?` already opens help, and
returns to `F1 help` once typing starts. `qq run` in text mode ends with
"held calls were denied under --approval read-only; rerun with --approval
auto to allow workspace edits" on stderr when at least one call was
denied, before the resume hint and without changing the exit status.

Goldens re-recorded for the `F1 help` -> `? help` rule change only.

Closes ENG-882.
@lg2m
lg2m added this pull request to stack #149 September 23, 2026 22:37
@lg2m
lg2m merged commit ac61783 into main Sep 23, 2026
3 of 4 checks passed
@lg2m
lg2m deleted the feat/eng-882-first-session-guidance branch September 23, 2026 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant