Skip to content

feat(tui): model picker, thinking level, slash-command menu - #508

Merged
ajianaz merged 1 commit into
developfrom
feat/tui-picker
Nov 4, 2026
Merged

ajianaz merged 1 commit into
developfrom
feat/tui-picker

Conversation

@ajianaz

@ajianaz ajianaz commented Nov 4, 2026

Copy link
Copy Markdown
Contributor

What (description of the change)

TUI model picker, thinking level, slash-command menu (#461, epic #464 Phase 1 close-out):

  • /model + Ctrl+L: picker over /models (fetch_model_ids via the host), sets the session fact/model register; Ctrl+P cycles the models used this run. /thinking [level] + Shift+Tab (BackTab — cannot collide with Shift+Enter, unit-tested on the key dispatch): cycles minimal -> low -> medium -> high -> unset; /thinking unset deletes the register so the footer shows the process default again; the editor top border shows thinking: <level>.
  • Slash-command menu on / with filter-as-you-type (prefix/substring, no fuzzy — deferred): /compact [instructions], /new, /resume (newest 50), /session (SessionStatus lines), /name, /quit. Tab completes, Up/Down select, Enter runs, unknown commands refused with a hint. A bare /word draft opens the menu.
  • Register semantics: switches affect the NEXT provider call and survive resume (asserted end-to-end). /name writes fact/session_name; JsonlStorage::session_name() prefers it over the header, so sessions --all and resume <name> pick it up.
  • /new + /resume swap the session in place (new handle opens BEFORE the old drops — writer-lock storage: no cross-process writer exclusion — a second writer corrupts the session file (live repro) #475 contract; switching to the already-open id is a no-op).
  • /compact calls mark_overflow, so the next prompt runs the compaction: the fleet gateway reports no context window, so compaction is silently off; no overflow recovery #481 forced pass; there is NO mid-turn compaction (contract held). [instructions] is accepted but reported as ignored (compaction::compact has no instructions parameter — honest limitation, deferred).
  • Everything rendered goes through the sanitize module (model ids, session names, menu text). Ctrl+L/Ctrl+P/Shift+Tab do nothing while a turn runs (session lock); an open picker captures all keys. TuiHost grew default-method hooks — existing hosts keep compiling.
  • Deferred (explicit): /resume paging beyond 50, transcript replay after /new//resume, todo-tool state after a swap, /compact instructions, fuzzy suggestions.

Why (the problem you're solving)

Closes #461 — model and thinking level must be visible and switchable in the TUI, plus the everyday session commands; this closes Phase 1 of the TUI epic (#464).

Testing (how you verified this works)

  • RED first: menu/editor/host state-machine tests failed to compile (missing HostCmd/menu/with_sessions etc.), then green; key-dispatch unit test proves BackTab (Shift+Tab) and Shift+Enter are distinct paths.
  • Acceptance pty e2e tui_model_picker_and_thinking_reach_the_next_request_and_survive_resume: switch model via the picker -> mock asserts the next request's model id; /thinking low -> next request carries reasoning_effort: low (and the baseline request carries none); then tole resume confirms both registers persisted. Orchestrator re-ran the e2e suite: 4 passed / 0 failed.
  • Gates run by the implementer AND independently re-run by the orchestrator (own target dir): fmt clean; clippy --workspace --all-targets -- -D warnings clean; cargo test --workspace --no-fail-fast 1071 passed / 0 failed; bare profile 893 / 0; cargo build -p tole-cli both profiles OK; attribution grep 0 hits.
  • Honest caveats: the /models fetch blocks the UI up to 3 s (existing timeout — synchronous, by design for now); compaction progress still prints to stderr; editor text typed by the user is echoed through sanitize but the buffer itself is not sanitized (user's own keystrokes).

@github-actions

github-actions Bot commented Nov 4, 2026

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

@ajianaz
ajianaz merged commit eac0df2 into develop Nov 4, 2026
16 checks passed
@ajianaz
ajianaz deleted the feat/tui-picker branch November 4, 2026 03:34
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.

feat(tui): model picker, thinking level, slash-command menu

1 participant