Skip to content

feat(tui): open the TUI without a model or credential and say what to do (OB1, OB2) - #136

Merged
lg2m merged 5 commits into
mainfrom
feat/eng-860-tui-without-model
Sep 23, 2026
Merged

lg2m merged 5 commits into
mainfrom
feat/eng-860-tui-without-model

Conversation

@lg2m

@lg2m lg2m commented Sep 23, 2026

Copy link
Copy Markdown
Collaborator

OB1 + OB2: the TUI opens without a model or credential and says what to do

Spec: docs/plans/onboarding-ux.md#ob1, #ob2 Linear: ENG-860, ENG-876 (parent ENG-875)

What changes for users

  • Bare qq with a configuration that only lacks model: now opens the TUI instead of exiting. Top row shows no model; the composer rule says choose a model with /models; /models lists every authenticated built-in and Ctrl-N creates the first session with the pick.
  • Bare qq with a model whose provider has no credential opens and the empty state names the fix: openai needs a credential: run qq auth login openai or set OPENAI_API_KEY (per-provider text; codex has no env var; bedrock names the AWS chain). /models with nothing authenticated lists built-ins greyed as needs credential <remedy> instead of no authenticated providers have selectable models. Alt-N on an unauthenticated model warns with the same remedy.
  • qq ask / qq run / qq serve / plan compile are unchanged: they still fail fast with the actionable no model is configured message.

Design

  • qq-config: MergeState::finish → finish_for_client returning a ClientSnapshot (model: Option<ModelRoute> plus providers/policy/max_output_tokens/organization/source_reports); ClientSnapshot::require_model produces ConfigSnapshot or ModelRequired. load() = load_for_client()?.require_model(), so every headless contract is byte-identical. No placeholder route inside ConfigSnapshot.
  • runtime: a borrowed CatalogSource<'a> feeds the one model_options_with_discovery; the "append configured route" branch is conditional. New load_for_client, client_model_options, unauthenticated_providers -> Vec<ProviderRemedy>. Server ListModels uses the model-optional load. Isolated TUI QA still requires its pinned route.
  • qq-tui: TuiOptions.unauthenticated_providers (TUI-local; no protocol change). ModelRow.index: Option<usize> — None rows are never selectable.
  • Credentials are read once at startup; adding a key while the TUI runs needs a relaunch (documented).

How verified

  • fmt, clippy -D warnings, cargo test --workspace (qq-config 94, qq bin 178, qq-tui 317).
  • New: load_for_client_tolerates_a_missing_model_and_keeps_every_other_field; served_catalog_does_not_require_a_configured_model; unauthenticated_builtins_carry_a_remedy_and_authenticated_ones_do_not; create_with_an_unauthenticated_configured_model_warns_with_the_remedy; models_picker_lists_unauthenticated_builtins_and_never_creates_a_session; a_client_without_a_model_points_at_the_picker_until_one_is_chosen; empty_state_names_the_missing_credential_for_the_configured_model; a_client_without_a_model_shows_no_model_and_the_picker_hint; model_picker_renders_needs_credential_rows_when_nothing_is_authenticated.
  • Manual in a pty (script) with empty XDG_CONFIG_HOME: QQ_CONFIG_CONTENT='(version: 1)' paints no model + picker hint; model: "openai/gpt-5.6" with no key paints the openai remedy; qq ask/qq run under (version: 1) still exit 1/2 with the full message.

Docs

docs/guide/quickstart.md, tui.md, troubleshooting.md; docs/design/architecture.md (configuration loading); ledger.

Compatibility

PROTOCOL / DESCRIPTOR / schema unchanged. Startup-only code; no hot path.

Follow-ups

Built-ins whose credential is overridden by an explicit SecretRef in config get no remedy row (the built-in remedy would point at the wrong place); listing needs credential: set MY_KEY for those is a small follow-up.

Split the loader's final step so that interactive clients can load a
valid configuration that lacks only `model`. `ConfigLoader::load_for_client`
returns a `ClientSnapshot` with `model() -> Option<&ModelRoute>` and the
fields model discovery needs; `load` is unchanged for every headless path
and still fails with `ModelRequired`.

OB1 (ENG-860).
`RuntimeFactory::load_for_client` and `client_model_options` build the
catalog from a `ClientSnapshot`, so `models_for` (server `ListModels`)
and TUI startup no longer fail with `ModelRequired`; the "append the
configured route" branch is conditional on the route existing.
`unauthenticated_providers` lists admitted built-ins without a credential
with the remedy (`run qq auth login <id> or set <ENV_VAR>`). Plan
compilation keeps using `ConfigSnapshot` through a shared `CatalogSource`.

OB1 (ENG-860), OB2 (ENG-876).
Without a client default the top row shows `no model` and the composer
rule reads `choose a model with /models` until one is chosen. When the
configured model's provider has no credential, the empty state reads
`<provider> needs a credential: run qq auth login <provider> or set
<ENV_VAR>` above the Alt-N hint, Alt-N warns with the same text, and
`/models` lists the unauthenticated built-ins as greyed `needs credential`
rows instead of `no authenticated providers have selectable models`.

`TuiOptions.unauthenticated_providers: Vec<ProviderRemedy>` is TUI-local;
no protocol change.

OB1 (ENG-860), OB2 (ENG-876).
`interactive()` uses the model-optional client load. With no model the
TUI starts with an empty selection and `InitialSession::Existing`; with a
model whose provider lacks a credential the route is kept as the client
default so the TUI can name the credential. Headless `ask`/`run`/`serve`
still fail fast with `ModelRequired`.

OB1 (ENG-860), OB2 (ENG-876).
Quickstart § 4 and the TUI guide explain the two incomplete-configuration
states and their in-TUI guidance; troubleshooting replaces the two
"planned (OB2)" entries with the actual strings; architecture notes the
client-startup model-optional load. Ledger: OB1 and OB2 to In review.

OB1 (ENG-860), OB2 (ENG-876).
@lg2m
lg2m merged commit b19589e into main Sep 23, 2026
4 checks passed
@lg2m
lg2m deleted the feat/eng-860-tui-without-model branch September 23, 2026 04:01
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