oficina / equipo Public

Connections: sign-in card browser tests, spec and report

The sign-in card at 1280 and 390 against a fake runner: the chooser's
Claude is the sign-in by a link with Paste a token you already have
beside it; Open Anthropic with Copy link, the code checked, sealed for
the code endpoint and the card's attempt, the field cleared at once,
the wrong-code card, the flourish and the row's expiry; switching
between the sign-in and the token cancels the open attempt. The real
runner's card in TestBrowserConnectionsAdd. The wrong-code line takes
the negative tone. Screenshots in docs/mockups/built/2026-11-10.

The Connections spec gains the as-built paragraph, the controller
report the copy rows, the guard mutations and what to confirm live.
Budgets raised with measured figures; stale reference allowances for
the removed terminal card dropped.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Paul Campbell pushed by claude agent, operated by paul@keymail.dev d9cc4a883b7b7a21943d1d3e1331f450a1f9535e parent 8a1b04c
24 files changed, +326 −105
  • .rastrillo/budgets.txt +3 −3
  • docs/mockups/built/2026-11-10/conn-signin-bad-1280.png binary
  • docs/mockups/built/2026-11-10/conn-signin-bad-390.png binary
  • docs/mockups/built/2026-11-10/conn-signin-card-1280.png binary
  • docs/mockups/built/2026-11-10/conn-signin-card-390.png binary
  • docs/mockups/built/2026-11-10/conn-signin-chooser-1280.png binary
  • docs/mockups/built/2026-11-10/conn-signin-chooser-390.png binary
  • docs/mockups/built/2026-11-10/conn-signin-connected-1280.png binary
  • docs/mockups/built/2026-11-10/conn-signin-connected-390.png binary
  • docs/mockups/built/2026-11-10/conn-signin-waiting-1280.png binary
  • docs/mockups/built/2026-11-10/conn-signin-waiting-390.png binary
  • docs/mockups/built/2026-11-10/conn-signin-wrong-1280.png binary
  • docs/mockups/built/2026-11-10/conn-signin-wrong-390.png binary
  • docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md +100 −1
  • docs/superpowers/specs/2026-11-08-equipo-connections.md +41 −2
  • internal/equipo/static/equipo.css +1 −0
  • internal/headless/browser_conn_add_test.go +1 −1
  • internal/headless/browser_connections_test.go +9 −9
  • internal/headless/browser_signin_test.go +147 −0
  • internal/headless/browser_token_test.go +4 −4
  • internal/runner/thin/signin_test.go +16 −5
  • internal/runner/thin/token.go +3 −2
  • internal/thintest/connections_add_pages_test.go +1 −1
  • scripts/runner-reference-allowlist.json +0 −77

CI failed — run details

