Repository navigation
feat(tui): open the TUI without a model or credential and say what to do (OB1, OB2) - #136
Merged
Merged
Conversation
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
qqwith a configuration that only lacksmodel:now opens the TUI instead of exiting. Top row showsno model; the composer rule sayschoose a model with /models;/modelslists every authenticated built-in andCtrl-Ncreates the first session with the pick.qqwith 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)./modelswith nothing authenticated lists built-ins greyed asneeds credential <remedy>instead ofno authenticated providers have selectable models.Alt-Non an unauthenticated model warns with the same remedy.qq ask/qq run/qq serve/ plan compile are unchanged: they still fail fast with the actionableno model is configuredmessage.Design
qq-config:MergeState::finish→finish_for_clientreturning aClientSnapshot(model: Option<ModelRoute>plus providers/policy/max_output_tokens/organization/source_reports);ClientSnapshot::require_modelproducesConfigSnapshotorModelRequired.load()=load_for_client()?.require_model(), so every headless contract is byte-identical. No placeholder route insideConfigSnapshot.runtime: a borrowedCatalogSource<'a>feeds the onemodel_options_with_discovery; the "append configured route" branch is conditional. Newload_for_client,client_model_options,unauthenticated_providers -> Vec<ProviderRemedy>. ServerListModelsuses 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>—Nonerows are never selectable.How verified
-D warnings,cargo test --workspace(qq-config 94, qq bin 178, qq-tui 317).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.script) with emptyXDG_CONFIG_HOME:QQ_CONFIG_CONTENT='(version: 1)'paintsno model+ picker hint;model: "openai/gpt-5.6"with no key paints the openai remedy;qq ask/qq rununder(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
SecretRefin config get no remedy row (the built-in remedy would point at the wrong place); listingneeds credential: set MY_KEYfor those is a small follow-up.