Skip to content

feat(cli): VT_BACKEND routing pin (auto|agent|passkey)#4

Merged
timqi merged 2 commits into
mainfrom
vt-backend
Jul 14, 2026
Merged

feat(cli): VT_BACKEND routing pin (auto|agent|passkey)#4
timqi merged 2 commits into
mainfrom
vt-backend

Conversation

@timqi

@timqi timqi commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Summary

The config-file fallback (~/.config/vt/config.toml) made VT_AUTH presence ambient: a copied config silently opts a host into agent-socket probing, weakening the old "env var present = per-host intent" routing signal. This PR makes routing intent explicit with a VT_BACKEND pin (env or config key, validated in VTClient::new):

  • auto (default) — existing behavior: agent first when VT_AUTH is set, passkey fallback per should_fallback_to_cf.
  • agent — agent only; an unreachable socket is an actionable error instead of silently paging the phone. Requires VT_AUTH. sign@vt's decrypt-then-sign fallback still applies — its decrypt honors the pin.
  • passkey — never probes the agent socket even when VT_AUTH is set (shared config case). Requires VT_PASSKEY_URL. vt run (agent-only) errors out; vt ssh connect skips agent-identity discovery (has_auth_token → false).
  • Typos fail loudly at startup instead of silently routing as auto.

Docs (CLAUDE.md + config.example.toml) now spell out the placement discipline — VT_AUTH only in configs of hosts that can actually reach a vt agent — and the one-shot escape hatch VT_AUTH= vt … (set-but-empty env var beats the file and skips the agent).

Reviewed by codex-expert: no routing-boundary violations (passkey never probes the socket; agent never reaches CF), validation combos complete, docs match code. Verdict: safe to merge.

Test plan

  • cargo test (227 passed; new Backend::parse unit tests)
  • cargo check --target x86_64-unknown-linux-gnu (zigbuild)
  • CI

🤖 Generated with Claude Code

timqi added 2 commits July 14, 2026 14:07
…ment docs

The config-file fallback made VT_AUTH presence ambient — a copied
config.toml silently opts a host into agent-socket probing, weakening the
old "env var present = per-host intent" routing signal. Make intent
explicit:

- VT_BACKEND=auto (default): existing behavior — agent first when VT_AUTH
  is set, passkey fallback on recoverable errors.
- VT_BACKEND=agent: agent only; unreachable socket is an actionable error
  instead of silently paging the phone. sign@vt's decrypt-then-sign
  fallback still applies (its decrypt honors the pin).
- VT_BACKEND=passkey: never probe the agent socket even when VT_AUTH is
  set; vt run (agent-only) errors out.

Invalid values fail loudly at startup (VTClient::new), which also
validates per-pin requirements (agent→VT_AUTH, passkey→VT_PASSKEY_URL).
has_auth_token() is false under the passkey pin, so vt ssh connect skips
agent-identity discovery.

Docs: CLAUDE.md routing section + config.example.toml now spell out the
placement discipline (VT_AUTH only in configs of hosts that can reach a
vt agent) and the one-shot escape hatch (`VT_AUTH= vt …`, empty env var
beats the file and skips the agent).
@timqi
timqi merged commit 2c78419 into main Jul 14, 2026
4 checks passed
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