fix(desktop): surface BYOH availability truthfully — auth copy, install hints, adapter-missing presets

Three generic fixes for the #2773 hand-test bugs:

- Auth-required discovery errors (spec ErrorCode::AuthRequired text,
  e.g. signed-out cursor-agent) now render sign-in copy naming the
  agent, threaded from selectedRuntime.label. Matches the message
  text, never code -32000 (the catch-all fallback).
- The agent-definition dialog's not-installed warning now appends a
  non-empty install_hint (runtimeAvailabilityWarning helper) — presets
  always carried the right sentence; the requiresExternalCli render
  gate hid it.
- PresetHarness.underlying_cli (Amp: amp-acp wraps amp) feeds
  preset_catalog_entry, which consumes only the adapter-missing arm of
  the builtin predicate: CLI-present/adapter-absent now reads
  AdapterMissing instead of NotInstalled, while adapter-present/
  CLI-absent stays Available and selectable (full classify_runtime
  reuse would have regressed it to CliMissing with backwards copy).

Co-authored-by: Tyler Longwell <tlongwell@block.xyz>
Signed-off-by: Tyler Longwell <tlongwell@block.xyz>
This commit is contained in:
npub1qyvc0c5kl4gqv2fd97fsk46tu378sqgy35vc83rvgfwne90sel7s0ed67d
2026-07-26 14:56:53 -04:00
co-authored by Tyler Longwell
parent 83545f1b86
commit bbf9959960
9 changed files with 388 additions and 57 deletions
+14 -2
View File
@@ -326,7 +326,14 @@ const overrides = new Map([
// stale-publish regression is pinned through the REAL discover_acp_runtimes_from
// path (Wren's finding: the seam-only tests stayed green under a stale-publish
// mutant). Test-only code, zero release-build footprint.
["src-tauri/src/managed_agents/discovery.rs", 1780],
// +55: #2773 follow-up — PresetHarness.underlying_cli (Amp's amp-acp wraps
// the amp CLI) + preset_catalog_entry helper: adapter presence alone keeps
// deciding Available (adapter-present/CLI-absent stays selectable, Wren's
// regression catch); underlying_cli is consulted only when the adapter is
// absent, so AdapterMissing replaces the misleading NotInstalled. Includes
// the deliberate-divergence doc comments; net after the inline preset
// entries.push block collapsed into the helper.
["src-tauri/src/managed_agents/discovery.rs", 1835],
// BYOH — save_custom_harness_to_dir (backup-swap atomic write) + save_and_warm /
// delete_and_warm (persist-mutex serialization for concurrent-safe registry
// refresh, B-6). Also: id/collision/load/registry tests (from the file base) +
@@ -366,7 +373,12 @@ const overrides = new Map([
// pre_publish_test_hook; verified to red under a stale-publish mutant.
// +18: flake fix — lock_path_mutex + registry_test_lock guards (with lock-
// order comments) on the four tests that drive discovery's global caches.
["src-tauri/src/managed_agents/discovery/tests.rs", 1787],
// +84: #2773 follow-up — preset_catalog_entry coverage (Amp-shaped adapter
// preset: AdapterMissing when CLI present, NotInstalled both-missing,
// Available both-present AND adapter-present/CLI-absent — the selectability
// regression guard), bound to an injectable resolver so the tests stay
// PATH-independent.
["src-tauri/src/managed_agents/discovery/tests.rs", 1871],
// identity-import-keyring: the identity resolution state machine's behavioral
// matrix (46 tests over FakeIdentityStore — probe × marker × file cells,
// adoption / read-back-corruption / marker-failure arms, recovery-mode