Skip to content

feat(tui): ask for project trust in the TUI instead of exiting (OB7) - #161

Merged
lg2m merged 1 commit into
feat/eng-883-docs-truthfrom
feat/eng-881-tui-trust-prompt
Sep 25, 2026
Merged

lg2m merged 1 commit into
feat/eng-883-docs-truthfrom
feat/eng-881-tui-trust-prompt

Conversation

@lg2m

@lg2m lg2m commented Sep 24, 2026 •

Copy link
Copy Markdown
Collaborator

Stack (2/3): #160 → this PR → #162. Based on feat/eng-883-docs-truth; shows only its own diff.

Plan slice OB7 of docs/plans/onboarding-ux.md. Linear: ENG-881. ADR-0042.

User-visible behavior

The last place bare qq exited instead of asking. Clone a repo with a .qq/config.ron that sets model, providers, MCP servers, or grants, run qq, and instead of an error you get the TUI on a trust prompt:

  ◇ this project's configuration needs your trust
    /home/u/repo/.qq/config.ron
      model openai/gpt-5.6
      MCP linear → https://mcp.linear.app/mcp
      grants: 1 tool
    t trust   s this session   q quit
────────────────────────────────────────────── F1 help
 ✎ Answer the trust prompt above
  • t records trust exactly as qq trust does (same grant_pending_trust); the next launch doesn't ask.
  • s admits the files for this process only — nothing written to trust.ron.
  • q / Esc quit. Every other key is swallowed until you answer.
  • After either answer: trusted N file(s) / trusted for this session, the block disappears, the model catalog and capabilities load, and the OB1/OB2 guidance takes over (Alt-N creates a session).
  • Declarations never include secrets: model routes, provider names and kinds, MCP command/URL, grant counts, pack names.
  • Headless ask/run/serve are unchanged and still fail fast with the qq trust message.
  • A TUI attached to a server it does not own (--session against a running qq serve) gets: "this client is attached to a server it does not own; run qq trust on the server host".

Design — ADR-0042: client-side prompt, root-resolved, no protocol change

Trust is a decision about files on the host that owns trust.ron. In the bare-qq case that host is the process rendering the TUI, so the composition root matches TrustRequired on its own load_for_client, renders plain PendingTrustNotices into TuiOptions, and supplies a TrustResolver hook (same pattern as the $EDITOR hook). qq-tui stays free of qq-config; PROTOCOL_VERSION stays 28.

  • qq-config: read-only ConfigLoader::pending_trust (the scan factored out of grant_pending_trust), PendingTrust::declarations from a new Document::sensitive_declarations, LoadRequest::with_process_trust merged into the in-memory TrustState after load (no disk write).
  • Runtime: RuntimeFactory holds process grants, applies them to every workspace load, and folds a fingerprint into PlanKey so a compile from before the grant is never served after it. grant_pending_trust deliberately loads durable state without process grants, so t after s still records the file.
  • Alternative rejected (in the ADR): a protocol-level hold kind — holds are run/tool-call scoped, so this would need a new command route, 28→29, and the server writing trust.ron on behalf of an unauthenticated remote principal. Revisit with ADR-0015 enrollment.

Verification

  • fmt, clippy -D warnings, cargo test --workspace — 1862 passed on the stacked tip (the OB10 docs-truth test runs against the new keys and guide text)
  • 10 new tests across qq-config (scan without writing; process trust admits and re-pends on edit), qq bin (plan keys differ; t records like qq trust, s grants only this process; a session grant is a new cache slot), qq-tui (keys→effects; resolved trust drops the prompt and applies the catalog; render; no-resolver notice; resolver awaited off the loop)
  • Manual pty smoke with an isolated HOME: block paints; s → cleared, no trust.ron; t → trust.ron written, next launch doesn't prompt; qq ask still exits with TrustRequired.

Docs

ADR-0042 + adr/README.md; progress/root.md (0042 reserved, next 0043; shared-file row: no PROTOCOL_VERSION change); guide/permissions.md, guide/tui.md (§ Trust + keys), guide/troubleshooting.md, design/tools.md; plan + ledger.

Compatibility

No wire, persisted, or config-format change. qq trust behaves as before.

Bare `qq` in a workspace whose project configuration declares sensitive
sections no trust record covers used to exit with `TrustRequired`. It now
opens the TUI on a trust prompt that lists each pending file and what it
declares (model, providers, MCP servers with command or URL, grant
counts, packs) with `t trust  s this session  q quit`. `t` records trust
exactly as `qq trust` does; `s` admits the files for this process only.
Headless `ask`/`run`/`serve` keep failing fast, and a TUI attached to a
server it does not own gets no prompt: trust is a decision about files
on the host that runs the server.

Design (ADR-0042): a client-side prompt fed by root-computed
`PendingTrustNotice`s and resolved by the composition root through a
`TrustResolver` hook, so `qq-tui` stays free of `qq-config` and the wire
protocol is unchanged. qq-config gains a read-only
`ConfigLoader::pending_trust`, `PendingTrust::declarations`, and
`LoadRequest::with_process_trust`; the runtime carries process trust on
every workspace load and folds it into `PlanKey` so a compile from before
the grant is never served after it.

Closes ENG-881.
@lg2m
lg2m added this pull request to stack #174 September 25, 2026 14:32
@lg2m
lg2m merged commit 2c2b447 into main Sep 25, 2026
6 checks passed
@lg2m
lg2m deleted the feat/eng-881-tui-trust-prompt branch September 25, 2026 14:37
lg2m added a commit that referenced this pull request Oct 26, 2026
…nreachable trust prompt (#476)

* refactor(tui): delete the unreachable project trust prompt

Since #446 every startup path ignores untrusted project configuration
instead of failing with TrustRequired, so the TUI never received pending
trust. Remove Mode::Trust and its resolver, RuntimeFactory::resolve_trust
and process-scoped trust, and the ProcessTrust/TrustChanged/TrustDeclaration
machinery that only served the prompt. qq trust, qq doctor, qq init and
qq config sources keep their behaviour.

crates/qq-tui/src/effect.rs returns to its pre-#161 contents because #161
added only the trust effect.

QQ-Allow-Revert: crates/qq-tui/src/effect.rs

* docs: describe unattended Auto, sandbox requirements and task tools

Help text, the /approval picker, README and the user guide still described
held Auto calls, the classifier as the gate, y/a/w prompts, and the TUI trust
prompt. Rewrite them for the shipped behaviour, document what the shell
sandbox needs on each OS and the task-workspace limits, list task_commit,
task_push and task_pr, and fix stale design notes (tools.md, architecture.md
PR #375 row, ADR-0050 status). Update the verify-qq skill in both copies.
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