Skip to content

tui: check the model secret parse-only at startup - #169

Open
nishu-builder wants to merge 1 commit into
mainfrom
claude/tui-startup-latency-upbs92-p1
Open

tui: check the model secret parse-only at startup#169
nishu-builder wants to merge 1 commit into
mainfrom
claude/tui-startup-latency-upbs92-p1

Conversation

@nishu-builder

@nishu-builder nishu-builder commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Stack 1/2 (base for #170 — the sidebar-metadata cache).

Problem

Starting caos tui resolved the whole secret store before the first draw: build_secret_store ingests the workspace tree and eval-paths every reader= expression, and resolving DEEP-DEPS/llm-step dispatches real computation — the deepening run re-keyed by any tracked edit, plus rustc worker builds whenever llm-step's inputs (std/llm-*, their tool deps, rust/crates/conversation-protocol) changed. After such a build the tui sat on a blank terminal for the whole compile (~30s observed), answering a question startup never asked: it only needs to know whether an anthropic-api-key secret is configured.

Change

Split the store loader:

  • caos: new load_local_secrets — the transport-free half of build_secret_store (specs parsed, values read, readers left as the declared expressions) — and local_secret_names on top of it. build_secret_store now consumes the shared loader, so the two can never disagree on what the store declares.
  • caos-cli: model_secret_missing() and ensure_conversation_secret() are parse-only and no longer take a transport; require_model_secret generalizes over names. The first-run setup's post-install proof is parse-only too.
  • A malformed spec or unreadable value file still fails readably at the shell prompt. Reader resolution moves entirely to the turn that sends a request — behind the tui's progress UI, where build_secret_store remains the loader (conversation_secret_store).
  • TUI.md updated to describe the parse-only check.

Validation

  • cargo check --workspace clean; cargo fmt --check clean; clippy shows only a pre-existing chunks_exact warning in untouched code.
  • Full caos (32), caos-cli lib (51) and tui bin (138) suites green, including two new tests for the parse-only loader (reads specs/values without resolving readers; fails loudly on a missing value file).
  • Not run here (no nix / no stack in this environment): nix build and the salted run-tool test gate — no new files or include_str!s are added, but worth a salted run before merge.

🤖 Generated with Claude Code

https://claude.ai/code/session_01AZgAh1BJk17ge3SasEaCJJ

Starting the tui resolved the whole secret store before the first draw:
build_secret_store ingests the workspace tree and eval-paths every
reader= expression, and resolving DEEP-DEPS/llm-step dispatches real
computation — the deepening run re-keyed by any tracked edit, plus rustc
worker builds whenever llm-step's inputs (std/llm-*, their tool deps,
rust/crates/conversation-protocol) changed. After such a build the tui
sat on a blank terminal for the whole compile, ~30s observed, answering
a question startup never asked: it only needs to know whether an
anthropic-api-key secret is CONFIGURED.

Split the store loader instead: load_local_secrets reads specs and
values (the transport-free half), local_secret_names exposes it, and
the startup checks — model_secret_missing, ensure_conversation_secret,
the first-run setup's post-install proof — are parse-only. A malformed
spec or unreadable value file still fails at the shell prompt; reader
resolution moves to the turn that sends a request, behind the tui's
progress UI, where build_secret_store remains the loader.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AZgAh1BJk17ge3SasEaCJJ
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.

2 participants