Trim Pax's folder trust prompt to one question and one detail line

Merged
MP
1d ago
+371-100

This is an agy PR.

Why we make these changes

The Pax folder trust prompt previously rendered a 5+ line QuestionMenu (Trust this folder?, multi-line describe() output duplicated into scrollback, verbose choices, and a key-hint footer) plus a Trusted. /trust changes it. confirmation line after answering Yes, making startup noisy. This PR trims the interactive trust prompt to one question line and one dim detail line (Trust ~/src/foo? Yes / No), clears the prompt with no follow-up banner on Yes or when no prompt is needed, prints a single concise notice only on No / Esc, and shortens undecided_notice to one line.

Dependency & design choices

  • Built cleanly on origin/main (rather than merging open PRs #15542 and #15566): Both #15542 (.env after trust) and #15566 (untrusted read-only floor) are still open with compatibility impacts and active CI/review work. Implementing the prompt trim directly on main keeps this PR small, immediately mergeable, and factually accurate today (without falsely claiming No enforces read-only or skips .env before those PRs land). Once #15542 and #15566 land, a small follow-up can add read-only and .env (N vars: A, B, C, ...) (capped at 3 names inline + count) to prompt_detail, gate their notices strictly behind answering No in _decide_trust, and fold them into the single headless stderr line to close #16101.
  • Compact two-line TrustPrompt (ui/menus/trust_prompt.py): Renders Trust <path>? Yes / No (defaulting to No, supporting y/n/1/2/arrows/Tab/Enter/Esc/Ctrl+C, tail-truncating long paths so Yes / No stays visible) plus one dim detail line (theme.MUTED). Unwraps TranscriptOutput so ephemeral prompt frames never leak into TranscriptBuffer or scrollback on erase. Keeps TRUST, DISTRUST, and ask_trust(details, *, console, target='this folder') backward-compatible with v2.78.0.
  • Separate prompt_detail() vs describe() (runtime/workspace_trust.py): Adds display_path() (~ abbreviation + terminal sanitization) and prompt_detail() for the one-line startup prompt while keeping describe() for explicit /trust inspection.
  • No banner unless No/Esc: _decide_trust prints nothing when a folder is already decided (trusted or untrusted) or when the user answers Yes, and prints one concise line (Untrusted. /trust changes it. / Untrusted for this session. /trust changes it.) only after No or Esc/Ctrl+C.

New public surface

  • pydantic_ai_pax.runtime.workspace_trust: display_path, prompt_detail
  • pydantic_ai_pax.ui.menus.trust_prompt: TrustPrompt, optional target kwarg on ask_trust

Screenshots

Trimmed two-line folder trust prompt showing Trust ~/src/foo? Yes / No and one dim detail line

Terminal after answering No: prompt cleared and single Untrusted notice shown

Verification

  • Added and updated regression tests in tests/pax/test_workspace_trust.py and tests/pax/test_acp.py (100% branch coverage on trust_prompt.py, workspace_trust.py, and _decide_trust).
  • Verified live in a fresh tmux session (Yes, No, arrow toggle, and relaunch in already-decided folders).

What changes for existing users

First-run interactive launches show a two-line Trust <folder>? Yes / No prompt instead of the multi-line picker, print no trust banner after answering Yes (or in already-decided folders), and print a shorter one-line untrusted notice in headless/web/ACP runs.

Checklist

  • No breaking changes in accordance with the version policy.
  • Any permitted compatibility impact has a label, warning, migration and release note, and an exact API-check waiver if the gate reports it.
  • PR title is fit for the release changelog.

Summary by cubic

Trims Pax's folder trust prompt so first-run startup is quieter: the multi-line QuestionMenu is now a two-line inline prompt (Trust <folder>? Yes / No plus one dim detail line) that erases cleanly, prints no banner after Yes or in already-decided folders, and shows a single concise notice only on No or Esc/Ctrl+C.

  • Long paths tail-truncate so Yes / No stays visible, and the prompt never leaks into the transcript or scrollback.
  • The detail line names what answering No leaves untrusted (instruction files, skills, and files needing separate approval like .clai/settings.json and MCP servers) and notes when the answer is session-only.
  • undecided_notice is shortened to one line.
  • Adds display_path and prompt_detail while describe still serves /trust; ask_trust keeps its optional target kwarg and stays compatible with v2.78.0.
  • Built on main rather than open PRs #15542 and #15566 so read-only and .env details can layer on later.