diff --git a/.rastrillo/budgets.txt b/.rastrillo/budgets.txt
index bb92ff94..9207e9b5 100644
--- a/.rastrillo/budgets.txt
+++ b/.rastrillo/budgets.txt
@@ -36,7 +36,7 @@ perf GET /releases/* skip Verified runner release file downloads, not browser GE
perf GET /install.sh skip Mac runners: the one-line bootstrap a terminal pipes to sh, not a browser screen.
time internal/runner/containment 15s Plan 3 loaded CI measured 10.817s; niced serial reruns measured 5.773s and 5.750s. The added coordinator mount check has no repeated launches to remove; 15s leaves 38 percent headroom for namespace, process-exit and recovery assertions.
time internal/tryequipo 30s Release starter-set controller K3 records CI runs of 10.8s and 13.1s; 30s retains the guide integration checks with headroom on the shared runner.
-size internal/runner/thin 15350 - Claude setup tokens add sealed delivery, the token check, Check again and recovery (token.go, tokencheck.go, about 700 lines) beside the composer and Mac lines; measured 15239. Astra round 2 moves the attachment quota to admission: arriving files counted by declared size, admissions protecting a file until its message names it, room made from the oldest unprotected files, refusal as runner_storage_full, and a sweep that stops when protection cannot be read (about 150 lines); measured 12191. Mac runners slices A and B add protocol negotiation (link.go), the capability report, the start authorization, the pack relay (relay.go), the primary's publication, the worker executor (worker.go) and the test-build fake worker, about 2700 lines on the same step engine. Composer attachments add the chunked receipt with exactly-once writes, the read-only desk delivery and its checks (files.go, about 230 lines), image blocks and localImage inputs, the attachment read through read_file; measured 11736. Connections slice 1 Astra round 1 adds the Codex step path (codexstep.go: Engineering and Review on the pinned app-server in the implement and inspect containment, about 300 lines); measured 11345. Connections slice 1 (after Astra round 1) also keeps a durable ledger of each turn's write tools so a later attempt never repeats one (effects.go), the waiting state between attempts and usage rows per attempt, about 500 lines more; measured 10590 before gate 1d. Connections slice 1 adds the Codex coordinator beside the Claude one (codex.go: the pinned app-server over JSON-RPC in the converse containment, sharing the coordinator base, desk, tool socket and session table), the connection registry over the bindings with health and provider limits (conns.go), in-app sign-in attempts (connector.go) and turn failover and holding (failover.go), about 1500 lines; the pure parts (the choice function, limit parsing, the app-server client, the sign-in flows) live in internal/runner/connect. Measured 10097. Thin v1 UX1 adds step activity lines from the specialist's stream, the repository head and checks gate in the index and project-tagged notes (about 120 lines); measured 8615 with slice 4c's review fixes. Thin v1 slice 4c adds the merge step (mergestep.go, about 190 lines) and the rebase round beside the slice 4b ask fixes. Thin v1 slice 3 adds Engineering steps beside the coordinator: the durable step state and engine (step.go) and the executor that checks out the task tree, runs the CLI in the implement containment, commits and pushes (engineer.go), about 800 lines sharing the coordinator's launch, tool socket and account selection. Measured 5686 source lines. Splitting would export the launch internals; revisit at the slice 7 sweep. Slice 4 adds checks and review on a candidate (judge.go) and the merge watch (merge.go), about 800 lines, sharing the Engineer launch path; measured 6808, 7035 after review round 1 (branch head watch, deadlines, streamed outputs). Slice 4b keeps Engineering and Review sessions and answers the creator's questions from them (ask.go: kept-session and ask state, read-only git tools, the answer stream), about 700 lines on the same launch path.
+size internal/runner/thin 15750 - Claude's sign-in by a link adds the runner's own setup-token attempt, the code's sealed delivery with its crash boundaries and the shared token commit (signin.go, about 300 lines, less the removed terminal watcher); measured 15655. Claude setup tokens add sealed delivery, the token check, Check again and recovery (token.go, tokencheck.go, about 700 lines) beside the composer and Mac lines; measured 15239. Astra round 2 moves the attachment quota to admission: arriving files counted by declared size, admissions protecting a file until its message names it, room made from the oldest unprotected files, refusal as runner_storage_full, and a sweep that stops when protection cannot be read (about 150 lines); measured 12191. Mac runners slices A and B add protocol negotiation (link.go), the capability report, the start authorization, the pack relay (relay.go), the primary's publication, the worker executor (worker.go) and the test-build fake worker, about 2700 lines on the same step engine. Composer attachments add the chunked receipt with exactly-once writes, the read-only desk delivery and its checks (files.go, about 230 lines), image blocks and localImage inputs, the attachment read through read_file; measured 11736. Connections slice 1 Astra round 1 adds the Codex step path (codexstep.go: Engineering and Review on the pinned app-server in the implement and inspect containment, about 300 lines); measured 11345. Connections slice 1 (after Astra round 1) also keeps a durable ledger of each turn's write tools so a later attempt never repeats one (effects.go), the waiting state between attempts and usage rows per attempt, about 500 lines more; measured 10590 before gate 1d. Connections slice 1 adds the Codex coordinator beside the Claude one (codex.go: the pinned app-server over JSON-RPC in the converse containment, sharing the coordinator base, desk, tool socket and session table), the connection registry over the bindings with health and provider limits (conns.go), in-app sign-in attempts (connector.go) and turn failover and holding (failover.go), about 1500 lines; the pure parts (the choice function, limit parsing, the app-server client, the sign-in flows) live in internal/runner/connect. Measured 10097. Thin v1 UX1 adds step activity lines from the specialist's stream, the repository head and checks gate in the index and project-tagged notes (about 120 lines); measured 8615 with slice 4c's review fixes. Thin v1 slice 4c adds the merge step (mergestep.go, about 190 lines) and the rebase round beside the slice 4b ask fixes. Thin v1 slice 3 adds Engineering steps beside the coordinator: the durable step state and engine (step.go) and the executor that checks out the task tree, runs the CLI in the implement containment, commits and pushes (engineer.go), about 800 lines sharing the coordinator's launch, tool socket and account selection. Measured 5686 source lines. Splitting would export the launch internals; revisit at the slice 7 sweep. Slice 4 adds checks and review on a candidate (judge.go) and the merge watch (merge.go), about 800 lines, sharing the Engineer launch path; measured 6808, 7035 after review round 1 (branch head watch, deadlines, streamed outputs). Slice 4b keeps Engineering and Review sessions and answers the creator's questions from them (ask.go: kept-session and ask state, read-only git tools, the answer stream), about 700 lines on the same launch path.
time internal/thintest 180s Mac runners slices A and B add role, scoping, migration, placement, withdrawal, transfer and publication contracts, and Astra round 1 eight transition contracts (about 15s; the package measured 126s locally under load). Housekeeping slice 1 adds six contract tests (combine, Undo round trips and the race, Pause, auto-disable, quiet hours, restart while claimed; about 6s); the package measured 67.7s beside other packages locally, so 75s. Thin v1 slice 4c adds the merge, adoption, cancel and retention contract tests (CI measured 35.7s). Thin v1 contract tests: a real instance and a scripted runner per test, fixtures replayed against every request, frame and event. Slice 3 adds the task, step-sync and grant contracts; CI measured 14.805s. 30s keeps room for the slice 4 review contracts. UX1 adds step activity, task source and duplicates, coordinator merging and project facts (four contracts, about 6s); the package measured 34s locally under load, so 40s. UX1's inner screens gallery (two owners, seven tasks, every page) adds about 3s; measured 40.9s locally under load, so 60s.
time internal/runner/mac 30s Mac runners (Darwin worker): real process groups killed after a grace and proven gone (SIGTERM, SIGKILL, the marker sweep), and the probes run end to end with fake srt and xcodebuild, P6 killing a waiting test two seconds after it starts. About 6s alone; loaded CI measured 12.5s.
time internal/runner/thin 45s Thin v1 slice 4 review: real git repositories for the merge and squash checks, a stalled fetch, and a 16 MiB candidate streamed through the review diff and the checks pack (about 5s). Measured 17.8s locally under load. Slice 4b review adds a 16 MiB git output bound, an injected index-pack failure and stall (3s deadline) and held-answer tests; measured 30.3s locally under load. 45s keeps 33 percent headroom.
@@ -51,7 +51,7 @@ perf GET /api/v1/notebook skip Thin v1 person API: bearer-only JSON for devices;
perf GET /api/v1/thinking skip Thin v1 person API: bearer-only JSON for devices; the browser reads thinking words on /settings/thinking.
perf GET /api/v1/tasks skip Thin v1 person API: bearer-only JSON for devices; the browser reads tasks through /tasks.
perf GET /api/v1/tasks/{id} skip Thin v1 person API: bearer-only JSON for devices; the browser reads a task through /tasks/{id}.
-size internal/equipo/chat 11900 - Mac runners slices A and B add per-runner mailboxes, placement, withdrawal, the offline rule, the runners view, transfers and publication (runners.go, transfers.go, about 1100 lines). Composer attachments add uploads, the message link, the mailbox relay with chunk frames hydrated from the stored file, and serving (attachments.go, attachments_http.go, about 330 lines); the link and relay run inside the send and dispatch transactions, so they live beside them; sniffing and stripping are pure, in internal/attach. Measured 10292. Merged with UX1 thinking words (f2602d3), measured 9801. Housekeeping slice 1 adds the loop's ledger and state machine, the housekeeping principal's checks inside the shared store functions, reservations, Pause, quiet hours, the digest, claim recovery and the API (housekeeping.go, housekeeping_control.go, housekeeping_http.go, about 1,350 lines); the checks must run inside the store's transactions, so they live beside them; the detectors themselves are pure, in internal/equipo/housekeeping. Measured 9637. Thin v1 UX1 thinking words adds the per-person set and its API (thinking.go, about 100 lines); measured 8305. Connections slice 1 review round 2: the mutation ledger matches record_task by subject only and refuses an ambiguous call with the earlier operations, the preference and forget (about 120 lines); measured 8236. Thin v1 UX1 round 3 adds Equipo combining duplicate tasks reversibly (duplicates.go: detection, the in-transaction fold checks, fold, Undo, about 400 lines) and headlines on findings and steps (headline.go); measured 7898. Connections slice 1 adds connection records from hello and attempts, the connect mailbox, the API, usage rows and the turn's mutation ledger (connections.go and tools.go, about 600 lines); measured 7400 after merging UX1. Thin v1 UX1 adds step activity lines, duplicates and their fold, the coordinator at work on a task, project facts from the runner catalog and open merge cards for the pages (inner.go, about 330 lines); measured 6610 with slice 4c's review fixes. Thin v1 slice 4c adds the merge policy, the merge card, the rebase round and duplicate reports (merge.go, about 380 lines). Thin v1 instance core: conversation, projects, tasks, review and, from slice 4b, questions to the specialists (questions.go, about 470 lines) share one store, transaction and event log; splitting would export the transaction internals. Measured 5514 source lines; revisit at the slice 7 sweep.
+size internal/equipo/chat 12000 - Claude's sign-in by a link adds the code route beside the token's in SendSecret, the sign-in prompt and the kind it becomes (about 40 lines); measured 11933. Mac runners slices A and B add per-runner mailboxes, placement, withdrawal, the offline rule, the runners view, transfers and publication (runners.go, transfers.go, about 1100 lines). Composer attachments add uploads, the message link, the mailbox relay with chunk frames hydrated from the stored file, and serving (attachments.go, attachments_http.go, about 330 lines); the link and relay run inside the send and dispatch transactions, so they live beside them; sniffing and stripping are pure, in internal/attach. Measured 10292. Merged with UX1 thinking words (f2602d3), measured 9801. Housekeeping slice 1 adds the loop's ledger and state machine, the housekeeping principal's checks inside the shared store functions, reservations, Pause, quiet hours, the digest, claim recovery and the API (housekeeping.go, housekeeping_control.go, housekeeping_http.go, about 1,350 lines); the checks must run inside the store's transactions, so they live beside them; the detectors themselves are pure, in internal/equipo/housekeeping. Measured 9637. Thin v1 UX1 thinking words adds the per-person set and its API (thinking.go, about 100 lines); measured 8305. Connections slice 1 review round 2: the mutation ledger matches record_task by subject only and refuses an ambiguous call with the earlier operations, the preference and forget (about 120 lines); measured 8236. Thin v1 UX1 round 3 adds Equipo combining duplicate tasks reversibly (duplicates.go: detection, the in-transaction fold checks, fold, Undo, about 400 lines) and headlines on findings and steps (headline.go); measured 7898. Connections slice 1 adds connection records from hello and attempts, the connect mailbox, the API, usage rows and the turn's mutation ledger (connections.go and tools.go, about 600 lines); measured 7400 after merging UX1. Thin v1 UX1 adds step activity lines, duplicates and their fold, the coordinator at work on a task, project facts from the runner catalog and open merge cards for the pages (inner.go, about 330 lines); measured 6610 with slice 4c's review fixes. Thin v1 slice 4c adds the merge policy, the merge card, the rebase round and duplicate reports (merge.go, about 380 lines). Thin v1 instance core: conversation, projects, tasks, review and, from slice 4b, questions to the specialists (questions.go, about 470 lines) share one store, transaction and event log; splitting would export the transaction internals. Measured 5514 source lines; revisit at the slice 7 sweep.
perf GET /api/v1/questions/{id} skip Thin v1 person API: bearer-only JSON for devices; the browser reads questions on /tasks/{id}.
perf GET /api/v1/steps/{id}/log skip Thin v1 person API: bearer-only JSON for devices; the browser shows the log tail on /tasks/{id}.
perf GET /api/v1/connections/preference skip Connections slice 1 person API: bearer-only JSON for devices; the browser shows the preference on /conversation/connections.
@@ -63,4 +63,4 @@ perf GET /conversation/attachments/{id} skip Composer attachments: the bytes of
perf GET /conversation/attachments/{id}/preview skip Composer attachments: an image thumbnail inside the conversation; a file, not a screen.
perf GET /api/v1/runners skip Mac runners person API: bearer-only JSON for devices; the browser shows runners in the Team section.
time cmd/equipo-runner 60s Mac runners slice B: TestReleaseRunnerHasNoFakeWorker builds the release runner exactly as make release-runner does and the thin package under the testbuild tag (measured 11.9s locally with a warm cache).
-size internal/thintest - 9750 The Connections Add page and the Settings rail add their page contracts and the rail's browser drive (connections_add_pages_test.go, settings_rail_pages_test.go, about 230 lines); measured 9676. Claude setup tokens add the token and Check again contracts; measured 9444 with the composer and Mac lines merged. The instant thinking line adds its browser drive (instant_browser_test.go, about 230 lines); measured 9064 with the composer and Mac lines merged. Mac runners add the role, scoping, migration, placement, withdrawal, transfer and publication contracts (about 900 test lines) beside the thin v1 contracts; one package keeps one instance harness.
+size internal/thintest - 10000 Claude's sign-in by a link adds the code contract (signin_contract_test.go: the card, the code route's refusals, the wrong-code card, the kind it becomes and the canary sweep, about 220 lines); measured 9896. The Connections Add page and the Settings rail add their page contracts and the rail's browser drive (connections_add_pages_test.go, settings_rail_pages_test.go, about 230 lines); measured 9676. Claude setup tokens add the token and Check again contracts; measured 9444 with the composer and Mac lines merged. The instant thinking line adds its browser drive (instant_browser_test.go, about 230 lines); measured 9064 with the composer and Mac lines merged. Mac runners add the role, scoping, migration, placement, withdrawal, transfer and publication contracts (about 900 test lines) beside the thin v1 contracts; one package keeps one instance harness.
diff --git a/docs/mockups/built/2026-11-10/conn-signin-bad-1280.png b/docs/mockups/built/2026-11-10/conn-signin-bad-1280.png
new file mode 100644
index 00000000..9edb2ddb
Binary files /dev/null and b/docs/mockups/built/2026-11-10/conn-signin-bad-1280.png differ
diff --git a/docs/mockups/built/2026-11-10/conn-signin-bad-390.png b/docs/mockups/built/2026-11-10/conn-signin-bad-390.png
new file mode 100644
index 00000000..7198ed6d
Binary files /dev/null and b/docs/mockups/built/2026-11-10/conn-signin-bad-390.png differ
diff --git a/docs/mockups/built/2026-11-10/conn-signin-card-1280.png b/docs/mockups/built/2026-11-10/conn-signin-card-1280.png
new file mode 100644
index 00000000..97155666
Binary files /dev/null and b/docs/mockups/built/2026-11-10/conn-signin-card-1280.png differ
diff --git a/docs/mockups/built/2026-11-10/conn-signin-card-390.png b/docs/mockups/built/2026-11-10/conn-signin-card-390.png
new file mode 100644
index 00000000..a62228b8
Binary files /dev/null and b/docs/mockups/built/2026-11-10/conn-signin-card-390.png differ
diff --git a/docs/mockups/built/2026-11-10/conn-signin-chooser-1280.png b/docs/mockups/built/2026-11-10/conn-signin-chooser-1280.png
new file mode 100644
index 00000000..c5d9eafa
Binary files /dev/null and b/docs/mockups/built/2026-11-10/conn-signin-chooser-1280.png differ
diff --git a/docs/mockups/built/2026-11-10/conn-signin-chooser-390.png b/docs/mockups/built/2026-11-10/conn-signin-chooser-390.png
new file mode 100644
index 00000000..0d767746
Binary files /dev/null and b/docs/mockups/built/2026-11-10/conn-signin-chooser-390.png differ
diff --git a/docs/mockups/built/2026-11-10/conn-signin-connected-1280.png b/docs/mockups/built/2026-11-10/conn-signin-connected-1280.png
new file mode 100644
index 00000000..96b993d3
Binary files /dev/null and b/docs/mockups/built/2026-11-10/conn-signin-connected-1280.png differ
diff --git a/docs/mockups/built/2026-11-10/conn-signin-connected-390.png b/docs/mockups/built/2026-11-10/conn-signin-connected-390.png
new file mode 100644
index 00000000..05a7f755
Binary files /dev/null and b/docs/mockups/built/2026-11-10/conn-signin-connected-390.png differ
diff --git a/docs/mockups/built/2026-11-10/conn-signin-waiting-1280.png b/docs/mockups/built/2026-11-10/conn-signin-waiting-1280.png
new file mode 100644
index 00000000..13372908
Binary files /dev/null and b/docs/mockups/built/2026-11-10/conn-signin-waiting-1280.png differ
diff --git a/docs/mockups/built/2026-11-10/conn-signin-waiting-390.png b/docs/mockups/built/2026-11-10/conn-signin-waiting-390.png
new file mode 100644
index 00000000..2a0e1ab8
Binary files /dev/null and b/docs/mockups/built/2026-11-10/conn-signin-waiting-390.png differ
diff --git a/docs/mockups/built/2026-11-10/conn-signin-wrong-1280.png b/docs/mockups/built/2026-11-10/conn-signin-wrong-1280.png
new file mode 100644
index 00000000..d9c1229e
Binary files /dev/null and b/docs/mockups/built/2026-11-10/conn-signin-wrong-1280.png differ
diff --git a/docs/mockups/built/2026-11-10/conn-signin-wrong-390.png b/docs/mockups/built/2026-11-10/conn-signin-wrong-390.png
new file mode 100644
index 00000000..9ab7dde5
Binary files /dev/null and b/docs/mockups/built/2026-11-10/conn-signin-wrong-390.png differ
diff --git a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
index 84204747..d7652eae 100644
--- a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
+++ b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
@@ -5317,7 +5317,7 @@ records remain unchanged.
| `chat.connections.loading_claude_2` | Warming up a fresh desk for Claude… | Connections slice 1 (Connections page, loading line) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| `chat.connections.loading_claude_3` | Starting Claude's own sign-in… | Connections slice 1 (Connections page, loading line) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| `chat.connections.paste_token` | Paste a token | Claude token connections (Connections page, chooser) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
-| `chat.connections.sign_in_instead` | Or sign in on the runner instead | Claude token connections (Connections page, chooser and token card) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
+| `chat.connections.sign_in_instead` | Or sign in at Anthropic instead | Claude sign-in by a link (Connections page, token card) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| `chat.connections.token_sub` | Your Claude subscription, with a token from Claude Code. | Claude token connections (Connections page, token card) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| `chat.connections.token_run` | On any computer with Claude Code, run | Claude token connections (Connections page, token card) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| `chat.connections.token_approve` | Approve in the browser. | Claude token connections (Connections page, token card) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
@@ -5334,6 +5334,15 @@ records remain unchanged.
| `chat.connections.token_new` | Paste a new token | Claude token connections (Connections page, connection row) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| `chat.connections.token_rejected` | This token was rejected. Run claude setup-token again. | Claude token connections (Connections page, connection row) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| `chat.connections.copy_link` | Copy link | Claude token connections (Connections page, Connect Codex and Claude sign-in cards) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
+| `chat.connections.sign_in_how` | Sign in at Anthropic | Claude sign-in by a link (Connections page, chooser) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
+| `chat.connections.paste_token_instead` | Paste a token you already have | Claude sign-in by a link (Connections page, chooser and sign-in card) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
+| `chat.connections.open_anthropic` | Open Anthropic | Claude sign-in by a link (Connections page, sign-in card) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
+| `chat.connections.code_paste` | Paste the code Anthropic shows you | Claude sign-in by a link (Connections page, sign-in card) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
+| `chat.connections.code_wrong` | That code did not work. Open Anthropic again and paste the new code. | Claude sign-in by a link (Connections page, sign-in card) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
+| `chat.connections.code_bad` | That is not the code. Copy the whole code from Anthropic's page. | Claude sign-in by a link (Connections page, sign-in card) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
+| `chat.connections.code_failed` | That did not go through. Paste the code again. | Claude sign-in by a link (Connections page, sign-in card) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
+| `chat.connections.code_no_key` | Your runner needs an update before it can take a code. | Claude sign-in by a link (Connections page, sign-in card) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
+| `chat.connections.waiting_code` | Your runner is finishing the sign-in… | Claude sign-in by a link (Connections page, sign-in card) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| `work.merge_now` | Merge | Thin v1 slice 4c review round 2 (task card and page) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| `work.step` | %s, attempt %d: %s | Thin v1 slice 4 review and checks (task card, task and Tasks pages, sidebar) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
| `work.steps` | Steps | Thin v1 slice 4 review and checks (task card, task and Tasks pages, sidebar) | Runtime; COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context) |
@@ -6381,3 +6390,93 @@ Every decision the build controller made on Paul's behalf, in order, with what i
- Task 17: minor (deferred, final review should triage): account login polls instance every 100ms and one transient network error cancels the login and removes the home; version pins in three places with no tying test; every RefusalError shows the setup-ID message even for 401/403; docs/live-gate.md:96 runner.env path disagrees with installer default (~/.local/share/equipo-runner). Codex `login --device-auth` argv has no repo fixture (from plan text; fail-closed behind --help probe); live-gate item.
- Task 20: minor (deferred): 5 expires_at zero for approved-unexchanged rows; 9 project rules reachable only through the API (no HTML surface); 10 OpenAPI uses one response set for every operation.
- Task 20: minor (deferred): every bearer request writes last_used_at and a failed write fails auth; schema.sql has a trailing ALTER TABLE rather than an edited CREATE. HKDF change invalidates pre-fix device credentials/cursors (none deployed).
+
+## Claude sign-in by a link (2026-11-10)
+
+Paul, on the paste-a-token card: "Can you not run this on the server and
+get a link to give to the browser? We're trying to avoid the round-trip
+over SSH here." Ruling: the one-time code is relayed through Equipo,
+sealed, the same category of risk as the pasted token. Branch
+`claude-signin-relay`. As built: Connections spec §2.4, "Claude's sign-in
+by a link, as built".
+
+### Design
+
+- Wire: prompt kind `authorize_link` with `attempt` and `wrong_code`
+ (omitted when empty, so older fixtures round-trip); a code is a
+ `Sealed` box bound to `endpoint`
+ `https://platform.claude.com/oauth/code/callback` and the card's
+ attempt (1 to `MaxCodeAttempts`, 5). Connect and the connect frame are
+ unchanged: Claude, kind subscription, not same machine, is the
+ sign-in. The record is kind subscription while it connects and kind
+ token once healthy.
+- Runner (`internal/runner/thin/signin.go`,
+ `internal/runner/connect/setuptoken.go`): `claude setup-token` on a
+ pseudo-terminal in the new home, login environment, `BROWSER` a no-op;
+ the URL read through ANSI, OSC 8 and redraws; the code delivered as
+ (i) received, (ii) opened and checked, (iii) `seen_seals` committed
+ with the attempt running, (iv) handed to the attempt and typed. The
+ token is kept by the token's own commit (`keep`, shared with Secret),
+ which also turns the attempt kind token, then `madeToken` probes,
+ binds and checks it.
+- Removed: the terminal card, its watcher (`watchTerminal`), the
+ `terminal` prompt kind and their copy.
+
+### Tests and guard mutations
+
+Each mutation was applied alone, the named test run, and the file
+restored (`git checkout`-equivalent restore by the script).
+
+| Guard | Mutation | Test | Result |
+|---|---|---|---|
+| Link host | accept any host | `TestAuthorizeURL` | red: other host accepted |
+| Repeated parameters | allow two `redirect_uri` | `TestAuthorizeURL` | red: redirect twin accepted (found first by the test, then fixed) |
+| OSC 8 | ignore hyperlink targets | `TestAuthorizeThroughEscapes` | red: no link |
+| No-op BROWSER | drop it | `TestSignInConnect` | red: the fake refuses to run |
+| Code endpoint | accept any endpoint | `TestSignInCodeReplayAndRefusals` | red: a code bound as a token connected |
+| Replay | no `seen_seals` row | `TestSignInCodeReplayAndRefusals` | red |
+| Stale attempt | take any attempt | `TestSignInCodeReplayAndRefusals` | red: taken |
+| Token typed as code | `ValidCode` takes `sk-ant` | `TestSignInCodeReplayAndRefusals` | red: the echoed token was taken as the CLI's |
+| Expired box | take it | `TestSignInCodeReplayAndRefusals` | red |
+| Real check | skip it | `TestSignInTokenRejected` | red: healthy after 0 checks |
+| Commit turns kind token | leave kind | `TestSignInSurvivesCrashes/committed` | red: runner_offline |
+| Restart cleans home | keep it | `TestSignInSurvivesCrashes` | red: home left |
+| Cancel kills the CLI | skip Close | `TestSignInCancelAndLimit` | red: CLI alive |
+| Wrong code said | never say it | `TestSignInWrongCodeAgain` | red |
+| CLI exit restarts | end instead | `TestSignInCLIExpires`, `TestSignInCLIDies` | red |
+| Enter after the code | never press it | `TestSignInConnect` | red: no end |
+| Runner log canary | log the code | `TestSignInConnect` | red: code in the runner's log |
+| End-to-end canary | log the token | `TestHeadlessClaudeSignIn` | red: token in the runner's log |
+| Instance: attempt binding | accept any attempt | `TestContractSignInCode` | red |
+| Instance: kind on healthy | stay subscription | `TestContractSignInCode` | red |
+| Instance: one box per card | keep the link | `TestContractSignInCode` | red |
+| Instance: attempt bound | allow 99 | `TestContractSignInCode` | red |
+| Instance: token box to a sign-in | accept | `TestContractSignInCode` | red |
+| Card endpoint | seal for the API | `TestContractSignInCode` | red |
+| Page canary | put the code on the card | `TestBrowserConnectionsSignIn` | red |
+| Page attempt | always attempt 1 | `TestBrowserConnectionsSignIn` | red: 409, no second box |
+| Page endpoint | API endpoint in the card | `TestBrowserConnectionsSignIn` | red |
+
+Crash boundaries (`TestSignInSurvivesCrashes`): code_opened,
+code_committed, code_typed, staged, transaction end runner_offline with
+the home gone and the resend acked and dropped; committed resumes to
+healthy. Screenshots: `docs/mockups/built/2026-11-10/conn-signin-*`.
+
+Commands (all green at the branch head): `nice -n 10 make budget`
+(three raises, measured figures in `.rastrillo/budgets.txt`),
+`make staticcheck`, `gofmt -l`, `go vet ./internal/...`, the darwin
+runner build and vet, `python3 scripts/runner-dead-references.py`,
+`go test ./internal/plan3test/`, `go test ./internal/wire/...`, the
+thin package, `./internal/thintest -run 'Connection|SignIn|Token|Add'`,
+`./internal/headless -run 'TestHeadlessConnections$|TestHeadlessToken|TestHeadlessClaudeSignIn'`
+and the connection browser tests (`-tags browser`).
+
+### To confirm on the first live use
+
+What CLI 2.1.312 prints after a right code (the runner takes the first
+whole `sk-ant-oat` token) and after a wrong one (it looks for error,
+invalid, failed, expired or wrong, then the prompt again); that a typed
+code followed by a separate carriage return is entered; whether the CLI
+exits after printing the token; what it writes into the home; and that
+the first live paste's checks in §2.4 still hold for a token made this
+way.
diff --git a/docs/superpowers/specs/2026-11-08-equipo-connections.md b/docs/superpowers/specs/2026-11-08-equipo-connections.md
index fd04de50..a8f35fcc 100644
--- a/docs/superpowers/specs/2026-11-08-equipo-connections.md
+++ b/docs/superpowers/specs/2026-11-08-equipo-connections.md
@@ -577,6 +577,45 @@ live paste: `claude auth status --json` reports `loggedIn: true` with
only the variable set; the CLI writes no `.credentials.json` into the
home; and the variable is absent from the model's Bash environment.
+**Claude's sign-in by a link, as built (2026-11-10).** Paul, looking at
+the token card: "Can you not run this on the server and get a link to
+give to the browser? We're trying to avoid the round-trip over SSH
+here." Ruling: the one-time sign-in code is relayed through Equipo,
+sealed, the same category of risk accepted for the pasted token. This
+replaces §2.3 case 2's terminal card (and its watcher) as the way to
+add Claude with the browser elsewhere. The runner runs the unmodified
+`claude setup-token` itself, on a pseudo-terminal in the connection's
+new home with the login environment and `BROWSER` a program that opens
+nothing, and reads the authorize URL it prints (through ANSI and OSC 8
+escapes and redraws; only https on claude.com or claude.ai whose
+redirect is `platform.claude.com/oauth/code/callback`). The card
+(prompt kind `authorize_link`) shows Open Anthropic and Copy link, then
+"Paste the code Anthropic shows you". The page seals the code exactly
+as it seals a token, bound to `endpoint`
+`https://platform.claude.com/oauth/code/callback` and to the card's
+`attempt`; the instance relays one box per card. The runner checks the
+box as it checks a token's, records `(connection, attempt)` in
+`seen_seals` in one transaction with the attempt still running, and
+types the code into the waiting CLI; the code is never written to
+disk. The token the CLI prints is kept exactly as a pasted one (the
+0600 `.oauth-token`, committed with the attempt turned kind `token`),
+then probed, bound and checked with one real request; healthy only
+then. A wrong code is said on the card with the next attempt: the same
+link while the CLI asks again, else the CLI is started again and the
+card shows its new link. The CLI exiting on its own starts it again
+with a new link (at most four runs, five codes). Cancel and the
+attempt's time limit kill the CLI's process group and remove the home.
+A stop before the token is committed loses the CLI with the process:
+the restart ends the attempt `runner_offline` and deletes its home;
+after the commit the restart carries it on as a token attempt. To
+confirm on the first live use, since only the start was observed (CLI
+2.1.321): what the CLI prints after a right code (the runner takes the
+first whole `sk-ant-oat` token in its output) and after a wrong one
+(the runner looks for error, invalid, failed, expired or wrong, then
+the prompt again), that a typed code followed by a separate carriage
+return is taken as entered, whether it exits after printing the token,
+and what it writes into the home.
+
**Sealing.** The app seals with libsodium `crypto_box_seal` over a
payload `{secret, runner_id, connection_id, provider, endpoint,
attempt, expires_at}`, where `endpoint` is the full origin, scheme,
@@ -663,8 +702,8 @@ sources in §1:
| Codex (ChatGPT plan) | Device code via `account/login/start` | No | Runner, by the app-server polling OpenAI | Runner home (`auth.json`) |
| Codex (API key) | Sealed key | No | n/a | Runner home |
| Claude (subscription), browser on runner's machine | CLI's own loopback OAuth, app shows the link | No | Runner, by the CLI | Runner home (`.credentials.json`, or Keychain on a Mac) |
-| Claude (subscription), runner remote | Terminal at the runner: `equipo-runner login claude` | Yes, into the CLI, never into Equipo | Runner, by the CLI | Runner home |
-| Claude (`setup-token`) | Not offered: Equipo would be handling the token | n/a | n/a | n/a |
+| Claude (subscription), runner remote | The runner's own `claude setup-token`; the app shows its link (as built 2026-11-10, §2.4) | Yes, the code, sealed to the runner and typed into the CLI | Runner, by the CLI | Runner home (`.oauth-token`) |
+| Claude (`setup-token`) | A pasted token, sealed to the runner (as built 2026-11-09, §2.4) | Yes, sealed | n/a | Runner home (`.oauth-token`) |
| Claude (API key) | Sealed key | No | n/a | Runner home |
| OpenRouter | PKCE: app opens `openrouter.ai/auth?callback_url=…&code_challenge=…`; the callback lands on Equipo's web app or the native app's link; the app seals `code` plus `code_verifier` to the runner, which POSTs `/api/v1/auth/keys` and keeps the returned key | No | Runner | Runner home |
| Local or other endpoint | Sealed key or none, test call | No | n/a | Runner home |
diff --git a/internal/equipo/static/equipo.css b/internal/equipo/static/equipo.css
index cf4d90de..452ef2b6 100644
--- a/internal/equipo/static/equipo.css
+++ b/internal/equipo/static/equipo.css
@@ -883,6 +883,7 @@ a[equipo-source]:hover { color: var(--rst-text); text-decoration: underline; tex
[equipo-conn-token-row] input { flex: 1 1 14rem; min-inline-size: 0; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
[equipo-conn-token] [data-token-note], [equipo-conn-token] [data-token-trust] { margin: 0; }
[equipo-conn-token] [data-token-note][data-tone="bad"] { color: var(--rst-tone-negative-fg); }
+[equipo-conn-token] [data-code-wrong] { margin: 0; color: var(--rst-tone-negative-fg); }
[equipo-conn-expires] { font-size: var(--rst-fs-xs); color: var(--rst-text-muted); white-space: nowrap; }
[equipo-conn-renew] { font-size: var(--rst-fs-xs); color: var(--rst-tone-warning-fg); }
[equipo-conn-renew] [equipo-link] { font-size: inherit; }
diff --git a/internal/headless/browser_conn_add_test.go b/internal/headless/browser_conn_add_test.go
index 66bf47a1..12b7493b 100644
--- a/internal/headless/browser_conn_add_test.go
+++ b/internal/headless/browser_conn_add_test.go
@@ -121,7 +121,7 @@ func TestBrowserConnectionsEndedNote(t *testing.T) {
p.run(chromedp.Navigate(inst.URL+"/conversation/settings/connections/add"), browsertest.Wait(note+`.length===1`))
p.check(`(()=>{window.__equipoStayed=true;document.querySelector('[data-add="claude"]').click();return `+note+`.length===0})()`, "a new attempt left the notice")
runner.expect(t, wire.FrameConnect)
- p.run(waitLong(`!!document.querySelector('[data-token-form]') && ` + note + `.length===0`))
+ p.run(waitLong(`!!document.querySelector('[data-connecting][data-provider="claude"]') && ` + note + `.length===0`))
p.check(stayed, "the page reloaded or navigated")
})
}
diff --git a/internal/headless/browser_connections_test.go b/internal/headless/browser_connections_test.go
index aadf5612..d1cf65b0 100644
--- a/internal/headless/browser_connections_test.go
+++ b/internal/headless/browser_connections_test.go
@@ -79,8 +79,8 @@ const stayed = `window.__equipoStayed === true && performance.getEntriesByType('
// A1 and A4: Add Codex shows its card at once (a loading line, then the
// three steps with the code once), Copy copies, and the approval lands in
-// place, with no reload; Add Claude, with the browser elsewhere, shows
-// only the finish-on-runner steps.
+// place, with no reload; Add Claude shows the link the runner's own
+// setup-token printed, and the code field.
func TestBrowserConnectionsAdd(t *testing.T) {
for _, width := range []int64{390, 1280} {
t.Run(strconv.FormatInt(width, 10), func(t *testing.T) {
@@ -109,14 +109,14 @@ func TestBrowserConnectionsAdd(t *testing.T) {
// Prefer Codex: pressed at once, and still after the stream's refresh.
p.check(`(()=>{document.querySelector('[data-prefer="codex"]').click();return document.querySelector('[data-prefer="codex"]').getAttribute('aria-pressed')==='true'})()`, "Prefer Codex")
p.run(waitLong(`document.querySelector('[data-prefer="codex"]').getAttribute('aria-pressed')==='true' && !!document.querySelector('[equipo-conn-row][data-provider="codex"] [equipo-conn-pref]')`))
- // Claude's sign-in on the runner, the chooser's quiet way in
- // beside Paste a token.
+ // Claude: the real runner starts its own sign-in (the fake
+ // setup-token) and the card shows the link it printed.
p.check(`(()=>{document.querySelector('[data-add-link]').click();return true})()`, "Add a connection")
- p.run(waitLong(`location.pathname==='/conversation/settings/connections/add' && !!document.querySelector('[equipo-conn-chooser] [data-sign-in-instead]')`))
- p.check(`(()=>{window.__equipoStayed=true;document.querySelector('[equipo-conn-chooser] [data-sign-in-instead]').click();return !!document.querySelector('[data-connecting][data-provider="claude"]')})()`, "no card the instant Claude's sign-in is chosen")
- p.run(browsertest.Wait(`!!document.querySelector('[data-finish-on]')`))
- p.check(`document.querySelector('[data-finish-on] [data-command]').textContent.includes('equipo-runner login claude') && document.querySelectorAll('[data-finish-on] > li').length===3 && !!document.querySelector('[data-finish-on] [data-copy]') && !!document.querySelector('[data-same-machine]') && !document.querySelector('[data-sign-in]') && !document.querySelector('input[type="password"],input[name="code"]')`, "the finish-on-runner card is not the only way shown, or it asks for a paste")
- connShot(t, p, "claude-terminal", width)
+ p.run(waitLong(`location.pathname==='/conversation/settings/connections/add' && !!document.querySelector('[equipo-conn-chooser] [data-add="claude"]')`))
+ p.check(`(()=>{window.__equipoStayed=true;document.querySelector('[data-add="claude"]').click();return !!document.querySelector('[data-connecting][data-provider="claude"]')})()`, "no card the instant Claude is chosen")
+ p.run(waitLong(`!!document.querySelector('[data-code-steps]')`))
+ p.check(`(()=>{const open=document.querySelector('[data-code-steps] [data-open-anthropic]');const u=new URL(open.href);return u.host==='claude.com' && u.searchParams.get('redirect_uri')==='`+wire.EndpointClaudeCode+`' && open.target==='_blank' && !!document.querySelector('[data-code-field]') && !document.querySelector('[data-finish-on],[data-same-machine]')})()`, "the sign-in card is not the runner's link with the code field")
+ connShot(t, p, "claude-sign-in", width)
p.check(`(()=>{document.querySelector('[data-connecting][data-provider="claude"] [data-connection-cancel]').click();return true})()`, "Cancel")
p.run(waitLong(`!document.querySelector('[data-connecting]') && !!document.querySelector('[equipo-conn-chooser]')`))
p.check(stayed, "the page reloaded or navigated")
diff --git a/internal/headless/browser_signin_test.go b/internal/headless/browser_signin_test.go
new file mode 100644
index 00000000..dae7d0ec
--- /dev/null
+++ b/internal/headless/browser_signin_test.go
@@ -0,0 +1,147 @@
+//go:build browser
+
+package headless
+
+import (
+ "strconv"
+ "testing"
+ "time"
+
+ "amadan.net/oficina/equipo/internal/browsertest"
+ "amadan.net/oficina/equipo/internal/thintest"
+ "amadan.net/oficina/equipo/internal/wire"
+ "github.com/chromedp/chromedp"
+)
+
+// signInDay is where the sign-in card's screenshots go.
+const signInDay = "2026-11-10"
+
+// canarySignInCode is an obviously fake sign-in code.
+const canarySignInCode = "CANARY-sign-in-code-not-real#CANARYSTATE"
+
+// signInLinks are the authorize links the fake runner's CLI printed.
+var signInLinks = []string{
+ "https://claude.com/cai/oauth/authorize?code=true&client_id=fake&response_type=code&redirect_uri=https%3A%2F%2Fplatform.claude.com%2Foauth%2Fcode%2Fcallback&state=first",
+ "https://claude.com/cai/oauth/authorize?code=true&client_id=fake&response_type=code&redirect_uri=https%3A%2F%2Fplatform.claude.com%2Foauth%2Fcode%2Fcallback&state=second",
+}
+
+// Paul, 2026-11-10: "Can you not run this on the server and get a link
+// to give to the browser?" Claude in the chooser is the sign-in by a
+// link, with Paste a token you already have beside it. The card arrives
+// at once, then the runner's link: Open Anthropic with Copy link beside
+// it (under it when a phone is too narrow), and
+// Paste the code Anthropic shows you with a field and Connect. A code is
+// checked here, sealed here to the runner's key for the code endpoint
+// and the card's attempt, the field cleared at once; the card waits. A
+// wrong code's card says so with the next attempt; the right one
+// connects, with the flourish, and the row has the token's expiry.
+func TestBrowserConnectionsSignIn(t *testing.T) {
+ for _, width := range []int64{1280, 390} {
+ t.Run(strconv.FormatInt(width, 10), func(t *testing.T) {
+ inst := thintest.StartInstance(t)
+ runner := dialFake(t, inst)
+ c := inst.Cookie()
+ p := openPage(t, inst.URL, c.Name, c.Value, width, 900, width > 600)
+ t.Cleanup(p.stop)
+ shot := func(name string) { t.Helper(); connShotOn(t, p, signInDay, name, width) }
+ p.run(chromedp.Navigate(inst.URL+"/conversation/settings/connections/add"), browsertest.Wait(`!!document.querySelector('[data-connections]') && !!window.EquipoSeal && !!window.nacl`))
+ p.check(`(()=>{window.__equipoStayed=true;window.__copied=[];navigator.clipboard.writeText=t=>{window.__copied.push(t);return Promise.resolve()};return true})()`, "mark")
+ p.check(recordPosts, "record posts")
+
+ // The chooser: Claude signs in at Anthropic; the token is the
+ // quiet second way.
+ p.check(`(()=>{const how=document.querySelector('[data-add="claude"] [data-sign-in-how]');const alt=document.querySelector('[equipo-conn-chooser] [data-paste-instead]');return !!how && how.textContent==='Sign in at Anthropic' && how.checkVisibility() && !!alt && alt.textContent==='Paste a token you already have' && alt.checkVisibility() && !document.querySelector('[data-paste-token],[data-sign-in-instead],[data-same-machine],[data-finish-on]')})()`, "the chooser is not the sign-in by a link with Paste a token beside it")
+ p.run(waitLong(`document.getAnimations().every(a=>a.playState!=='running'||a.effect&&a.effect.getTiming().iterations===Infinity)`))
+ shot("signin-chooser")
+ p.check(`(()=>{document.querySelector('[data-add="claude"]').click();return !!document.querySelector('[data-connecting][data-provider="claude"] [data-loading]')})()`, "no card the instant Claude is chosen")
+ cmd := runner.expect(t, wire.FrameConnect).(*wire.ConnectCommand)
+ if cmd.Provider != "claude" || cmd.Kind != wire.KindSubscription || cmd.SameMachine {
+ t.Fatalf("connect frame %+v", cmd)
+ }
+ // The server's card: still starting, until the runner's link.
+ p.run(waitLong(`!!document.querySelector('[data-connecting][data-connection="` + cmd.Connection + `"] [data-loading]')`))
+ runner.send(t, wire.FrameConnection, wire.ConnectionReport{Connection: cmd.Connection, Person: thintest.Owner, Provider: "claude", State: wire.ConnConnecting, Prompt: &wire.ConnectPrompt{Kind: wire.PromptAuthorize, URL: signInLinks[0], Attempt: 1}})
+ p.run(waitLong(`!!document.querySelector('[data-code-steps]')`))
+ p.check(`(()=>{const card=document.querySelector('[data-connecting][data-kind="sign_in"]');const steps=card.querySelectorAll('[data-code-steps] > li');const open=card.querySelector('[data-open-anthropic]');const copy=open.parentElement.querySelector('[data-copy-link]');const field=card.querySelector('[data-code-field]');const a=open.getBoundingClientRect(),b=copy.getBoundingClientRect();return card.querySelector('h3').textContent==='Connect Claude' && steps.length===2 && open.textContent.trim()==='Open Anthropic' && open.getAttribute('rst-btn')==='primary' && open.getAttribute('href')===`+jsonString(signInLinks[0])+` && open.target==='_blank' && copy.textContent==='Copy link' && copy.dataset.copy===open.getAttribute('href') && (Math.abs(a.top-b.top)<4 && b.left>a.right || b.top>=a.bottom && Math.abs(a.left-b.left)<2) && steps[1].querySelector('label').textContent==='Paste the code Anthropic shows you' && field.type==='password' && !field.name && card.querySelector('[data-code-connect]').textContent==='Connect' && field.form.querySelector('[data-token-trust]').textContent===`+jsonString(sealedWords)+` && !card.querySelector('[data-code-wrong]') && card.dataset.attempt==='1' && card.dataset.endpoint==='`+wire.EndpointClaudeCode+`' && !!card.dataset.sealKey && card.querySelector('[equipo-conn-card-foot] [data-paste-instead]').textContent==='Paste a token you already have' && !card.textContent.includes('claude.com') && document.documentElement.scrollWidth<=innerWidth+1})()`, "the sign-in card is not Open Anthropic with Copy link, then the code field")
+ p.run(waitLong(`document.getAnimations().every(a=>a.playState!=='running'||a.effect&&a.effect.getTiming().iterations===Infinity)`))
+ shot("signin-card")
+ p.check(`(()=>{document.querySelector('[data-code-steps] [data-copy-link]').click();return true})()`, "Copy link")
+ p.run(waitLong(`document.querySelector('[data-code-steps] [data-copy-link]').textContent==='Copied' && window.__copied[0]===` + jsonString(signInLinks[0])))
+
+ // Not a code: said here, no request; a token pasted as the code
+ // is not one either.
+ for _, bad := range []string{"abc", "sk-ant-oat01-a-token-in-the-code-field"} {
+ p.check(`(()=>{window.__posts=[];const f=document.querySelector('[data-code-field]');f.value=`+jsonString(bad)+`;f.form.requestSubmit();const note=document.querySelector('[data-code-steps] [data-token-note]');return f.value==='' && !note.hidden && note.textContent==="That is not the code. Copy the whole code from Anthropic's page." && window.__posts.length===0})()`, "a bad code was not refused before any request: "+bad)
+ }
+ shot("signin-bad")
+
+ // A code: sealed here, posted, the field cleared at once, the
+ // card waiting.
+ p.check(`(()=>{window.__posts=[];const f=document.querySelector('[data-code-field]');f.value=`+jsonString(canarySignInCode)+`;f.form.requestSubmit();return f.value===''})()`, "the field was not cleared at once")
+ p.run(waitLong(`window.__posts.length===1 && [...document.querySelectorAll('[data-connecting][data-kind="sign_in"] [equipo-conn-waiting]')].some(w=>w.checkVisibility() && w.textContent.includes('Your runner is finishing the sign-in'))`))
+ p.check(`(()=>{const post=window.__posts[0];const b=JSON.parse(post.body);return post.url.endsWith('/secret') && !post.body.includes('CANARY') && typeof b.box==='string' && b.attempt===1 && b.provider==='claude' && b.endpoint==='`+wire.EndpointClaudeCode+`' && !document.documentElement.outerHTML.includes('CANARY')})()`, "the request or the page holds the code")
+ shot("signin-waiting")
+ secret := runner.expect(t, wire.FrameSecret).(*wire.SecretCommand)
+ opened := runner.open(t, secret.Sealed)
+ if opened.Secret != canarySignInCode || opened.Endpoint != wire.EndpointClaudeCode || opened.Attempt != 1 || opened.ConnectionID != cmd.Connection || opened.Provider != "claude" || !opened.ExpiresAt.Equal(secret.Sealed.ExpiresAt) {
+ t.Fatal("the opened code does not match its clear binding")
+ }
+ if left := time.Until(opened.ExpiresAt); left < 8*time.Minute || left > wire.SealedTTL {
+ t.Fatalf("the box expires in %v", left)
+ }
+ p.run(waitLong(`!document.querySelector('[data-code-form]') && !!document.querySelector('[data-connecting][data-kind="sign_in"] [equipo-conn-waiting]')`))
+
+ // Wrong: the CLI started again with a new link; the card says so.
+ runner.send(t, wire.FrameConnection, wire.ConnectionReport{Connection: cmd.Connection, Person: thintest.Owner, Provider: "claude", State: wire.ConnConnecting, Prompt: &wire.ConnectPrompt{Kind: wire.PromptAuthorize, URL: signInLinks[1], Attempt: 2, WrongCode: true}})
+ p.run(waitLong(`(()=>{const card=document.querySelector('[data-connecting][data-kind="sign_in"]');const w=card&&card.querySelector('[data-code-wrong]');return !!w && w.checkVisibility() && getComputedStyle(w).color!==getComputedStyle(card.querySelector('[data-token-trust]')).color && w.textContent==='That code did not work. Open Anthropic again and paste the new code.' && card.dataset.attempt==='2' && card.querySelector('[data-open-anthropic]').getAttribute('href')===` + jsonString(signInLinks[1]) + `})()`))
+ shot("signin-wrong")
+ p.check(`(()=>{window.__posts=[];const f=document.querySelector('[data-code-field]');f.value=`+jsonString(canarySignInCode)+`;f.form.requestSubmit();return f.value===''})()`, "the second code")
+ p.run(waitLong(`window.__posts.length===1 && JSON.parse(window.__posts[0].body).attempt===2`))
+ if second := runner.expect(t, wire.FrameSecret).(*wire.SecretCommand); second.Sealed.Attempt != 2 || runner.open(t, second.Sealed).Attempt != 2 {
+ t.Fatal("the second code's attempt")
+ }
+
+ // Connected: the flourish, then the row, a token connection.
+ expires := time.Now().UTC().Add(wire.TokenLifetime)
+ runner.send(t, wire.FrameConnection, wire.ConnectionReport{Connection: cmd.Connection, Person: thintest.Owner, LocalID: "claude-1", Provider: "claude", State: wire.ConnHealthy, Label: second})
+ runner.hello(t, wire.HeldConnection{LocalID: "claude-1", Person: thintest.Owner, Provider: "claude", Kind: wire.KindToken, Label: second, State: wire.ConnHealthy, ExpiresAt: &expires, ExpiresEstimated: true})
+ p.check(stayed, "the page reloaded or navigated before Claude connected")
+ p.run(waitLong(`location.pathname==='/conversation/settings/connections' && [...document.querySelectorAll('[equipo-conn-row][data-provider="claude"]')].some(e=>!e.hidden && e.textContent.includes('` + second + `') && e.querySelector('[data-token-expires]')?.textContent==='Expires about ` + expires.Format("2 Jan 2006") + `')`))
+ p.check(`!document.documentElement.outerHTML.includes('CANARY')`, "the code is on the page")
+ shot("signin-connected")
+ })
+ }
+}
+
+// Switching ways: the sign-in card's Paste a token you already have
+// gives way to the token card, and the token card's Or sign in at
+// Anthropic instead back to the sign-in; each switch cancels the open
+// attempt on the runner, unsaid.
+func TestBrowserConnectionsSignInSwitch(t *testing.T) {
+ inst := thintest.StartInstance(t)
+ runner := dialFake(t, inst)
+ c := inst.Cookie()
+ p := openPage(t, inst.URL, c.Name, c.Value, 390, 900, false)
+ t.Cleanup(p.stop)
+ p.run(chromedp.Navigate(inst.URL+"/conversation/settings/connections/add"), browsertest.Wait(`!!document.querySelector('[data-connections]')`))
+ p.check(`(()=>{window.__equipoStayed=true;document.querySelector('[data-add="claude"]').click();return true})()`, "Claude")
+ first := runner.expect(t, wire.FrameConnect).(*wire.ConnectCommand)
+ runner.send(t, wire.FrameConnection, wire.ConnectionReport{Connection: first.Connection, Person: thintest.Owner, Provider: "claude", State: wire.ConnConnecting, Prompt: &wire.ConnectPrompt{Kind: wire.PromptAuthorize, URL: signInLinks[0], Attempt: 1}})
+ p.run(waitLong(`!!document.querySelector('[data-code-steps]')`))
+ p.check(`(()=>{document.querySelector('[data-connecting] [data-paste-instead]').click();return true})()`, "Paste a token you already have")
+ if v := runner.expect(t, wire.FrameCancelConnect).(*wire.CancelConnectCommand); v.Connection != first.Connection {
+ t.Fatalf("cancel %+v", v)
+ }
+ token := runner.expect(t, wire.FrameConnect).(*wire.ConnectCommand)
+ if token.Kind != wire.KindToken {
+ t.Fatalf("connect %+v", token)
+ }
+ p.run(waitLong(`!!document.querySelector('[data-token-form]') && !document.querySelector('[data-code-steps]') && !document.querySelector('[data-connection-note]')`))
+ p.check(`(()=>{const b=document.querySelector('[data-connecting] [data-sign-in-instead]');return b.textContent==='Or sign in at Anthropic instead' && (b.click(),true)})()`, "Or sign in at Anthropic instead")
+ runner.expect(t, wire.FrameCancelConnect)
+ if again := runner.expect(t, wire.FrameConnect).(*wire.ConnectCommand); again.Kind != wire.KindSubscription || again.SameMachine {
+ t.Fatalf("connect %+v", again)
+ }
+ p.run(waitLong(`!!document.querySelector('[data-connecting][data-provider="claude"] [data-loading]') && !document.querySelector('[data-token-form]')`))
+ p.check(stayed, "the page reloaded or navigated")
+}
diff --git a/internal/headless/browser_token_test.go b/internal/headless/browser_token_test.go
index 8772752b..d06ddce9 100644
--- a/internal/headless/browser_token_test.go
+++ b/internal/headless/browser_token_test.go
@@ -148,11 +148,11 @@ func TestBrowserConnectionsToken(t *testing.T) {
p.check(`(()=>{window.__equipoStayed=true;return true})()`, "mark")
p.check(recordPosts, "record posts")
- // The chooser: Claude is Paste a token, with the sign-in on
- // the runner a quiet link under it.
- p.check(`(()=>{const how=document.querySelector('[data-add="claude"] [data-paste-token]');const alt=document.querySelector('[equipo-conn-chooser] [data-sign-in-instead]');return !!how && how.textContent==='Paste a token' && how.checkVisibility() && !!alt && alt.textContent==='Or sign in on the runner instead' && alt.checkVisibility()})()`, "the chooser does not offer Paste a token with the quiet sign-in link")
+ // The chooser: Paste a token you already have, the quiet link
+ // beside Claude's sign-in by a link (TestBrowserConnectionsSignIn).
+ p.check(`(()=>{const alt=document.querySelector('[equipo-conn-chooser] [data-paste-instead]');return !!alt && alt.textContent==='Paste a token you already have' && alt.checkVisibility()})()`, "the chooser does not offer Paste a token you already have")
shot("token-chooser")
- p.check(`(()=>{document.querySelector('[data-add="claude"]').click();return !!document.querySelector('[data-connecting][data-provider="claude"]')})()`, "no card the instant Claude is chosen")
+ p.check(`(()=>{document.querySelector('[equipo-conn-chooser] [data-paste-instead]').click();return !!document.querySelector('[data-connecting][data-provider="claude"]')})()`, "no card the instant Paste a token is chosen")
p.run(waitLong(`!!document.querySelector('[data-token-form]')`))
if cmd := runner.expect(t, wire.FrameConnect).(*wire.ConnectCommand); cmd.Kind != wire.KindToken || cmd.Provider != "claude" {
t.Fatalf("connect frame %+v", cmd)
diff --git a/internal/runner/thin/signin_test.go b/internal/runner/thin/signin_test.go
index fb2ae0fb..01da9ee1 100644
--- a/internal/runner/thin/signin_test.go
+++ b/internal/runner/thin/signin_test.go
@@ -188,6 +188,7 @@ func (r *tokenRig) nowhere(secret, what string) {
// The CLI's argv is setup-token alone; the code is on no disk and in no
// log, the token only in its file.
func TestSignInConnect(t *testing.T) {
+ t.Parallel()
r := newTokenRig(t)
c := r.connector()
link, home := r.signIn(c, "cn_s1")
@@ -230,6 +231,7 @@ func TestSignInConnect(t *testing.T) {
// The check is what makes the connection: a token the provider refuses
// ends the attempt provider_refused, nothing kept.
func TestSignInTokenRejected(t *testing.T) {
+ t.Parallel()
r := newTokenRig(t)
c := r.connector()
refused := error(provider.ErrLoginRequired)
@@ -254,6 +256,7 @@ func TestSignInTokenRejected(t *testing.T) {
// A wrong code while the CLI asks again: the card says so with the same
// link and the next attempt; the right code then connects.
func TestSignInWrongCodeAgain(t *testing.T) {
+ t.Parallel()
r := newTokenRig(t)
c := r.connector()
link, home := r.signIn(c, "cn_w1")
@@ -286,6 +289,7 @@ func (r *tokenRig) healthy2(id, home, token, email string, seals int) {
// the code was wrong with the new link. The first link's code does not
// work on the new run; the new one's does.
func TestSignInWrongCodeRestarts(t *testing.T) {
+ t.Parallel()
r := newTokenRig(t)
r.steer("exit_on_wrong")
c := r.connector()
@@ -308,6 +312,7 @@ func TestSignInWrongCodeRestarts(t *testing.T) {
// new link (no wrong code said), up to maxLaunches runs, then the
// attempt ends timed_out, the home gone.
func TestSignInCLIExpires(t *testing.T) {
+ t.Parallel()
r := newTokenRig(t)
r.steer("expire_ms=300")
c := r.connector()
@@ -328,6 +333,7 @@ func TestSignInCLIExpires(t *testing.T) {
// The CLI fails before any link: provider_refused, the home gone.
func TestSignInCLIFailsToStart(t *testing.T) {
+ t.Parallel()
r := newTokenRig(t)
r.steer("fail_start")
c := r.connector()
@@ -346,6 +352,7 @@ func TestSignInCLIFailsToStart(t *testing.T) {
// killed, the home deleted, the end reported; a code after is acked and
// dropped, never typed.
func TestSignInCancelAndLimit(t *testing.T) {
+ t.Parallel()
r := newTokenRig(t)
c := r.connector()
link, home := r.signIn(c, "cn_k1")
@@ -377,10 +384,12 @@ func TestSignInCancelAndLimit(t *testing.T) {
// A code's box: the resend is acked and nothing else; a box for an
// attempt the CLI no longer waits for is dropped and the attempt waits
-// on; a token's box, an expired one, one with a code that holds a token
-// and one for another runner are refused, ending the attempt; a code's
-// box to a token attempt is refused too.
+// on; a code bound as a token, an expired box, a token sealed as the
+// code and a box for another runner are refused, ending the attempt; a
+// code's box to a token attempt is refused too. (The code bound as a
+// token would sign in: only its binding refuses it.)
func TestSignInCodeReplayAndRefusals(t *testing.T) {
+ t.Parallel()
r := newTokenRig(t)
c := r.connector()
link, home := r.signIn(c, "cn_r1")
@@ -405,8 +414,8 @@ func TestSignInCodeReplayAndRefusals(t *testing.T) {
name, reason string
box func(id, link string) wire.SecretCommand
}{
- {"a token's box", "provider_refused", func(id, link string) wire.SecretCommand {
- return r.sealed(id, fakeclaude.Token("x@example.com"), nil)
+ {"a code bound as a token", "provider_refused", func(id, link string) wire.SecretCommand {
+ return r.sealed(id, codeFor(link, "x@example.com"), nil)
}},
{"expired", "timed_out", func(id, link string) wire.SecretCommand {
return r.sealedCode(id, codeFor(link, "x@example.com"), 1, func(p *wire.SealedPayload) { p.ExpiresAt = time.Now().Add(-time.Second).UTC() })
@@ -450,6 +459,7 @@ func TestSignInCodeReplayAndRefusals(t *testing.T) {
// dropped. Once committed, the restart carries the attempt on as a token
// attempt to healthy. The code is never on disk.
func TestSignInSurvivesCrashes(t *testing.T) {
+ t.Parallel()
for _, stage := range []string{"code_opened", "code_committed", "code_typed", "staged", "transaction", "committed"} {
t.Run(stage, func(t *testing.T) {
r := newTokenRig(t)
@@ -494,6 +504,7 @@ func TestSignInSurvivesCrashes(t *testing.T) {
// The CLI killed mid-sign-in by its own crash (not the runner's): it is
// started again with a new link, and nothing is left of the first run.
func TestSignInCLIDies(t *testing.T) {
+ t.Parallel()
r := newTokenRig(t)
c := r.connector()
link, _ := r.signIn(c, "cn_d1")
diff --git a/internal/runner/thin/token.go b/internal/runner/thin/token.go
index b0b3b9f7..bf3e8207 100644
--- a/internal/runner/thin/token.go
+++ b/internal/runner/thin/token.go
@@ -450,8 +450,9 @@ func (c *Connector) resumeToken(ctx context.Context, id, person, home, created s
// is renamed to the token file, the directory synced; (iv) acked by the
// link once this returns nil. A resend of a delivered pair is acked and
// nothing else. A refused box ends a waiting attempt with a reason; one
-// for no waiting attempt is acked and dropped. Nothing secret reaches a
-// log, an error or a report.
+// for no waiting attempt is acked and dropped. A box for a sign-in
+// attempt is a code (code, signin.go). Nothing secret reaches a log, an
+// error or a report.
func (c *Connector) Secret(ctx context.Context, frameID string, cmd wire.SecretCommand) error {
c.delivery.Lock()
defer c.delivery.Unlock()
diff --git a/internal/thintest/connections_add_pages_test.go b/internal/thintest/connections_add_pages_test.go
index e9bf4d86..62ac8339 100644
--- a/internal/thintest/connections_add_pages_test.go
+++ b/internal/thintest/connections_add_pages_test.go
@@ -27,7 +27,7 @@ func TestPagesConnectionsAdd(t *testing.T) {
t.Fatal("Connections does not link to the Add page, or still holds the chooser")
}
add := r.get(owner, "/conversation/settings/connections/add", 200)
- for _, want := range []string{`data-settings-link="connections" aria-current="page"`, `href="/conversation/settings/connections" rel="up" aria-label="Connections"`, "<title>Add a connection</title>", `data-add="claude"`, `data-add="codex"`, "data-sign-in-instead", "data-adding"} {
+ for _, want := range []string{`data-settings-link="connections" aria-current="page"`, `href="/conversation/settings/connections" rel="up" aria-label="Connections"`, "<title>Add a connection</title>", `data-add="claude"`, `data-add="codex"`, "data-paste-instead", "data-sign-in-how", "data-adding"} {
if !strings.Contains(add, want) {
t.Fatalf("the Add page lacks %s", want)
}
diff --git a/scripts/runner-reference-allowlist.json b/scripts/runner-reference-allowlist.json
index 2d1dc2d1..374f7760 100644
--- a/scripts/runner-reference-allowlist.json
+++ b/scripts/runner-reference-allowlist.json
@@ -10548,76 +10548,6 @@
"count": 1,
"reason": "WebKit keyboard test only: Playwright's WebKit is driven from a test script, never part of the runner or a release."
},
- {
- "path": "internal/equipo/chat/connections.go",
- "line_sha256": "168f7e695d41a2783d404dcc6dd5206b8759a0d6cf69971e8be13905eb082b18",
- "match": "equipo-runner",
- "count": 1,
- "reason": "The finish-on-runner card shows the equipo-runner login claude command the person runs at the runner"
- },
- {
- "path": "internal/equipo/chat/connections.go",
- "line_sha256": "6981aa1a783e706b5e929437a30996fa181504ae9c8f59e2eb11ab7e319a7309",
- "match": "equipo-runner",
- "count": 1,
- "reason": "The finish-on-runner card shows the equipo-runner login claude command the person runs at the runner"
- },
- {
- "path": "internal/runner/thin/connector.go",
- "line_sha256": "828e28b4f7d1792521c51c2ea4136ce15b868d8a9e719919c3a5c615fa1d6e3d",
- "match": "equipo-runner",
- "count": 1,
- "reason": "The connector names and watches for the equipo-runner login claude terminal sign-in"
- },
- {
- "path": "internal/runner/thin/connector.go",
- "line_sha256": "831f53a973409b742ce2ffc68720d30fdaaf68338f4c2c85f642477ad652c6e9",
- "match": "equipo-runner",
- "count": 1,
- "reason": "The connector names and watches for the equipo-runner login claude terminal sign-in"
- },
- {
- "path": "internal/runner/thin/connector.go",
- "line_sha256": "f3faef9a481019aba00e69b14b06a3560bcf4db41e85777d14d09bc7e360e771",
- "match": "equipo-runner",
- "count": 1,
- "reason": "The connector names and watches for the equipo-runner login claude terminal sign-in"
- },
- {
- "path": "internal/headless/browser_connections_test.go",
- "line_sha256": "c5e34cedcb824cb0e876850dee24c3911cef71569b56d93da85bb03133e71165",
- "match": "equipo-runner",
- "count": 1,
- "reason": "Browser test checks the finish-on-runner card shows the equipo-runner login claude command"
- },
- {
- "path": "internal/headless/connections_test.go",
- "line_sha256": "87ddc6283f3738e2adb25dba0b8778bab53704a5560a3a011f046daba7b2071d",
- "match": "equipo-runner",
- "count": 1,
- "reason": "Headless test runs and checks the equipo-runner login claude terminal sign-in"
- },
- {
- "path": "internal/headless/connections_test.go",
- "line_sha256": "de18b1bc5b81ca56a29be9fbb9130a94465bbe6fd698b817e1ba62ab743e33bc",
- "match": "equipo-runner",
- "count": 1,
- "reason": "Headless test runs and checks the equipo-runner login claude terminal sign-in"
- },
- {
- "path": "internal/headless/connections_test.go",
- "line_sha256": "e1e905aab937e9c5600ecaf42ec52ec442e529e98bac7918246e68e97650151f",
- "match": "equipo-runner",
- "count": 1,
- "reason": "Headless test runs and checks the equipo-runner login claude terminal sign-in"
- },
- {
- "path": "internal/thintest/connections_contract_test.go",
- "line_sha256": "a1853f5fc2caaa8d19aa79d515b1c9a439704c70a3db81ea29d0052a56327eb8",
- "match": "equipo-runner",
- "count": 1,
- "reason": "Contract test checks the finish-on-runner prompt carries the equipo-runner login claude command"
- },
{
"path": "docs/superpowers/specs/2026-11-08-equipo-connections.md",
"line_sha256": "05bce89739bc7ec8645eab25c91a2c09d85edc71bbfc17087b7ad5a5bf2f762d",
@@ -10646,13 +10576,6 @@
"count": 1,
"reason": "Connections design: the runner command and the npm/Node packages of the harnesses it compares are described, not run"
},
- {
- "path": "docs/superpowers/specs/2026-11-08-equipo-connections.md",
- "line_sha256": "8b68e6eebd046502d8b2680991668d99fa3976c241ba85231eb5d545829fc81d",
- "match": "equipo-runner",
- "count": 1,
- "reason": "Connections design: the runner command and the npm/Node packages of the harnesses it compares are described, not run"
- },
{
"path": "docs/superpowers/specs/2026-11-08-equipo-connections.md",
"line_sha256": "bbef0bd96d13e9ff305082d0d4d64ac3ccc70f7bbac54ff98672ee4cdb617e3f",