fix(agent-pane): reconnect the owning machine from failed turns

Closed
TE
8d ago
+840-48

HOLD: pending independent review and hosted validation.

Problem

A failed turn on a remote chat explains that the remote machine cannot be reached, but the only recovery is Retry. Retry can fail again while the machine is still disconnected, and the failed prompt and attachments remain stranded in the transcript.

Change

  • Add the existing native machine reconnect action to the agent pane's user gesture allowlist.
  • Resolve that action to the owning machine of the current chat tab in the host, so the page cannot name an arbitrary saved peer or another machine.
  • Reuse the shared reconnect route for SSH, paired-server, and Cloud machine links.
  • Show localized Reconnect before Retry on tailnet failures, keep the failed turn visible, disable the button while the request is pending, and show a recovery note when the host refuses it.
  • Keep exactly one primary recovery button when Reconnect and Retry appear together.
  • Add focused card and native gesture coverage plus a remote gallery fixture.

Leo's words: "We want to be removing or, like, having better recovery for a lot of situations"

Changelog

Fixed remote turn failures so the owning machine can be reconnected without discarding the failed prompt.

Validation

  • git diff --check
  • python3 scripts/cmux-next/prepush-gate.py passed with no new violations.
  • python3 scripts/verify-local.py: project, policy, and static checks passed; Swift syntax was unavailable on this host and the localization check reports existing debt above baseline.
  • scripts/web-lint.sh: blocked by the checkout's Node 18 runtime; Vite Plus requires a newer Node runtime.
  • Hosted focused test request bun test test/turn-error-card.test.tsx was dispatched for commit 155d4809fbd1cc1a7990dd439d78ac3e8d321e0c; the broker returned a failed run with no test receipt and a mismatched workflow head, so it does not establish coverage.
  • Gallery fixture: agent-pane.turn-error-card, tailscale variant, with card/rail/note experiment arms. Capture service was unavailable in this lane, so no screenshot is claimed.

Agent session: agent session