fix(connect): stop at once when a live probe cannot identify the session
Customer symptom. A guest on macOS (no app installed, so the standalone-probe path) got Timed out waiting for the Agent Relay probe after 60000 ms. Afterwards there was no pointer and no probe process, and headless.log was empty.
Root cause.
- The installer's readiness check polls
GET /setup/statusand accepts onlyok:true. - The probe answers every route,
/setup/statusincluded, with403 not_a_relay_sessionwhen it cannot tie the calling process to a live Claude Code or Codex session (relay-desktopoutbound.rssetup_route→identify). - So a probe that started fine looked dead. The installer waited the full 60 s, killed the probe, removed the pointer and printed only a timeout.
headless.logis empty on a successful start too, so the empty log meant nothing.
Reproduced with the published v2026.10.31 macOS arm64 probe tarball and a fresh HOME. It was ready in 2 s and wrote its pointer, and /setup/status answered not_a_relay_session.
Fix.
- A probe that answers
not_a_relay_sessionorsession_file_unreadablenow counts as live, in bothfindLiveSocketandwaitForLiveSocket. Its version can't be read in that state. - The join, send, status or leave request then gets the same answer, and the CLI prints it inline in about a second.
- No second probe is installed. A freshly installed probe is kept, not rolled back.
- The
not_a_relay_sessionmessage now says the probe is running and that the command must run from the agent's own shell tool. session_file_unreadablepasses the probe's own explanation through. It was previously "Relay Connect request failed (session_file_unreadable)".- A readiness timeout now names the probe's last answer, or says it never answered and points at
headless.log. connect installrun from a plain terminal no longer times out against a live probe.
Unchanged.
- The Linux 2026.10.4 update hint still applies when
/setup/statusanswersok:truewith that version. - Old-version detection is the same.
Tests (54 pass). Six are new, and all six fail on main:
waitForLiveSocketreturns on the firstnot_a_relay_sessionanswer, with no sleep.- A timeout names the last answer, or "never answered".
findLiveSocketreturns a caller-rejecting probe as live instead ofnull.- Fresh-HOME reproduction, end to end: a fake probe answers every route
403 not_a_relay_session.connect joinexits 6 with the inline message in under 5 s, and onlyGET /setup/statusandPOST /connect/joinare requested. Onmain, the old code instead waits through recovery and starts an install. session_file_unreadableprints the probe's message.- A fresh Linux install whose probe rejects the caller is kept. On
mainthis hits the 60 s timeout and rolls back.
This is a separate fix from the Node-relay design (#1966). We still need to learn why Julian's session was not identified; questions are out to him.
🤖 Generated with Claude Code
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.
[!NOTE]
Low Risk
Scoped to connect CLI probe readiness and error messaging; no auth or cloud API changes.
Overview
Fixes a case where @agent-relay/connect join (and install) could sit for 60 seconds, tear down a healthy probe, and only report a generic timeout when the probe was up but returned not_a_relay_session or session_file_unreadable on /setup/status.
Probe discovery now treats those responses as proof the socket is live: findLiveSocket and waitForLiveSocket return immediately with sessionRejected instead of polling until timeout or rolling back a fresh Linux install. Readiness timeouts include the probe’s last answer (or a pointer to headless.log).
CLI behavior surfaces the real session errors in ~1s—clearer copy for not_a_relay_session, probe text for session_file_unreadable, and connect install uses requireVerifiedProbe so a running but unverifiable probe is not reported “ready” from an outside terminal.
Docs and changelog describe running connect from the agent’s shell; six new tests cover the fast-fail and install-keep paths.
Reviewed by Cursor Bugbot for commit 60dc36a83fc37c3e85a69800234dd842989c65df. Bugbot is set up for automated code reviews on this repo. Configure here.
Agent Relay sessions