oficina / equipo Public

Merge branch 'token-row-facts' into main

Merge token-row-facts: honest account and usage on token rows

The token check reads rate_limit_event and records its windows like a
turn. A token row with no provider email shows the email the person
gave, marked as theirs, and a quiet line until usage is reported.
Migration 0063 chat_connections.stated_email. Hosted CI passed on
873aa09.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev 00841c5eea06fcc32a061867019b187cd476c86d parent 27ce6c6parent 873aa09
18 files changed, +649 −32
  • .rastrillo/budgets.txt +5 −5
  • docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md +50 −0
  • internal/equipo/app.go +1 −0
  • internal/equipo/chat/connections.go +100 −0
  • internal/equipo/chat_connections.go +14 −0
  • internal/equipo/connections_view.go +44 −0
  • internal/equipo/copy.go +8 −0
  • internal/equipo/migrations/0063_thin_connection_stated_email.sql +1 −0
  • internal/equipo/migrations/schema.sql +1 −1
  • internal/equipo/static/connections.js +34 −0
  • internal/equipo/static/equipo.css +9 −0
  • internal/equipo/templates/models.html +3 −2
  • internal/fakeclaude/fake.go +20 −1
  • internal/headless/token_test.go +70 −0
  • internal/runner/thin/run.go +19 −4
  • internal/runner/thin/tokencheck.go +46 −19
  • internal/thintest/token_row_browser_test.go +57 −0
  • internal/thintest/token_row_pages_test.go +167 −0

CI passed — run details

diff --git a/.rastrillo/budgets.txt b/.rastrillo/budgets.txt
index 89ccef0f..b7ad1182 100644
--- a/.rastrillo/budgets.txt
+++ b/.rastrillo/budgets.txt
@@ -14,7 +14,7 @@ perf GET /* skip Unknown private paths render 404; this fallback contains no scr
time internal/equipo/team 60s Plan 3 loaded CI measured 45.985s; niced serial reruns measured 18.079s and 22.031s. Keep migration, recovery, accounting and concurrency assertions; 60s leaves 30 percent headroom above loaded CI.
time internal/equipotest 300s Final fix package rerun measured 187.035s (review 172.4s); 300s gives 60 percent headroom for HTTP, sandbox, authority and final regression coverage.
-size internal/equipo 16980 - Merge authority merged onto Machines in Settings and stale thinking lines: measured 16914. Stale thinking lines (the queued note in chat_page.go and chat.html, the refresh and turn ownership in chat-stream.js, about 60 lines) merged onto Machines in Settings: measured 16725. Machines in Settings adds the Machines list and Add a machine screens (machines_view.go, the runners.html rewrite, machines.js, their CSS, three icons and 35 strings, about 280 lines); measured 16664. Spend 1 (work_spend.go and the task page lines, about 90 lines) merged onto the four UI branches: measured 16381. The team panel merged onto Projects UX, the Settings pattern and the Connections countdown: measured 16280 with all four. The team panel adds the compact specialist rows, the drawer page and its view (team_panel.go, team.html, team-panel.js, about 420 lines), the activity wording (team_activity.go) and their CSS and copy; the command reading went to its own package (internal/equipo/activity); measured 15788. Projects UX merged onto the Connections countdown and the Settings pattern: measured 15942 with all three. Projects UX adds the Projects page order (starred, active, quiet folded), the auto-star rules and their receipt, whole-word descriptions and the star action (project_order.go, about 200 lines), the Mac decision and Ask about this; measured 15815. Connection resets as a countdown (inText and its words, about 60 lines) and the Settings page pattern (settings_hub.go, team_links.go, about 30 lines) together; measured 15577 with both merged. The Connections Add page and four display fixes add the Add page handler, account naming, stale meter filtering and the resting row's destination (connections_view.go, chat_connections.go, about 120 lines); measured 15467. Claude setup tokens add the token card, sealing route and Check again beside the composer and Mac lines; measured 15350. Settings in sections adds the section pages, the secondary menu and the old URLs' redirects (settings_hub.go, about 110 lines, less the removed Thinking words page); measured 14922. Mac runners (Darwin worker) add the one-tap enrolment link, the runners view's self-probes, /install.sh, the outside-the-sandbox label and their copy (about 90 lines); measured 15058. Mac runners add the runner role, the protocol route and the placement minute, then two-phase removal, Remove now and Recover (about 110 lines). Housekeeping slice 1 adds the Housekeeping view beside the Notebook, the digest line and their copy (housekeeping_page.go, about 170 lines); measured 14513. Thin v1 UX1 thinking words adds the settings page and the set registry wiring (thinking_words.go) and 55 strings of phrases; measured 14411. The Connections page to Paul's approved mockup (connections_view.go: what is answering, the preference, rows with headroom, roles, usage and the recovery action, about 300 lines); measured 14268. Merged with UX1 round 3 (duplicate combining with Undo, timeline headlines) beside the Connections page; measured 13895. Connections slice 1 adds the Connections page, the switched line and the no_connection card and their copy (chat_connections.go, about 220 lines). Measured 12269. Thin v1 UX1 adds the inner screens' view model (work_views.go: stage track, badges, timeline, decisions, project facts, about 830 lines), the rich page handlers and their copy (about 170 lines); measured 13263. Thin v1 slice 4c adds the merged line, the merge card and its copy (about 60 lines). Thin v1 slice 4 adds the thin sidebar (rail.go), review and checks lines on the task card and pages, and their copy (about 190 lines). Thin v1 slice 3 adds the task card, the thin Tasks and Projects pages and their actions over the chat store, and their copy (about 280 lines). Thin v1 slice 2 adds activity labels, card copy and card rendering on the chat page (about 250 lines); slice 1 added the chat wiring and page (about 180 lines) beside code its slice 7 sweep deletes (the live hub, the old coordinator); lower then. Task 7 keeps the existing ceiling by moving transaction-bound event lookup into conversation. Measured 10796 source and 437 test lines; roster, database, pending copy and execution wiring remain here. Merge authority thin v1 adds the project page's "How Equipo merges" section and form (merge_policy_page.go, about 90 lines) and 86 strings; measured 16568 with main (spend-1, the four UI branches) merged. Spend 1 (work_spend.go and the task page lines, about 90 lines) merged onto the four UI branches: measured 16381. The team panel merged onto Projects UX, the Settings pattern and the Connections countdown: measured 16280 with all four. The team panel adds the compact specialist rows, the drawer page and its view (team_panel.go, team.html, team-panel.js, about 420 lines), the activity wording (team_activity.go) and their CSS and copy; the command reading went to its own package (internal/equipo/activity); measured 15788. Projects UX merged onto the Connections countdown and the Settings pattern: measured 15942 with all three. Projects UX adds the Projects page order (starred, active, quiet folded), the auto-star rules and their receipt, whole-word descriptions and the star action (project_order.go, about 200 lines), the Mac decision and Ask about this; measured 15815. Connection resets as a countdown (inText and its words, about 60 lines) and the Settings page pattern (settings_hub.go, team_links.go, about 30 lines) together; measured 15577 with both merged. Machines in Settings adds the Machines list and Add a machine screens (machines_view.go, the runners.html rewrite, machines.js, their CSS, three icons and 35 strings, about 280 lines); measured 16664. Spend 1 (work_spend.go and the task page lines, about 90 lines) merged onto the four UI branches: measured 16381. The team panel merged onto Projects UX, the Settings pattern and the Connections countdown: measured 16280 with all four. The team panel adds the compact specialist rows, the drawer page and its view (team_panel.go, team.html, team-panel.js, about 420 lines), the activity wording (team_activity.go) and their CSS and copy; the command reading went to its own package (internal/equipo/activity); measured 15788. Projects UX merged onto the Connections countdown and the Settings pattern: measured 15942 with all three. Projects UX adds the Projects page order (starred, active, quiet folded), the auto-star rules and their receipt, whole-word descriptions and the star action (project_order.go, about 200 lines), the Mac decision and Ask about this; measured 15815. Connection resets as a countdown (inText and its words, about 60 lines) and the Settings page pattern (settings_hub.go, team_links.go, about 30 lines) together; measured 15577 with both merged. The Connections Add page and four display fixes add the Add page handler, account naming, stale meter filtering and the resting row's destination (connections_view.go, chat_connections.go, about 120 lines); measured 15467. Claude setup tokens add the token card, sealing route and Check again beside the composer and Mac lines; measured 15350. Settings in sections adds the section pages, the secondary menu and the old URLs' redirects (settings_hub.go, about 110 lines, less the removed Thinking words page); measured 14922. Mac runners (Darwin worker) add the one-tap enrolment link, the runners view's self-probes, /install.sh, the outside-the-sandbox label and their copy (about 90 lines); measured 15058. Mac runners add the runner role, the protocol route and the placement minute, then two-phase removal, Remove now and Recover (about 110 lines). Housekeeping slice 1 adds the Housekeeping view beside the Notebook, the digest line and their copy (housekeeping_page.go, about 170 lines); measured 14513. Thin v1 UX1 thinking words adds the settings page and the set registry wiring (thinking_words.go) and 55 strings of phrases; measured 14411. The Connections page to Paul's approved mockup (connections_view.go: what is answering, the preference, rows with headroom, roles, usage and the recovery action, about 300 lines); measured 14268. Merged with UX1 round 3 (duplicate combining with Undo, timeline headlines) beside the Connections page; measured 13895. Connections slice 1 adds the Connections page, the switched line and the no_connection card and their copy (chat_connections.go, about 220 lines). Measured 12269. Thin v1 UX1 adds the inner screens' view model (work_views.go: stage track, badges, timeline, decisions, project facts, about 830 lines), the rich page handlers and their copy (about 170 lines); measured 13263. Thin v1 slice 4c adds the merged line, the merge card and its copy (about 60 lines). Thin v1 slice 4 adds the thin sidebar (rail.go), review and checks lines on the task card and pages, and their copy (about 190 lines). Thin v1 slice 3 adds the task card, the thin Tasks and Projects pages and their actions over the chat store, and their copy (about 280 lines). Thin v1 slice 2 adds activity labels, card copy and card rendering on the chat page (about 250 lines); slice 1 added the chat wiring and page (about 180 lines) beside code its slice 7 sweep deletes (the live hub, the old coordinator); lower then. Task 7 keeps the existing ceiling by moving transaction-bound event lookup into conversation. Measured 10796 source and 437 test lines; roster, database, pending copy and execution wiring remain here.
+size internal/equipo 17018 - Token row facts merged onto main: measured 17018. Token row facts add the row's stated email and usage line (rowFacts), the email route and its field, connections.js keeping an open field across refreshes, their CSS and 8 strings (about 90 lines); measured 17009. Merge authority merged onto Machines in Settings and stale thinking lines: measured 16914. Stale thinking lines (the queued note in chat_page.go and chat.html, the refresh and turn ownership in chat-stream.js, about 60 lines) merged onto Machines in Settings: measured 16725. Machines in Settings adds the Machines list and Add a machine screens (machines_view.go, the runners.html rewrite, machines.js, their CSS, three icons and 35 strings, about 280 lines); measured 16664. Spend 1 (work_spend.go and the task page lines, about 90 lines) merged onto the four UI branches: measured 16381. The team panel merged onto Projects UX, the Settings pattern and the Connections countdown: measured 16280 with all four. The team panel adds the compact specialist rows, the drawer page and its view (team_panel.go, team.html, team-panel.js, about 420 lines), the activity wording (team_activity.go) and their CSS and copy; the command reading went to its own package (internal/equipo/activity); measured 15788. Projects UX merged onto the Connections countdown and the Settings pattern: measured 15942 with all three. Projects UX adds the Projects page order (starred, active, quiet folded), the auto-star rules and their receipt, whole-word descriptions and the star action (project_order.go, about 200 lines), the Mac decision and Ask about this; measured 15815. Connection resets as a countdown (inText and its words, about 60 lines) and the Settings page pattern (settings_hub.go, team_links.go, about 30 lines) together; measured 15577 with both merged. The Connections Add page and four display fixes add the Add page handler, account naming, stale meter filtering and the resting row's destination (connections_view.go, chat_connections.go, about 120 lines); measured 15467. Claude setup tokens add the token card, sealing route and Check again beside the composer and Mac lines; measured 15350. Settings in sections adds the section pages, the secondary menu and the old URLs' redirects (settings_hub.go, about 110 lines, less the removed Thinking words page); measured 14922. Mac runners (Darwin worker) add the one-tap enrolment link, the runners view's self-probes, /install.sh, the outside-the-sandbox label and their copy (about 90 lines); measured 15058. Mac runners add the runner role, the protocol route and the placement minute, then two-phase removal, Remove now and Recover (about 110 lines). Housekeeping slice 1 adds the Housekeeping view beside the Notebook, the digest line and their copy (housekeeping_page.go, about 170 lines); measured 14513. Thin v1 UX1 thinking words adds the settings page and the set registry wiring (thinking_words.go) and 55 strings of phrases; measured 14411. The Connections page to Paul's approved mockup (connections_view.go: what is answering, the preference, rows with headroom, roles, usage and the recovery action, about 300 lines); measured 14268. Merged with UX1 round 3 (duplicate combining with Undo, timeline headlines) beside the Connections page; measured 13895. Connections slice 1 adds the Connections page, the switched line and the no_connection card and their copy (chat_connections.go, about 220 lines). Measured 12269. Thin v1 UX1 adds the inner screens' view model (work_views.go: stage track, badges, timeline, decisions, project facts, about 830 lines), the rich page handlers and their copy (about 170 lines); measured 13263. Thin v1 slice 4c adds the merged line, the merge card and its copy (about 60 lines). Thin v1 slice 4 adds the thin sidebar (rail.go), review and checks lines on the task card and pages, and their copy (about 190 lines). Thin v1 slice 3 adds the task card, the thin Tasks and Projects pages and their actions over the chat store, and their copy (about 280 lines). Thin v1 slice 2 adds activity labels, card copy and card rendering on the chat page (about 250 lines); slice 1 added the chat wiring and page (about 180 lines) beside code its slice 7 sweep deletes (the live hub, the old coordinator); lower then. Task 7 keeps the existing ceiling by moving transaction-bound event lookup into conversation. Measured 10796 source and 437 test lines; roster, database, pending copy and execution wiring remain here. Merge authority thin v1 adds the project page's "How Equipo merges" section and form (merge_policy_page.go, about 90 lines) and 86 strings; measured 16568 with main (spend-1, the four UI branches) merged. Spend 1 (work_spend.go and the task page lines, about 90 lines) merged onto the four UI branches: measured 16381. The team panel merged onto Projects UX, the Settings pattern and the Connections countdown: measured 16280 with all four. The team panel adds the compact specialist rows, the drawer page and its view (team_panel.go, team.html, team-panel.js, about 420 lines), the activity wording (team_activity.go) and their CSS and copy; the command reading went to its own package (internal/equipo/activity); measured 15788. Projects UX merged onto the Connections countdown and the Settings pattern: measured 15942 with all three. Projects UX adds the Projects page order (starred, active, quiet folded), the auto-star rules and their receipt, whole-word descriptions and the star action (project_order.go, about 200 lines), the Mac decision and Ask about this; measured 15815. Connection resets as a countdown (inText and its words, about 60 lines) and the Settings page pattern (settings_hub.go, team_links.go, about 30 lines) together; measured 15577 with both merged. Machines in Settings adds the Machines list and Add a machine screens (machines_view.go, the runners.html rewrite, machines.js, their CSS, three icons and 35 strings, about 280 lines); measured 16664. Spend 1 (work_spend.go and the task page lines, about 90 lines) merged onto the four UI branches: measured 16381. The team panel merged onto Projects UX, the Settings pattern and the Connections countdown: measured 16280 with all four. The team panel adds the compact specialist rows, the drawer page and its view (team_panel.go, team.html, team-panel.js, about 420 lines), the activity wording (team_activity.go) and their CSS and copy; the command reading went to its own package (internal/equipo/activity); measured 15788. Projects UX merged onto the Connections countdown and the Settings pattern: measured 15942 with all three. Projects UX adds the Projects page order (starred, active, quiet folded), the auto-star rules and their receipt, whole-word descriptions and the star action (project_order.go, about 200 lines), the Mac decision and Ask about this; measured 15815. Connection resets as a countdown (inText and its words, about 60 lines) and the Settings page pattern (settings_hub.go, team_links.go, about 30 lines) together; measured 15577 with both merged. The Connections Add page and four display fixes add the Add page handler, account naming, stale meter filtering and the resting row's destination (connections_view.go, chat_connections.go, about 120 lines); measured 15467. Claude setup tokens add the token card, sealing route and Check again beside the composer and Mac lines; measured 15350. Settings in sections adds the section pages, the secondary menu and the old URLs' redirects (settings_hub.go, about 110 lines, less the removed Thinking words page); measured 14922. Mac runners (Darwin worker) add the one-tap enrolment link, the runners view's self-probes, /install.sh, the outside-the-sandbox label and their copy (about 90 lines); measured 15058. Mac runners add the runner role, the protocol route and the placement minute, then two-phase removal, Remove now and Recover (about 110 lines). Housekeeping slice 1 adds the Housekeeping view beside the Notebook, the digest line and their copy (housekeeping_page.go, about 170 lines); measured 14513. Thin v1 UX1 thinking words adds the settings page and the set registry wiring (thinking_words.go) and 55 strings of phrases; measured 14411. The Connections page to Paul's approved mockup (connections_view.go: what is answering, the preference, rows with headroom, roles, usage and the recovery action, about 300 lines); measured 14268. Merged with UX1 round 3 (duplicate combining with Undo, timeline headlines) beside the Connections page; measured 13895. Connections slice 1 adds the Connections page, the switched line and the no_connection card and their copy (chat_connections.go, about 220 lines). Measured 12269. Thin v1 UX1 adds the inner screens' view model (work_views.go: stage track, badges, timeline, decisions, project facts, about 830 lines), the rich page handlers and their copy (about 170 lines); measured 13263. Thin v1 slice 4c adds the merged line, the merge card and its copy (about 60 lines). Thin v1 slice 4 adds the thin sidebar (rail.go), review and checks lines on the task card and pages, and their copy (about 190 lines). Thin v1 slice 3 adds the task card, the thin Tasks and Projects pages and their actions over the chat store, and their copy (about 280 lines). Thin v1 slice 2 adds activity labels, card copy and card rendering on the chat page (about 250 lines); slice 1 added the chat wiring and page (about 180 lines) beside code its slice 7 sweep deletes (the live hub, the old coordinator); lower then. Task 7 keeps the existing ceiling by moving transaction-bound event lookup into conversation. Measured 10796 source and 437 test lines; roster, database, pending copy and execution wiring remain here.
size internal/equipotest - 13400 Task 21 repairs historical migration and conversation fixtures after Plan 3. Measured 13024 test lines; the 300s time ceiling is unchanged.
time internal/runner/checks 90s CI worker measured 44.553s (44.6s rounded); 60s gives 34 percent headroom. Shared baseline capture reduces repeated Go runs; retain the CI allowance for sandbox sentinels, timeout and child cleanup. 2026-11-07: loaded CI (host load about 24) measured 66.5s with the package unchanged by thin v1 slice 4 beyond optional check mounts; 90s keeps 35 percent headroom.
time internal/runner 330s Plan 3 CI repair measured 292.120s for the full package (controller CI 472.184s). Parallel plan graphs and removal of repeated progress floods reduced their local targeted run from 146.920s to 30.784s; the original bug graph retains volume coverage. Keep 330s for journal, proxy, recovery and namespace integration, with 13 percent headroom.
@@ -34,7 +34,7 @@ time internal/runner/provider 15s Plan 3 CI repair measured 10.346s for the full
perf GET /releases/* skip Verified runner release file downloads, not browser GET screens.
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.
-size internal/runner/thin 16854 8411 Mac P2 diagnostics hand the probes' host runner.log's WARN (macHost.warn, 8 lines) and pin it with a test (12 lines): measured 16854/8411. Mac probe deadlines bound the booted simctl list, move the worker's wait for the probes out of its lock (hold) and warn when a probe run reaches its limit (about 24 lines); their tests (mac_stall_test.go: a fake xcrun that never answers, probes stalled while an update applies, about 270 lines) beside the Mac host they drive: measured 16846/8399. Release slice 1 merged onto main: measured 16822/8130. Release slice 1 (hosted checks) adds the hub's hosted CI verdict for checks: the deferred one-read poll with its persisted deadline, the one-snapshot verdict, the failing units and the restart case (judge_hosted.go, about 200 lines) and the forge's CI reads (forge.go, about 40); measured 16821. Its tests (judge_hosted_test.go, about 270 lines) take the package's tests to 8113, beside the step engine they drive. The leftover helper's debug line adds 3 lines: measured 16572. The Mac host's hang fix and probe pacing add the process group and its kill (procgroup_unix.go, procgroup_other.go), the bounded wait for a command's output, and the untrusted report's rerun decision with its tool fingerprint (about 165 lines); measured 16569. Runner startup logs add the info lines a silent start is pinned to a phase by (startup phases, the Mac host's xcode-select and capability commands, slow-command warnings, the probes, and the link's connecting, hello and welcome lines: startPhase, openRunner, watchSlow and logged, about 155 lines); measured 16405. Merge authority thin v1 adds the review's measured change facts (facts.go: raw and numstat listings, modes, signing lines, the revert tree check, about 230 lines), the merge_request confirmation and the merge's provenance; measured 16196 with spend-1 merged. Spend 1 resumes a fix round in Engineering's kept session on its healthy connection (fixSession, fixPlan, fixPrompt, keptCommit, about 90 lines); measured 15873. Claude's sign-in by a link's review round 1 contains its setup-token in a recorded namespace (the contained terminal, its proven stop and the start's recovery before a home goes, about 130 lines); measured 15787. 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. The paste box house rule merged onto the runner logs: measured 16573. The leftover helper's debug line adds 3 lines: measured 16572. The Mac host's hang fix and probe pacing add the process group and its kill (procgroup_unix.go, procgroup_other.go), the bounded wait for a command's output, and the untrusted report's rerun decision with its tool fingerprint (about 165 lines); measured 16569. Runner startup logs add the info lines a silent start is pinned to a phase by (startup phases, the Mac host's xcode-select and capability commands, slow-command warnings, the probes, and the link's connecting, hello and welcome lines: startPhase, openRunner, watchSlow and logged, about 155 lines); measured 16405. Merge authority thin v1 adds the review's measured change facts (facts.go: raw and numstat listings, modes, signing lines, the revert tree check, about 230 lines), the merge_request confirmation and the merge's provenance; measured 16196 with spend-1 merged. Spend 1 resumes a fix round in Engineering's kept session on its healthy connection (fixSession, fixPlan, fixPrompt, keptCommit, about 90 lines); measured 15873. Claude's sign-in by a link's review round 1 contains its setup-token in a recorded namespace (the contained terminal, its proven stop and the start's recovery before a home goes, about 130 lines); measured 15787. 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.
+size internal/runner/thin 16896 8411 Token row facts merged onto main: measured 16896/8411. Token row facts read the check's rate limit and record it as a turn's (TokenCheck, the Verify wiring, about 40 lines); measured 16614. The leftover helper's debug line adds 3 lines: measured 16572. The Mac host's hang fix and probe pacing add the process group and its kill (procgroup_unix.go, procgroup_other.go), the bounded wait for a command's output, and the untrusted report's rerun decision with its tool fingerprint (about 165 lines); measured 16569. Runner startup logs add the info lines a silent start is pinned to a phase by (startup phases, the Mac host's xcode-select and capability commands, slow-command warnings, the probes, and the link's connecting, hello and welcome lines: startPhase, openRunner, watchSlow and logged, about 155 lines); measured 16405. Merge authority thin v1 adds the review's measured change facts (facts.go: raw and numstat listings, modes, signing lines, the revert tree check, about 230 lines), the merge_request confirmation and the merge's provenance; measured 16196 with spend-1 merged. Spend 1 resumes a fix round in Engineering's kept session on its healthy connection (fixSession, fixPlan, fixPrompt, keptCommit, about 90 lines); measured 15873. Claude's sign-in by a link's review round 1 contains its setup-token in a recorded namespace (the contained terminal, its proven stop and the start's recovery before a home goes, about 130 lines); measured 15787. 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. Mac P2 diagnostics hand the probes' host runner.log's WARN (macHost.warn, 8 lines) and pin it with a test (12 lines): measured 16854/8411. Mac probe deadlines bound the booted simctl list, move the worker's wait for the probes out of its lock (hold) and warn when a probe run reaches its limit (about 24 lines); their tests (mac_stall_test.go: a fake xcrun that never answers, probes stalled while an update applies, about 270 lines) beside the Mac host they drive: measured 16846/8399. Release slice 1 merged onto main: measured 16822/8130. Release slice 1 (hosted checks) adds the hub's hosted CI verdict for checks: the deferred one-read poll with its persisted deadline, the one-snapshot verdict, the failing units and the restart case (judge_hosted.go, about 200 lines) and the forge's CI reads (forge.go, about 40); measured 16821. Its tests (judge_hosted_test.go, about 270 lines) take the package's tests to 8113, beside the step engine they drive. The leftover helper's debug line adds 3 lines: measured 16572. The Mac host's hang fix and probe pacing add the process group and its kill (procgroup_unix.go, procgroup_other.go), the bounded wait for a command's output, and the untrusted report's rerun decision with its tool fingerprint (about 165 lines); measured 16569. Runner startup logs add the info lines a silent start is pinned to a phase by (startup phases, the Mac host's xcode-select and capability commands, slow-command warnings, the probes, and the link's connecting, hello and welcome lines: startPhase, openRunner, watchSlow and logged, about 155 lines); measured 16405. Merge authority thin v1 adds the review's measured change facts (facts.go: raw and numstat listings, modes, signing lines, the revert tree check, about 230 lines), the merge_request confirmation and the merge's provenance; measured 16196 with spend-1 merged. Spend 1 resumes a fix round in Engineering's kept session on its healthy connection (fixSession, fixPlan, fixPrompt, keptCommit, about 90 lines); measured 15873. Claude's sign-in by a link's review round 1 contains its setup-token in a recorded namespace (the contained terminal, its proven stop and the start's recovery before a home goes, about 130 lines); measured 15787. 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. The paste box house rule merged onto the runner logs: measured 16573. The leftover helper's debug line adds 3 lines: measured 16572. The Mac host's hang fix and probe pacing add the process group and its kill (procgroup_unix.go, procgroup_other.go), the bounded wait for a command's output, and the untrusted report's rerun decision with its tool fingerprint (about 165 lines); measured 16569. Runner startup logs add the info lines a silent start is pinned to a phase by (startup phases, the Mac host's xcode-select and capability commands, slow-command warnings, the probes, and the link's connecting, hello and welcome lines: startPhase, openRunner, watchSlow and logged, about 155 lines); measured 16405. Merge authority thin v1 adds the review's measured change facts (facts.go: raw and numstat listings, modes, signing lines, the revert tree check, about 230 lines), the merge_request confirmation and the merge's provenance; measured 16196 with spend-1 merged. Spend 1 resumes a fix round in Engineering's kept session on its healthy connection (fixSession, fixPlan, fixPrompt, keptCommit, about 90 lines); measured 15873. Claude's sign-in by a link's review round 1 contains its setup-token in a recorded namespace (the contained terminal, its proven stop and the start's recovery before a home goes, about 130 lines); measured 15787. 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.
@@ -49,7 +49,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 14175 - The duplicate keep rule merged onto main: measured 14175. The duplicate combine keeps the decided task: the housekeeping view reads each task's newest merge card and marks it Decided (about 12 lines); measured 14110. Turn batching adds turnText, the frame fit (fitTail, batchFull) and the stranded-turn recovery in sync (about 115 lines); measured 14095. The re-run ruling (recheckMayMerge, refreshAfterRecheck, about 70 lines); measured 13981. Merge authority thin v1 adds the gate's store side (mergeauth.go: authorizeMerge before dispatch and at each hub request, the fence for runners below the merge-facts protocol, the ask card in Equipo's words, the ships question, receipts with Undo, the policy tool and API, about 1000 lines); the gate is pure, in internal/equipo/mergegate, but its inputs and audit must be read and written inside the store's transactions. Measured 13204. Mac recheck runs a waiting task's needs_macos checks again when a Mac that fits arrives (macrecheck.go, about 90 lines); measured 12485. Spend 1 merged onto Projects UX: measured 12376 with both. Spend 1 adds a task's spend from its usage rows (TaskSpend, about 60 lines) and the usage rows' round; measured 12047. Projects UX adds per-person project stars with the auto-star reconciliation, the person's and the coordinator's star_project (stars.go, about 210 lines) and the project's own repository in its view; measured 12206. 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. Release slice 1 (hosted checks) adds the hosted CI offer, the binding's acceptance inside the step report's transaction, the hosted sandbox rule and the fix round's failing units (about 65 lines); measured 14160. Turn batching adds turnText, the frame fit (fitTail, batchFull) and the stranded-turn recovery in sync (about 115 lines); measured 14095. The re-run ruling (recheckMayMerge, refreshAfterRecheck, about 70 lines); measured 13981. Merge authority thin v1 adds the gate's store side (mergeauth.go: authorizeMerge before dispatch and at each hub request, the fence for runners below the merge-facts protocol, the ask card in Equipo's words, the ships question, receipts with Undo, the policy tool and API, about 1000 lines); the gate is pure, in internal/equipo/mergegate, but its inputs and audit must be read and written inside the store's transactions. Measured 13204. Mac recheck runs a waiting task's needs_macos checks again when a Mac that fits arrives (macrecheck.go, about 90 lines); measured 12485. Spend 1 merged onto Projects UX: measured 12376 with both. Spend 1 adds a task's spend from its usage rows (TaskSpend, about 60 lines) and the usage rows' round; measured 12047. Projects UX adds per-person project stars with the auto-star reconciliation, the person's and the coordinator's star_project (stars.go, about 210 lines) and the project's own repository in its view; measured 12206. 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.
+size internal/equipo/chat 14275 - Token row facts merged onto main: measured 14275. Token row facts add the stated email's store write with its shape check and the row facts read (StatedEmailShape, SetStatedEmail, ConnectionRowFacts, about 95 lines); measured 14195. Turn batching adds turnText, the frame fit (fitTail, batchFull) and the stranded-turn recovery in sync (about 115 lines); measured 14095. The re-run ruling (recheckMayMerge, refreshAfterRecheck, about 70 lines); measured 13981. Merge authority thin v1 adds the gate's store side (mergeauth.go: authorizeMerge before dispatch and at each hub request, the fence for runners below the merge-facts protocol, the ask card in Equipo's words, the ships question, receipts with Undo, the policy tool and API, about 1000 lines); the gate is pure, in internal/equipo/mergegate, but its inputs and audit must be read and written inside the store's transactions. Measured 13204. Mac recheck runs a waiting task's needs_macos checks again when a Mac that fits arrives (macrecheck.go, about 90 lines); measured 12485. Spend 1 merged onto Projects UX: measured 12376 with both. Spend 1 adds a task's spend from its usage rows (TaskSpend, about 60 lines) and the usage rows' round; measured 12047. Projects UX adds per-person project stars with the auto-star reconciliation, the person's and the coordinator's star_project (stars.go, about 210 lines) and the project's own repository in its view; measured 12206. 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. The duplicate keep rule merged onto main: measured 14175. The duplicate combine keeps the decided task: the housekeeping view reads each task's newest merge card and marks it Decided (about 12 lines); measured 14110. Turn batching adds turnText, the frame fit (fitTail, batchFull) and the stranded-turn recovery in sync (about 115 lines); measured 14095. The re-run ruling (recheckMayMerge, refreshAfterRecheck, about 70 lines); measured 13981. Merge authority thin v1 adds the gate's store side (mergeauth.go: authorizeMerge before dispatch and at each hub request, the fence for runners below the merge-facts protocol, the ask card in Equipo's words, the ships question, receipts with Undo, the policy tool and API, about 1000 lines); the gate is pure, in internal/equipo/mergegate, but its inputs and audit must be read and written inside the store's transactions. Measured 13204. Mac recheck runs a waiting task's needs_macos checks again when a Mac that fits arrives (macrecheck.go, about 90 lines); measured 12485. Spend 1 merged onto Projects UX: measured 12376 with both. Spend 1 adds a task's spend from its usage rows (TaskSpend, about 60 lines) and the usage rows' round; measured 12047. Projects UX adds per-person project stars with the auto-star reconciliation, the person's and the coordinator's star_project (stars.go, about 210 lines) and the project's own repository in its view; measured 12206. 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. Release slice 1 (hosted checks) adds the hosted CI offer, the binding's acceptance inside the step report's transaction, the hosted sandbox rule and the fix round's failing units (about 65 lines); measured 14160. Turn batching adds turnText, the frame fit (fitTail, batchFull) and the stranded-turn recovery in sync (about 115 lines); measured 14095. The re-run ruling (recheckMayMerge, refreshAfterRecheck, about 70 lines); measured 13981. Merge authority thin v1 adds the gate's store side (mergeauth.go: authorizeMerge before dispatch and at each hub request, the fence for runners below the merge-facts protocol, the ask card in Equipo's words, the ships question, receipts with Undo, the policy tool and API, about 1000 lines); the gate is pure, in internal/equipo/mergegate, but its inputs and audit must be read and written inside the store's transactions. Measured 13204. Mac recheck runs a waiting task's needs_macos checks again when a Mac that fits arrives (macrecheck.go, about 90 lines); measured 12485. Spend 1 merged onto Projects UX: measured 12376 with both. Spend 1 adds a task's spend from its usage rows (TaskSpend, about 60 lines) and the usage rows' round; measured 12047. Projects UX adds per-person project stars with the auto-star reconciliation, the person's and the coordinator's star_project (stars.go, about 210 lines) and the project's own repository in its view; measured 12206. 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.
@@ -61,6 +61,6 @@ 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/headless - 8679 The duplicate keep rule merged onto main: measured 8679. The draft stream drive records each draw and the commit (about 27 lines) merged onto the paste box: measured 8679. The paste box merged onto turn batching: measured 8652. The paste box adds its browser drive (browser_paste_test.go, about 130 lines: streaming, copy text, keyboard, scripts off); measured 8464. Merge authority extends 4c_checks_card to end in Equipo's own merge, measured by the real runner, with its receipt (about 30 lines); measured 8330. Claude's sign-in by a link adds its end-to-end, contained-launch and real runner kill tests (signin_test.go, signin_contained_test.go, about 400 lines); measured 8090. Turn batching merged onto the browser lane: measured 8523. Turn batching adds TestHeadlessTurnBatching (three messages behind a slow turn through the real runner and fake CLI: the one next turn, its input, the bubbles and note, the usage rows and the spend lines) and TestHeadlessBatchAfterRefusedReply (the real runner reconnects after a refused reply), about 190 lines; measured 8518. Merge authority extends 4c_checks_card to end in Equipo's own merge, measured by the real runner, with its receipt (about 30 lines); measured 8330. Claude's sign-in by a link adds its end-to-end, contained-launch and real runner kill tests (signin_test.go, signin_contained_test.go, about 400 lines); measured 8090. Release slice 1 merged onto main: measured 8679. Turn batching merged onto the browser lane: measured 8523. Turn batching adds TestHeadlessTurnBatching (three messages behind a slow turn through the real runner and fake CLI: the one next turn, its input, the bubbles and note, the usage rows and the spend lines) and TestHeadlessBatchAfterRefusedReply (the real runner reconnects after a refused reply), about 190 lines; measured 8518. Merge authority extends 4c_checks_card to end in Equipo's own merge, measured by the real runner, with its receipt (about 30 lines); measured 8330. Claude's sign-in by a link adds its end-to-end, contained-launch and real runner kill tests (signin_test.go, signin_contained_test.go, about 400 lines); measured 8090. The draft stream drive records each draw and the commit (about 27 lines) merged onto the paste box: measured 8679. The paste box merged onto turn batching: measured 8652. The paste box adds its browser drive (browser_paste_test.go, about 130 lines: streaming, copy text, keyboard, scripts off); measured 8464. Merge authority extends 4c_checks_card to end in Equipo's own merge, measured by the real runner, with its receipt (about 30 lines); measured 8330. Claude's sign-in by a link adds its end-to-end, contained-launch and real runner kill tests (signin_test.go, signin_contained_test.go, about 400 lines); measured 8090. Turn batching merged onto the browser lane: measured 8523. Turn batching adds TestHeadlessTurnBatching (three messages behind a slow turn through the real runner and fake CLI: the one next turn, its input, the bubbles and note, the usage rows and the spend lines) and TestHeadlessBatchAfterRefusedReply (the real runner reconnects after a refused reply), about 190 lines; measured 8518. Merge authority extends 4c_checks_card to end in Equipo's own merge, measured by the real runner, with its receipt (about 30 lines); measured 8330. Claude's sign-in by a link adds its end-to-end, contained-launch and real runner kill tests (signin_test.go, signin_contained_test.go, about 400 lines); measured 8090.
-size internal/thintest - 13885 The duplicate keep rule merged onto main: measured 13885. The duplicate combine keeps the decided task adds staging's Woodstar pair as a contract through the real store (TestContractCombineKeepsDecided, about 60 lines); measured 13747. The InnerScreens transition wait merged onto main: measured 13685. The inner screens drive waits for the row menu's opacity transition to end before it reads the menu at rest (about 7 lines); measured 13251. Turn batching merged onto the ThinkingCycles clock fix (the drive takes a still clock and the page's record of each phrase, about 50 lines): measured 13678. Turn batching merged onto the browser lane: measured 13631. Turn batching adds its contracts (the crash between turns, the stranded recovery, failed, cancelled, interrupted and retried turns, the cancelled batch, the note clearing, batches split to fit one frame and the failed batch's note; about 430 lines); measured 13630 with the ship buttons merged. The ship buttons add their contract and browser tests (ships_buttons_test.go, ships_buttons_browser_test.go, about 190 lines); measured 13196. Merge authority merged onto Machines in Settings, with the re-run ruling's cases and stale thinking lines: measured 12998. Merge authority thin v1 adds its contracts (mergeauth_contract_test.go, about 650 lines) the protocol-aware rigs and the Mac re-run contract (macrecheck_mergeauth_contract_test.go) and the review fixes' contracts; measured 12535 with main merged. Mac recheck adds its enrolment, skip and outcome contracts (macrecheck_contract_test.go, about 210 lines); measured 11537. Machines in Settings adds its fixture, page and browser tests (machines_fixture_test.go, machines_pages_test.go, machines_browser_test.go, about 160 lines); measured 11759. Mac recheck adds its enrolment, skip and outcome contracts (macrecheck_contract_test.go, about 210 lines); measured 11537. Stale thinking lines merged onto Machines in Settings: measured 11967. Machines in Settings adds its fixture, page and browser tests (machines_fixture_test.go, machines_pages_test.go, machines_browser_test.go, about 160 lines); measured 11759. Stale thinking lines add their browser drive (stale_thinking_browser_test.go, about 200 lines) and the queued test now checks the note; measured 11795. Mac recheck adds its enrolment, skip and outcome contracts (macrecheck_contract_test.go, about 210 lines); measured 11537. Spend 1 merged onto the four UI branches: measured 11325. Spend 1 marks overcounting Claude rows (about 120 lines); it adds the task page's spend contract and the 0059 upgrade (spend_pages_test.go, about 100 lines) and the fix round feedback by protocol (about 40); measured 10224. The team panel merged onto Projects UX and the Settings UX pass: measured 11064 with all three. The team panel adds its page contract and the drawer's browser drive at 1280 and 390 (team_panel_test.go, team_panel_browser_test.go, about 300 lines); measured 10235. Projects UX merged onto the Settings UX pass: measured 10768 with both. Projects UX adds the Projects page contracts (order, quiet fold, filter, stars and Undo, the coordinator's star, repository counts, whole words), the decision cards' Mac and Ask about this contracts and their browser drive (projects_pages_test.go, projects_browser_test.go, about 330 lines); measured 10321. The Settings UX pass adds the Settings pattern's page contracts and the savebar, Housekeeping groups and Teams browser drives (settings_ux_pages_test.go, settings_ux_browser_test.go, about 430 lines); measured 10390. 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. Release slice 1 merged onto main: measured 13823. Release slice 1 (hosted checks) adds its contracts (hosted_checks_contract_test.go: the pass that asks, the failure's fix round, every binding rule, the protocol 4 runner; about 140 lines); measured 13816. Turn batching merged onto the ThinkingCycles clock fix (the drive takes a still clock and the page's record of each phrase, about 50 lines): measured 13678. Turn batching merged onto the browser lane: measured 13631. Turn batching adds its contracts (the crash between turns, the stranded recovery, failed, cancelled, interrupted and retried turns, the cancelled batch, the note clearing, batches split to fit one frame and the failed batch's note; about 430 lines); measured 13630 with the ship buttons merged. The ship buttons add their contract and browser tests (ships_buttons_test.go, ships_buttons_browser_test.go, about 190 lines); measured 13196. Merge authority merged onto Machines in Settings, with the re-run ruling's cases and stale thinking lines: measured 12998. Merge authority thin v1 adds its contracts (mergeauth_contract_test.go, about 650 lines) the protocol-aware rigs and the Mac re-run contract (macrecheck_mergeauth_contract_test.go) and the review fixes' contracts; measured 12535 with main merged. Mac recheck adds its enrolment, skip and outcome contracts (macrecheck_contract_test.go, about 210 lines); measured 11537. Machines in Settings adds its fixture, page and browser tests (machines_fixture_test.go, machines_pages_test.go, machines_browser_test.go, about 160 lines); measured 11759. Mac recheck adds its enrolment, skip and outcome contracts (macrecheck_contract_test.go, about 210 lines); measured 11537. Stale thinking lines merged onto Machines in Settings: measured 11967. Machines in Settings adds its fixture, page and browser tests (machines_fixture_test.go, machines_pages_test.go, machines_browser_test.go, about 160 lines); measured 11759. Stale thinking lines add their browser drive (stale_thinking_browser_test.go, about 200 lines) and the queued test now checks the note; measured 11795. Mac recheck adds its enrolment, skip and outcome contracts (macrecheck_contract_test.go, about 210 lines); measured 11537. Spend 1 merged onto the four UI branches: measured 11325. Spend 1 marks overcounting Claude rows (about 120 lines); it adds the task page's spend contract and the 0059 upgrade (spend_pages_test.go, about 100 lines) and the fix round feedback by protocol (about 40); measured 10224. The team panel merged onto Projects UX and the Settings UX pass: measured 11064 with all three. The team panel adds its page contract and the drawer's browser drive at 1280 and 390 (team_panel_test.go, team_panel_browser_test.go, about 300 lines); measured 10235. Projects UX merged onto the Settings UX pass: measured 10768 with both. Projects UX adds the Projects page contracts (order, quiet fold, filter, stars and Undo, the coordinator's star, repository counts, whole words), the decision cards' Mac and Ask about this contracts and their browser drive (projects_pages_test.go, projects_browser_test.go, about 330 lines); measured 10321. The Settings UX pass adds the Settings pattern's page contracts and the savebar, Housekeeping groups and Teams browser drives (settings_ux_pages_test.go, settings_ux_browser_test.go, about 430 lines); measured 10390. 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. The InnerScreens transition wait merged onto main: measured 13685. The inner screens drive waits for the row menu's opacity transition to end before it reads the menu at rest (about 7 lines); measured 13251. Turn batching merged onto the ThinkingCycles clock fix (the drive takes a still clock and the page's record of each phrase, about 50 lines): measured 13678. Turn batching merged onto the browser lane: measured 13631. Turn batching adds its contracts (the crash between turns, the stranded recovery, failed, cancelled, interrupted and retried turns, the cancelled batch, the note clearing, batches split to fit one frame and the failed batch's note; about 430 lines); measured 13630 with the ship buttons merged. The ship buttons add their contract and browser tests (ships_buttons_test.go, ships_buttons_browser_test.go, about 190 lines); measured 13196. Merge authority merged onto Machines in Settings, with the re-run ruling's cases and stale thinking lines: measured 12998. Merge authority thin v1 adds its contracts (mergeauth_contract_test.go, about 650 lines) the protocol-aware rigs and the Mac re-run contract (macrecheck_mergeauth_contract_test.go) and the review fixes' contracts; measured 12535 with main merged. Mac recheck adds its enrolment, skip and outcome contracts (macrecheck_contract_test.go, about 210 lines); measured 11537. Machines in Settings adds its fixture, page and browser tests (machines_fixture_test.go, machines_pages_test.go, machines_browser_test.go, about 160 lines); measured 11759. Mac recheck adds its enrolment, skip and outcome contracts (macrecheck_contract_test.go, about 210 lines); measured 11537. Stale thinking lines merged onto Machines in Settings: measured 11967. Machines in Settings adds its fixture, page and browser tests (machines_fixture_test.go, machines_pages_test.go, machines_browser_test.go, about 160 lines); measured 11759. Stale thinking lines add their browser drive (stale_thinking_browser_test.go, about 200 lines) and the queued test now checks the note; measured 11795. Mac recheck adds its enrolment, skip and outcome contracts (macrecheck_contract_test.go, about 210 lines); measured 11537. Spend 1 merged onto the four UI branches: measured 11325. Spend 1 marks overcounting Claude rows (about 120 lines); it adds the task page's spend contract and the 0059 upgrade (spend_pages_test.go, about 100 lines) and the fix round feedback by protocol (about 40); measured 10224. The team panel merged onto Projects UX and the Settings UX pass: measured 11064 with all three. The team panel adds its page contract and the drawer's browser drive at 1280 and 390 (team_panel_test.go, team_panel_browser_test.go, about 300 lines); measured 10235. Projects UX merged onto the Settings UX pass: measured 10768 with both. Projects UX adds the Projects page contracts (order, quiet fold, filter, stars and Undo, the coordinator's star, repository counts, whole words), the decision cards' Mac and Ask about this contracts and their browser drive (projects_pages_test.go, projects_browser_test.go, about 330 lines); measured 10321. The Settings UX pass adds the Settings pattern's page contracts and the savebar, Housekeeping groups and Teams browser drives (settings_ux_pages_test.go, settings_ux_browser_test.go, about 430 lines); measured 10390. 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.
+size internal/headless - 8749 Token row facts merged onto main: measured 8749. Token row facts add TestHeadlessTokenCheckHeadroom (a check's windows and a quota-refused check through the real runner and fake CLI, about 70 lines); measured 8593. Turn batching merged onto the browser lane: measured 8523. Turn batching adds TestHeadlessTurnBatching (three messages behind a slow turn through the real runner and fake CLI: the one next turn, its input, the bubbles and note, the usage rows and the spend lines) and TestHeadlessBatchAfterRefusedReply (the real runner reconnects after a refused reply), about 190 lines; measured 8518. Merge authority extends 4c_checks_card to end in Equipo's own merge, measured by the real runner, with its receipt (about 30 lines); measured 8330. Claude's sign-in by a link adds its end-to-end, contained-launch and real runner kill tests (signin_test.go, signin_contained_test.go, about 400 lines); measured 8090. The duplicate keep rule merged onto main: measured 8679. The draft stream drive records each draw and the commit (about 27 lines) merged onto the paste box: measured 8679. The paste box merged onto turn batching: measured 8652. The paste box adds its browser drive (browser_paste_test.go, about 130 lines: streaming, copy text, keyboard, scripts off); measured 8464. Merge authority extends 4c_checks_card to end in Equipo's own merge, measured by the real runner, with its receipt (about 30 lines); measured 8330. Claude's sign-in by a link adds its end-to-end, contained-launch and real runner kill tests (signin_test.go, signin_contained_test.go, about 400 lines); measured 8090. Turn batching merged onto the browser lane: measured 8523. Turn batching adds TestHeadlessTurnBatching (three messages behind a slow turn through the real runner and fake CLI: the one next turn, its input, the bubbles and note, the usage rows and the spend lines) and TestHeadlessBatchAfterRefusedReply (the real runner reconnects after a refused reply), about 190 lines; measured 8518. Merge authority extends 4c_checks_card to end in Equipo's own merge, measured by the real runner, with its receipt (about 30 lines); measured 8330. Claude's sign-in by a link adds its end-to-end, contained-launch and real runner kill tests (signin_test.go, signin_contained_test.go, about 400 lines); measured 8090. Release slice 1 merged onto main: measured 8679. Turn batching merged onto the browser lane: measured 8523. Turn batching adds TestHeadlessTurnBatching (three messages behind a slow turn through the real runner and fake CLI: the one next turn, its input, the bubbles and note, the usage rows and the spend lines) and TestHeadlessBatchAfterRefusedReply (the real runner reconnects after a refused reply), about 190 lines; measured 8518. Merge authority extends 4c_checks_card to end in Equipo's own merge, measured by the real runner, with its receipt (about 30 lines); measured 8330. Claude's sign-in by a link adds its end-to-end, contained-launch and real runner kill tests (signin_test.go, signin_contained_test.go, about 400 lines); measured 8090. The draft stream drive records each draw and the commit (about 27 lines) merged onto the paste box: measured 8679. The paste box merged onto turn batching: measured 8652. The paste box adds its browser drive (browser_paste_test.go, about 130 lines: streaming, copy text, keyboard, scripts off); measured 8464. Merge authority extends 4c_checks_card to end in Equipo's own merge, measured by the real runner, with its receipt (about 30 lines); measured 8330. Claude's sign-in by a link adds its end-to-end, contained-launch and real runner kill tests (signin_test.go, signin_contained_test.go, about 400 lines); measured 8090. Turn batching merged onto the browser lane: measured 8523. Turn batching adds TestHeadlessTurnBatching (three messages behind a slow turn through the real runner and fake CLI: the one next turn, its input, the bubbles and note, the usage rows and the spend lines) and TestHeadlessBatchAfterRefusedReply (the real runner reconnects after a refused reply), about 190 lines; measured 8518. Merge authority extends 4c_checks_card to end in Equipo's own merge, measured by the real runner, with its receipt (about 30 lines); measured 8330. Claude's sign-in by a link adds its end-to-end, contained-launch and real runner kill tests (signin_test.go, signin_contained_test.go, about 400 lines); measured 8090.
+size internal/thintest - 14109 Token row facts merged onto main: measured 14109. Token row facts add the token row's page and browser tests (token_row_pages_test.go, token_row_browser_test.go, about 225 lines); measured 13902. Turn batching merged onto the ThinkingCycles clock fix (the drive takes a still clock and the page's record of each phrase, about 50 lines): measured 13678. Turn batching merged onto the browser lane: measured 13631. Turn batching adds its contracts (the crash between turns, the stranded recovery, failed, cancelled, interrupted and retried turns, the cancelled batch, the note clearing, batches split to fit one frame and the failed batch's note; about 430 lines); measured 13630 with the ship buttons merged. The ship buttons add their contract and browser tests (ships_buttons_test.go, ships_buttons_browser_test.go, about 190 lines); measured 13196. Merge authority merged onto Machines in Settings, with the re-run ruling's cases and stale thinking lines: measured 12998. Merge authority thin v1 adds its contracts (mergeauth_contract_test.go, about 650 lines) the protocol-aware rigs and the Mac re-run contract (macrecheck_mergeauth_contract_test.go) and the review fixes' contracts; measured 12535 with main merged. Mac recheck adds its enrolment, skip and outcome contracts (macrecheck_contract_test.go, about 210 lines); measured 11537. Machines in Settings adds its fixture, page and browser tests (machines_fixture_test.go, machines_pages_test.go, machines_browser_test.go, about 160 lines); measured 11759. Mac recheck adds its enrolment, skip and outcome contracts (macrecheck_contract_test.go, about 210 lines); measured 11537. Stale thinking lines merged onto Machines in Settings: measured 11967. Machines in Settings adds its fixture, page and browser tests (machines_fixture_test.go, machines_pages_test.go, machines_browser_test.go, about 160 lines); measured 11759. Stale thinking lines add their browser drive (stale_thinking_browser_test.go, about 200 lines) and the queued test now checks the note; measured 11795. Mac recheck adds its enrolment, skip and outcome contracts (macrecheck_contract_test.go, about 210 lines); measured 11537. Spend 1 merged onto the four UI branches: measured 11325. Spend 1 marks overcounting Claude rows (about 120 lines); it adds the task page's spend contract and the 0059 upgrade (spend_pages_test.go, about 100 lines) and the fix round feedback by protocol (about 40); measured 10224. The team panel merged onto Projects UX and the Settings UX pass: measured 11064 with all three. The team panel adds its page contract and the drawer's browser drive at 1280 and 390 (team_panel_test.go, team_panel_browser_test.go, about 300 lines); measured 10235. Projects UX merged onto the Settings UX pass: measured 10768 with both. Projects UX adds the Projects page contracts (order, quiet fold, filter, stars and Undo, the coordinator's star, repository counts, whole words), the decision cards' Mac and Ask about this contracts and their browser drive (projects_pages_test.go, projects_browser_test.go, about 330 lines); measured 10321. The Settings UX pass adds the Settings pattern's page contracts and the savebar, Housekeeping groups and Teams browser drives (settings_ux_pages_test.go, settings_ux_browser_test.go, about 430 lines); measured 10390. 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. The duplicate keep rule merged onto main: measured 13885. The duplicate combine keeps the decided task adds staging's Woodstar pair as a contract through the real store (TestContractCombineKeepsDecided, about 60 lines); measured 13747. The InnerScreens transition wait merged onto main: measured 13685. The inner screens drive waits for the row menu's opacity transition to end before it reads the menu at rest (about 7 lines); measured 13251. Turn batching merged onto the ThinkingCycles clock fix (the drive takes a still clock and the page's record of each phrase, about 50 lines): measured 13678. Turn batching merged onto the browser lane: measured 13631. Turn batching adds its contracts (the crash between turns, the stranded recovery, failed, cancelled, interrupted and retried turns, the cancelled batch, the note clearing, batches split to fit one frame and the failed batch's note; about 430 lines); measured 13630 with the ship buttons merged. The ship buttons add their contract and browser tests (ships_buttons_test.go, ships_buttons_browser_test.go, about 190 lines); measured 13196. Merge authority merged onto Machines in Settings, with the re-run ruling's cases and stale thinking lines: measured 12998. Merge authority thin v1 adds its contracts (mergeauth_contract_test.go, about 650 lines) the protocol-aware rigs and the Mac re-run contract (macrecheck_mergeauth_contract_test.go) and the review fixes' contracts; measured 12535 with main merged. Mac recheck adds its enrolment, skip and outcome contracts (macrecheck_contract_test.go, about 210 lines); measured 11537. Machines in Settings adds its fixture, page and browser tests (machines_fixture_test.go, machines_pages_test.go, machines_browser_test.go, about 160 lines); measured 11759. Mac recheck adds its enrolment, skip and outcome contracts (macrecheck_contract_test.go, about 210 lines); measured 11537. Stale thinking lines merged onto Machines in Settings: measured 11967. Machines in Settings adds its fixture, page and browser tests (machines_fixture_test.go, machines_pages_test.go, machines_browser_test.go, about 160 lines); measured 11759. Stale thinking lines add their browser drive (stale_thinking_browser_test.go, about 200 lines) and the queued test now checks the note; measured 11795. Mac recheck adds its enrolment, skip and outcome contracts (macrecheck_contract_test.go, about 210 lines); measured 11537. Spend 1 merged onto the four UI branches: measured 11325. Spend 1 marks overcounting Claude rows (about 120 lines); it adds the task page's spend contract and the 0059 upgrade (spend_pages_test.go, about 100 lines) and the fix round feedback by protocol (about 40); measured 10224. The team panel merged onto Projects UX and the Settings UX pass: measured 11064 with all three. The team panel adds its page contract and the drawer's browser drive at 1280 and 390 (team_panel_test.go, team_panel_browser_test.go, about 300 lines); measured 10235. Projects UX merged onto the Settings UX pass: measured 10768 with both. Projects UX adds the Projects page contracts (order, quiet fold, filter, stars and Undo, the coordinator's star, repository counts, whole words), the decision cards' Mac and Ask about this contracts and their browser drive (projects_pages_test.go, projects_browser_test.go, about 330 lines); measured 10321. The Settings UX pass adds the Settings pattern's page contracts and the savebar, Housekeeping groups and Teams browser drives (settings_ux_pages_test.go, settings_ux_browser_test.go, about 430 lines); measured 10390. 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. Release slice 1 merged onto main: measured 13823. Release slice 1 (hosted checks) adds its contracts (hosted_checks_contract_test.go: the pass that asks, the failure's fix round, every binding rule, the protocol 4 runner; about 140 lines); measured 13816. Turn batching merged onto the ThinkingCycles clock fix (the drive takes a still clock and the page's record of each phrase, about 50 lines): measured 13678. Turn batching merged onto the browser lane: measured 13631. Turn batching adds its contracts (the crash between turns, the stranded recovery, failed, cancelled, interrupted and retried turns, the cancelled batch, the note clearing, batches split to fit one frame and the failed batch's note; about 430 lines); measured 13630 with the ship buttons merged. The ship buttons add their contract and browser tests (ships_buttons_test.go, ships_buttons_browser_test.go, about 190 lines); measured 13196. Merge authority merged onto Machines in Settings, with the re-run ruling's cases and stale thinking lines: measured 12998. Merge authority thin v1 adds its contracts (mergeauth_contract_test.go, about 650 lines) the protocol-aware rigs and the Mac re-run contract (macrecheck_mergeauth_contract_test.go) and the review fixes' contracts; measured 12535 with main merged. Mac recheck adds its enrolment, skip and outcome contracts (macrecheck_contract_test.go, about 210 lines); measured 11537. Machines in Settings adds its fixture, page and browser tests (machines_fixture_test.go, machines_pages_test.go, machines_browser_test.go, about 160 lines); measured 11759. Mac recheck adds its enrolment, skip and outcome contracts (macrecheck_contract_test.go, about 210 lines); measured 11537. Stale thinking lines merged onto Machines in Settings: measured 11967. Machines in Settings adds its fixture, page and browser tests (machines_fixture_test.go, machines_pages_test.go, machines_browser_test.go, about 160 lines); measured 11759. Stale thinking lines add their browser drive (stale_thinking_browser_test.go, about 200 lines) and the queued test now checks the note; measured 11795. Mac recheck adds its enrolment, skip and outcome contracts (macrecheck_contract_test.go, about 210 lines); measured 11537. Spend 1 merged onto the four UI branches: measured 11325. Spend 1 marks overcounting Claude rows (about 120 lines); it adds the task page's spend contract and the 0059 upgrade (spend_pages_test.go, about 100 lines) and the fix round feedback by protocol (about 40); measured 10224. The team panel merged onto Projects UX and the Settings UX pass: measured 11064 with all three. The team panel adds its page contract and the drawer's browser drive at 1280 and 390 (team_panel_test.go, team_panel_browser_test.go, about 300 lines); measured 10235. Projects UX merged onto the Settings UX pass: measured 10768 with both. Projects UX adds the Projects page contracts (order, quiet fold, filter, stars and Undo, the coordinator's star, repository counts, whole words), the decision cards' Mac and Ask about this contracts and their browser drive (projects_pages_test.go, projects_browser_test.go, about 330 lines); measured 10321. The Settings UX pass adds the Settings pattern's page contracts and the savebar, Housekeeping groups and Teams browser drives (settings_ux_pages_test.go, settings_ux_browser_test.go, about 430 lines); measured 10390. 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. The InnerScreens transition wait merged onto main: measured 13685. The inner screens drive waits for the row menu's opacity transition to end before it reads the menu at rest (about 7 lines); measured 13251. Turn batching merged onto the ThinkingCycles clock fix (the drive takes a still clock and the page's record of each phrase, about 50 lines): measured 13678. Turn batching merged onto the browser lane: measured 13631. Turn batching adds its contracts (the crash between turns, the stranded recovery, failed, cancelled, interrupted and retried turns, the cancelled batch, the note clearing, batches split to fit one frame and the failed batch's note; about 430 lines); measured 13630 with the ship buttons merged. The ship buttons add their contract and browser tests (ships_buttons_test.go, ships_buttons_browser_test.go, about 190 lines); measured 13196. Merge authority merged onto Machines in Settings, with the re-run ruling's cases and stale thinking lines: measured 12998. Merge authority thin v1 adds its contracts (mergeauth_contract_test.go, about 650 lines) the protocol-aware rigs and the Mac re-run contract (macrecheck_mergeauth_contract_test.go) and the review fixes' contracts; measured 12535 with main merged. Mac recheck adds its enrolment, skip and outcome contracts (macrecheck_contract_test.go, about 210 lines); measured 11537. Machines in Settings adds its fixture, page and browser tests (machines_fixture_test.go, machines_pages_test.go, machines_browser_test.go, about 160 lines); measured 11759. Mac recheck adds its enrolment, skip and outcome contracts (macrecheck_contract_test.go, about 210 lines); measured 11537. Stale thinking lines merged onto Machines in Settings: measured 11967. Machines in Settings adds its fixture, page and browser tests (machines_fixture_test.go, machines_pages_test.go, machines_browser_test.go, about 160 lines); measured 11759. Stale thinking lines add their browser drive (stale_thinking_browser_test.go, about 200 lines) and the queued test now checks the note; measured 11795. Mac recheck adds its enrolment, skip and outcome contracts (macrecheck_contract_test.go, about 210 lines); measured 11537. Spend 1 merged onto the four UI branches: measured 11325. Spend 1 marks overcounting Claude rows (about 120 lines); it adds the task page's spend contract and the 0059 upgrade (spend_pages_test.go, about 100 lines) and the fix round feedback by protocol (about 40); measured 10224. The team panel merged onto Projects UX and the Settings UX pass: measured 11064 with all three. The team panel adds its page contract and the drawer's browser drive at 1280 and 390 (team_panel_test.go, team_panel_browser_test.go, about 300 lines); measured 10235. Projects UX merged onto the Settings UX pass: measured 10768 with both. Projects UX adds the Projects page contracts (order, quiet fold, filter, stars and Undo, the coordinator's star, repository counts, whole words), the decision cards' Mac and Ask about this contracts and their browser drive (projects_pages_test.go, projects_browser_test.go, about 330 lines); measured 10321. The Settings UX pass adds the Settings pattern's page contracts and the savebar, Housekeeping groups and Teams browser drives (settings_ux_pages_test.go, settings_ux_browser_test.go, about 430 lines); measured 10390. 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.
perf GET /api/v1/projects/{id}/merge-policy skip Merge authority person API: bearer-only JSON for devices; the browser reads the policy on /projects/{id}.
diff --git a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
index 31c18dad..ff921ec0 100644
--- a/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
+++ b/docs/superpowers/plans/CONTROLLER-REPORT-plan-3.md
@@ -6116,6 +6116,14 @@ records remain unchanged.
| `machines.step_approve` | Check that the label and key fingerprint match the machine, then approve it. You can check its connection below. | Add a machine: step 3 | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| `machines.new` | New machines | Add a machine: group heading | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| `machines.new_none` | Recently approved machines appear here, along with any that have never connected. | Add a machine: group with no new machines | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
+| `chat.connections.you_said` | (added by you) | Token row facts (Connections row, after an email the person typed where the provider named none) | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
+| `chat.connections.usage_pending` | Usage shows after %s reports it | Token row facts (Connections row, a Ready row with no usage meter) | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
+| `chat.connections.usage_unreported` | Claude has not reported usage for this connection | Token row facts (Connections row, a Claude token row answered on over five minutes ago with no usage window ever) | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
+| `chat.connections.email_ask` | Claude account email | Token row facts (Connections row, the optional email field; open once after a token sign-in) | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
+| `chat.connections.email_add` | Add the account email | Token row facts (Connections row, quiet link opening the field) | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
+| `chat.connections.email_change` | Change the account email | Token row facts (Connections row, the same link once an email is typed) | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
+| `chat.connections.email_hint` | Optional. Shown only on this row. Equipo does not verify it with Claude. | Token row facts (Connections row, under the email field) | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
+| `chat.connections.email_bad` | That does not look like an email address. | Token row facts (Connections row, beside the field when the server refuses its shape) | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| `chat.paste.copy` | Copy | Paste box: the Copy button on every fenced block in a message | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| `chat.paste.copied` | Copied | Paste box: the button for a moment after a copy, and announced | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
| `chat.paste.selected` | Selected. Copy it with your keyboard. | Paste box: announced, not shown, when the clipboard is refused and the text is left selected | Runtime; COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11) |
@@ -6926,6 +6934,48 @@ Verification (targeted, niced):
- `go test -tags browser ./internal/thintest -run '^TestBrowserShipsButtons$'`: ok. Mutation: the script returning at once fails it at "Saved and Undo". `'^TestBrowserInnerScreens$'`: ok.
- `go test ./internal/equipo -run 'TestTemplateCopyKeys|TestRunnerCopyInventory'` and `EQUIPO_RELEASE_COPY_CHECK=1 go test ./internal/equipotest -run '^TestReleaseCopyReviewed$'`: ok. `make budget`: ok after raising internal/thintest to 13196 test lines (measured).
+## Token row facts (2026-11-11)
+
+Paul: "Why does this Claude account not show its email address or its
+usage?" A setup-token connection has neither: the CLI names no account
+for an environment token, and the token check ignored the provider's
+rate limits, so a token that never served a turn never got a meter.
+
+Runner: the check (`CheckToken`) now reads `rate_limit_event` as a turn
+does and returns the last one; the `Verify` wiring records it with
+`Conns.Observe`, or `Conns.Limit` for a rejection, and asks for a hello.
+No new polling and no new CLI flags. A check refused on quota with a
+rejected rate limit now keeps the token, limited until the reset; it
+used to end "did not finish", which undid a good token at connect.
+
+Row: where the provider named no account, a token row offers "Add the
+account email" (open once, as "Claude account email", on the row a
+token sign-in just added). The email is the person's words, in
+`chat_connections.stated_email` (migration 0063), shown as "(added by
+you)" on their row only: never in the API or events, never sent to the
+runner, never used to match, deduplicate or route. Shape checked (one @,
+a dotted domain, at most 254 bytes, no spaces, control or format
+characters); owner only, through the same-origin form like the others.
+A Ready row with no meter says "Usage shows after Claude reports it",
+or, for a token row answered on more than five minutes ago that never
+reported a window, "Claude has not reported usage for this connection".
+
+Copy: 8 new strings. One delegated Astra pass (gpt-6-astra, effort
+high) kept 4 and changed 4 (`you_said` from "(you said)",
+`usage_unreported` from "Usage not reported for this kind of sign-in",
+`email_ask` from "Which Claude account is this?", `email_hint`); all 8
+rows above are marked COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11),
+and copy.go matches. Astra's two flags were the reasons for its changes
+to `usage_unreported` (the evidence is about this connection, not every
+setup token) and `email_hint` (Equipo does check the shape).
+
+Verification (targeted, niced):
+
+- `go test ./internal/headless -run '^TestHeadlessTokenCheckHeadroom$'`: red before the runner change (the row never limited), then ok. Mutations: the Observe call dropped (windows not kept) and the Limit call dropped (never limited) each fail it; restored.
+- `go test ./internal/thintest -run '^TestPagesTokenRowFacts$'`: ok. Mutations: the store's person check widened (a teammate set the email) and the served condition dropped each fail it; restored.
+- `go test -tags browser ./internal/thintest -run '^TestBrowserTokenRowEmail$'`: ok, twice (before and after the copy pass).
+- `go test ./internal/runner/thin -run 'Token|Conns|Limit'`, `./internal/headless -run '^(TestHeadlessConn|TestHeadlessSignIn|TestHeadlessToken)'`, `./internal/thintest -run '^(TestPagesConnectionsAdd|TestContractToken.*|TestContractConnections)$'` and the settings page tests, `./internal/equipo/chat`, `./internal/equipo -run 'TestTemplateCopyKeys|TestRunnerCopyInventory|TestConnections|TestMigration|TestConversationMigrationSnapshot'`, `./internal/plan3test -run TestPlan3ReleaseBoundaries`, `EQUIPO_RELEASE_COPY_CHECK=1 go test ./internal/equipotest -run '^TestReleaseCopyReviewed$'`, `-tags perf ./internal/equipotest -run '^TestPerfScreens$'`: ok.
+- `python3 scripts/runner-dead-references.py` and `make budget`: ok after raising internal/equipo to 17009, internal/equipo/chat to 14195, internal/runner/thin to 16614 source lines, internal/headless to 8593 and internal/thintest to 13902 test lines (measured).
## Paste box (2026-11-11)
Paul: "Equipo should be able to present things that need to be pasted in
diff --git a/internal/equipo/app.go b/internal/equipo/app.go
index e083b703..36589fa0 100644
--- a/internal/equipo/app.go
+++ b/internal/equipo/app.go
@@ -272,6 +272,7 @@ func RouterWithStore(d *db.DB, cfg Config, mailer mail.Sender, logger *slog.Logg
r.Post("/conversation/connections/{id}/sign-out", a.connectionsSignOut)
r.Post("/conversation/connections/{id}/forget", a.connectionsForget)
r.Post("/conversation/connections/{id}/check", a.connectionsCheck)
+ r.Post("/conversation/connections/{id}/email", a.connectionsEmail)
r.Post("/conversation/connections/prefer", a.connectionsPrefer)
a.conversationHandler().Routes(r)
a.planHandler().Routes(r)
diff --git a/internal/equipo/chat/connections.go b/internal/equipo/chat/connections.go
index 11e1b49c..abe4b8a9 100644
--- a/internal/equipo/chat/connections.go
+++ b/internal/equipo/chat/connections.go
@@ -8,6 +8,8 @@ import (
"slices"
"strings"
"time"
+ "unicode"
+ "unicode/utf8"
"amadan.net/oficina/equipo/internal/wire"
"gorm.io/gorm"
@@ -49,6 +51,11 @@ type connectionRecord struct {
// ExpiresEstimated says the date is an estimate.
ExpiresAt *time.Time
ExpiresEstimated bool
+ // StatedEmail is the account email the person typed for a token
+ // connection, kept apart from Label (what the provider said): shown
+ // beside the row as theirs, never matched, deduplicated or routed on,
+ // and never sent to the runner.
+ StatedEmail string
}
func (connectionRecord) TableName() string { return "chat_connections" }
@@ -865,3 +872,96 @@ func (s *Store) UsageToday(ctx context.Context, person string) (map[string]int64
})
return out, err
}
+
+// MaxStatedEmail is the longest account email a person may type.
+const MaxStatedEmail = 254
+
+// StatedEmailShape reports whether s looks like an email address: one
+// @ with something either side, a dot inside the domain, at most
+// MaxStatedEmail bytes, and no spaces, control or format characters.
+// It proves nothing about the account.
+func StatedEmailShape(s string) bool {
+ if s == "" || len(s) > MaxStatedEmail || !utf8.ValidString(s) {
+ return false
+ }
+ for _, r := range s {
+ if unicode.IsControl(r) || unicode.Is(unicode.Cf, r) || unicode.IsSpace(r) || strings.ContainsRune(`<>()[]\,;:"`, r) {
+ return false
+ }
+ }
+ local, domain, ok := strings.Cut(s, "@")
+ host := strings.Trim(domain, ".")
+ return ok && local != "" && host == domain && strings.Contains(host, ".") && !strings.Contains(domain, "@") && !strings.Contains(domain, "..")
+}
+
+// SetStatedEmail keeps the account email the person says one of their
+// token connections signs in as ("" clears it). It is their words, kept
+// apart from what the provider reports: shown on their row and nowhere
+// else, never sent to the runner, never matched or routed on.
+func (s *Store) SetStatedEmail(ctx context.Context, person, id, email string) error {
+ email = strings.TrimSpace(email)
+ if email != "" && !StatedEmailShape(email) {
+ return ErrInvalid
+ }
+ return s.tx(ctx, func(t *txn) error {
+ if err := s.authority.CurrentPerson(ctx, t.db); err != nil {
+ return err
+ }
+ var r connectionRecord
+ if err := t.db.Where("id = ? AND person = ?", id, person).First(&r).Error; errors.Is(err, gorm.ErrRecordNotFound) {
+ return ErrNotFound
+ } else if err != nil {
+ return err
+ }
+ if r.Kind != wire.KindToken || r.LocalID == "" || r.State == wire.ConnSignedOut || r.State == wire.ConnConnecting {
+ return ErrConflict
+ }
+ if r.StatedEmail == email {
+ return nil
+ }
+ if err := t.db.Model(&connectionRecord{}).Where("id = ?", r.ID).Update("stated_email", email).Error; err != nil {
+ return err
+ }
+ r.StatedEmail = email
+ // The row's event, so the person's other pages read it again.
+ return t.saveConnection(&r, false)
+ })
+}
+
+// RowFacts are what the Connections page knows beside the runner's
+// report: the email the person stated for each connection (by its id),
+// and the connections (by local id) a turn was answered on a while ago,
+// whose provider had its chance to report usage by now.
+type RowFacts struct {
+ Stated map[string]string
+ Served map[string]bool
+}
+
+// ConnectionRowFacts reads the person's RowFacts; served counts only
+// answered turns, steps and questions recorded more than grace ago,
+// never a token check.
+func (s *Store) ConnectionRowFacts(ctx context.Context, person string, grace time.Duration) (RowFacts, error) {
+ servedBefore := s.now().Add(-grace)
+ out := RowFacts{Stated: map[string]string{}, Served: map[string]bool{}}
+ err := s.read(ctx, func(tx *gorm.DB) error {
+ if err := s.authority.CurrentPerson(ctx, tx); err != nil {
+ return err
+ }
+ var stated []connectionRecord
+ if err := tx.Select("id", "stated_email").Where("person = ? AND coalesce(stated_email, '') <> ''", person).Find(&stated).Error; err != nil {
+ return err
+ }
+ for _, r := range stated {
+ out.Stated[r.ID] = r.StatedEmail
+ }
+ var served []string
+ if err := tx.Raw("SELECT DISTINCT connection FROM chat_usage WHERE person = ? AND role <> 'check' AND outcome = ? AND recorded_at < ?", person, wire.OutcomeReplied, servedBefore).Scan(&served).Error; err != nil {
+ return err
+ }
+ for _, c := range served {
+ out.Served[c] = true
+ }
+ return nil
+ })
+ return out, err
+}
diff --git a/internal/equipo/chat_connections.go b/internal/equipo/chat_connections.go
index 2ef0983f..771818ce 100644
--- a/internal/equipo/chat_connections.go
+++ b/internal/equipo/chat_connections.go
@@ -261,11 +261,17 @@ func (a *application) connectionsPageFor(w http.ResponseWriter, r *http.Request,
a.failure(w, r, chatError(err))
return
}
+ facts, err := a.store.Chat().ConnectionRowFacts(ctx, address, usageReportGrace)
+ if err != nil {
+ a.failure(w, r, chatError(err))
+ return
+ }
v := connectionsPage(snap, today, prefer, runner, time.Now())
v.Adding = adding
for i := range v.Rows {
v.Rows[i].New = !adding && v.Rows[i].ID == r.URL.Query().Get("added")
}
+ rowFacts(&v, snap, facts)
data.Models, data.ConnectionsStream = v, true
render(w, "models", data)
}
@@ -328,6 +334,14 @@ func (a *application) connectionsPrefer(w http.ResponseWriter, r *http.Request)
})
}
+// connectionsEmail keeps the account email the person typed for one of
+// their own token connections, or clears it (display only).
+func (a *application) connectionsEmail(w http.ResponseWriter, r *http.Request) {
+ a.chatActionTo(w, r, "/conversation/settings/connections", func(ctx context.Context, address string) error {
+ return a.store.Chat().SetStatedEmail(ctx, address, chi.URLParam(r, "id"), r.PostFormValue("email"))
+ })
+}
+
// connectionsCheck is a connection's Check again.
func (a *application) connectionsCheck(w http.ResponseWriter, r *http.Request) {
a.chatActionTo(w, r, "/conversation/connections", func(ctx context.Context, address string) error {
diff --git a/internal/equipo/connections_view.go b/internal/equipo/connections_view.go
index 0b25307f..f93bfc8b 100644
--- a/internal/equipo/connections_view.go
+++ b/internal/equipo/connections_view.go
@@ -5,6 +5,7 @@ import (
"strings"
"time"
+ "amadan.net/oficina/equipo/internal/equipo/chat"
"amadan.net/oficina/equipo/internal/wire"
)
@@ -47,6 +48,13 @@ type connRow struct {
Note string
// New: the row just added, highlighted once.
New bool
+ // Stated is the account email the person typed, shown as theirs
+ // where the provider named none. AskEmail offers the field for it;
+ // AskOpen opens it at once (a token sign-in that just finished).
+ Stated string
+ AskEmail, AskOpen bool
+ // UsageNote stands where a meter would, while none can show.
+ UsageNote string
}
// connMeter is one provider-reported rate window. Resets counts down to
@@ -204,6 +212,42 @@ func connectionsPage(snap wire.Snapshot, today map[string]int64, prefer wire.Pre
return v
}
+// usageReportGrace is how long after an answered turn its provider's
+// usage has surely reached the row (hello every 30 s, headroom-only
+// changes at most once a minute), so a row with none can say none came.
+const usageReportGrace = 5 * time.Minute
+
+// rowFacts adds what the instance knows beside the runner's report: the
+// account email the person stated for a token connection the provider
+// named no account for, the field to state it in, and, on a ready row
+// with no meter, why there is none. A token connection is said to get
+// no usage only when a turn was answered on it long enough ago and it
+// never reported a window; otherwise the row says usage comes once the
+// provider reports it.
+func rowFacts(v *modelsView, snap wire.Snapshot, f chat.RowFacts) {
+ byID := map[string]wire.Connection{}
+ for _, c := range snap.Connections {
+ byID[c.ID] = c
+ }
+ for i := range v.Rows {
+ row := &v.Rows[i]
+ c := byID[row.ID]
+ if c.Kind == wire.KindToken && c.Label == "" && c.LocalID != "" && row.State != wire.ConnSignedOut {
+ row.Stated = f.Stated[c.ID]
+ row.AskEmail = true
+ row.AskOpen = row.New && row.Stated == ""
+ }
+ if row.State != wire.ConnHealthy || len(row.Meters) > 0 {
+ continue
+ }
+ if c.Kind == wire.KindToken && f.Served[c.LocalID] && (c.Headroom == nil || len(c.Headroom.Windows) == 0) {
+ row.UsageNote = copyText("chat.connections.usage_unreported")
+ } else {
+ row.UsageNote = fmt.Sprintf(copyText("chat.connections.usage_pending"), row.Name)
+ }
+ }
+}
+
// newerThan: an attempt was started after c ended.
func newerThan(conns []wire.Connection, c wire.Connection) bool {
for _, o := range conns {
diff --git a/internal/equipo/copy.go b/internal/equipo/copy.go
index 01a0f379..05c00981 100644
--- a/internal/equipo/copy.go
+++ b/internal/equipo/copy.go
@@ -915,6 +915,14 @@ var pageCopy = map[string]string{
"chat.connections.code_failed": "That did not go through. Paste the code again.", // 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.", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
"chat.connections.waiting_code": "Your runner is finishing the sign-in…", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
+ "chat.connections.you_said": "(added by you)", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11): token row facts
+ "chat.connections.usage_pending": "Usage shows after %s reports it", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11): token row facts
+ "chat.connections.usage_unreported": "Claude has not reported usage for this connection", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11): token row facts
+ "chat.connections.email_ask": "Claude account email", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11): token row facts
+ "chat.connections.email_add": "Add the account email", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11): token row facts
+ "chat.connections.email_change": "Change the account email", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11): token row facts
+ "chat.connections.email_hint": "Optional. Shown only on this row. Equipo does not verify it with Claude.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11): token row facts
+ "chat.connections.email_bad": "That does not look like an email address.", // COPY ACCEPTED BY DELEGATION (Astra, 2026-11-11): token row facts
"chat.switched": "Switched to %s", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
"chat.switched_reset": "Switched to %s; %s resets %s", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
"chat.no_connection": "Nothing can answer right now. %s", // COPY ACCEPTED FOR NOW (Paul, 2026-11-04; iterate in context)
diff --git a/internal/equipo/migrations/0063_thin_connection_stated_email.sql b/internal/equipo/migrations/0063_thin_connection_stated_email.sql
new file mode 100644
index 00000000..b1f7fc17
--- /dev/null
+++ b/internal/equipo/migrations/0063_thin_connection_stated_email.sql
@@ -0,0 +1 @@
+ALTER TABLE chat_connections ADD COLUMN stated_email text;
diff --git a/internal/equipo/migrations/schema.sql b/internal/equipo/migrations/schema.sql
index 4dee3a6d..877f63cb 100644
--- a/internal/equipo/migrations/schema.sql
+++ b/internal/equipo/migrations/schema.sql
@@ -607,7 +607,7 @@ CREATE TABLE chat_task_distinct (a text, b text, created_at datetime, PRIMARY KE
CREATE TABLE chat_questions (id text PRIMARY KEY, task_id text, asker text, idempotency_key text, step_id text, specialist text, chosen text, text text, state text, reason text, attempt integer, dispatched numeric, answer text, timing text, revision integer, created_at datetime, updated_at datetime);
CREATE INDEX chat_question_task ON chat_questions(task_id);
CREATE UNIQUE INDEX chat_question_key ON chat_questions(task_id, asker, idempotency_key);
-CREATE TABLE chat_connections (id text PRIMARY KEY, person text, runner_id text, local_id text, provider text, kind text, label text, state text, reason text, plan text, headroom text, prompt text, revision integer, created_at datetime, updated_at datetime, expires_at datetime, expires_estimated numeric);
+CREATE TABLE chat_connections (id text PRIMARY KEY, person text, runner_id text, local_id text, provider text, kind text, label text, state text, reason text, plan text, headroom text, prompt text, revision integer, created_at datetime, updated_at datetime, expires_at datetime, expires_estimated numeric, stated_email text);
CREATE INDEX chat_connection_person ON chat_connections(person);
CREATE TABLE chat_usage (id integer PRIMARY KEY, person text, connection text, provider text, model text, role text, task_id text, step_id text, turn_id text, attempt integer, outcome text, complete numeric, input_tokens integer, cached_input_tokens integer, cache_write_tokens integer, output_tokens integer, reasoning_output_tokens integer, recorded_at datetime, round integer, turns integer, overcount numeric);
CREATE INDEX chat_usage_person ON chat_usage(person, recorded_at);
diff --git a/internal/equipo/static/connections.js b/internal/equipo/static/connections.js
index bc0f77e7..4b863218 100644
--- a/internal/equipo/static/connections.js
+++ b/internal/equipo/static/connections.js
@@ -132,6 +132,14 @@
if (document.activeElement === field) typing = field;
}
});
+ // An open account email field stays open as it is, with what is
+ // typed in it, until it is saved or closed.
+ box.querySelectorAll("details[data-account-email][open]").forEach(function (el) {
+ var same = next.querySelector('details[data-account-email="' + CSS.escape(el.dataset.accountEmail) + '"]');
+ if (!same) return;
+ if (el.contains(document.activeElement)) typing = document.activeElement;
+ same.replaceWith(el);
+ });
box.replaceChildren.apply(box, Array.from(next.children));
if (typing) typing.focus();
live(box);
@@ -241,6 +249,7 @@
if (!adding && form.matches("[data-add-form]")) return;
event.preventDefault();
if (form.matches("[data-token-form], [data-code-form]")) { sealSecret(form); return; }
+ if (form.matches("[data-email-form]")) { saveEmail(form); return; }
// An ended attempt's note goes once dismissed, or once a new
// attempt starts.
var note = form.closest("[data-connection-note]");
@@ -270,6 +279,31 @@
.catch(function () { form.submit(); });
});
+ // The account email a person types for a token row: posted in the
+ // background; one the server refuses says so beside the field, and a
+ // saved one closes the field and the row reads again.
+ function saveEmail(form) {
+ var note = form.querySelector("[data-email-note]");
+ var field = form.querySelector("[data-email-field]");
+ note.hidden = true;
+ fetch(form.action, { method: "POST", credentials: "same-origin", headers: { "Accept": "application/json" }, body: new URLSearchParams(new FormData(form)) })
+ .then(function (r) {
+ if (r.status === 422) {
+ note.textContent = note.dataset.bad;
+ note.hidden = false;
+ field.focus();
+ return;
+ }
+ if (!r.ok) throw new Error("post");
+ var open = form.closest("details");
+ if (open) open.open = false;
+ field.blur();
+ saved();
+ refreshSoon();
+ })
+ .catch(function () { form.submit(); });
+ }
+
// A preference saved: the quiet tick by the heading, as in Settings.
function saved() {
var tpl = document.querySelector("template[equipo-saved-template]");
diff --git a/internal/equipo/static/equipo.css b/internal/equipo/static/equipo.css
index 016e7664..3f6e3541 100644
--- a/internal/equipo/static/equipo.css
+++ b/internal/equipo/static/equipo.css
@@ -992,6 +992,15 @@ a[equipo-source]:hover { color: var(--rst-text); text-decoration: underline; tex
[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; }
+[equipo-conn-said], [equipo-conn-usage-note] { font-size: var(--rst-fs-xs); color: var(--rst-text-faint, var(--rst-text-muted)); }
+[equipo-conn-email] { margin-block-start: .35rem; font-size: var(--rst-fs-xs); }
+[equipo-conn-email] > summary { display: inline; list-style: none; cursor: pointer; color: var(--rst-text-muted); text-decoration: underline; text-underline-offset: 2px; }
+[equipo-conn-email] > summary::-webkit-details-marker { display: none; }
+[equipo-conn-email] > summary:hover, [equipo-conn-email] > summary:focus-visible { color: var(--rst-text); }
+[equipo-conn-email] > form { margin-block-start: var(--rst-sp-2); max-inline-size: 28rem; font-size: var(--rst-fs-sm); }
+[equipo-conn-email] [equipo-conn-token-row] input { font-family: inherit; }
+[equipo-conn-email] [equipo-conn-small] { margin: 0; }
+[equipo-conn-email] [data-email-note] { color: var(--rst-tone-negative-fg); }
@container conn (max-width: 600px) {
[equipo-conn-answering] { padding: var(--rst-sp-3); }
[equipo-conn-lead] { font-size: var(--rst-fs-base); }
diff --git a/internal/equipo/templates/models.html b/internal/equipo/templates/models.html
index a7773ea6..2d71c87d 100644
--- a/internal/equipo/templates/models.html
+++ b/internal/equipo/templates/models.html
@@ -58,8 +58,9 @@
{{define "conn-row"}}<article equipo-conn-row data-connection="{{.ID}}" data-provider="{{.Provider}}" data-state="{{.State}}"{{if .Needs}} data-needs{{end}}{{if .New}} data-new{{end}}>
{{template "conn-mark" .Provider}}
<div equipo-conn-body>
-<p equipo-conn-head><span equipo-conn-name>{{.Name}}</span><span equipo-conn-account>{{.Label}}{{with .Plan}}, {{.}}{{end}}</span>{{if .Preferred}}<span equipo-conn-pref>{{icon "star"}}{{copy "chat.connections.preferred"}}</span>{{end}}</p>
-<p equipo-conn-facts><span equipo-conn-state data-connection-state data-s="{{.State}}"{{with .WordsAt}} title="{{.}}"{{end}}>{{.Words}}</span>{{with .Expires}}<span equipo-conn-expires data-token-expires>{{.}}</span>{{end}}{{range .Meters}}<span equipo-conn-meter data-level="{{.Level}}"{{with .At}} title="{{.}}"{{end}}><span equipo-conn-bar><i data-w="{{.Used}}"></i></span><span>{{.Name}} <b>{{.Used}}%</b>{{with .Resets}}, {{.}}{{end}}</span></span>{{end}}</p>
+<p equipo-conn-head><span equipo-conn-name>{{.Name}}</span><span equipo-conn-account>{{if .Label}}{{.Label}}{{else if .Stated}}<span data-stated-email>{{.Stated}}</span> <span equipo-conn-said>{{copy "chat.connections.you_said"}}</span>{{end}}{{with .Plan}}, {{.}}{{end}}</span>{{if .Preferred}}<span equipo-conn-pref>{{icon "star"}}{{copy "chat.connections.preferred"}}</span>{{end}}</p>
+<p equipo-conn-facts><span equipo-conn-state data-connection-state data-s="{{.State}}"{{with .WordsAt}} title="{{.}}"{{end}}>{{.Words}}</span>{{with .Expires}}<span equipo-conn-expires data-token-expires>{{.}}</span>{{end}}{{range .Meters}}<span equipo-conn-meter data-level="{{.Level}}"{{with .At}} title="{{.}}"{{end}}><span equipo-conn-bar><i data-w="{{.Used}}"></i></span><span>{{.Name}} <b>{{.Used}}%</b>{{with .Resets}}, {{.}}{{end}}</span></span>{{end}}{{with .UsageNote}}<span equipo-conn-usage-note data-usage-note>{{.}}</span>{{end}}</p>
+{{if .AskEmail}}<details equipo-conn-email data-account-email="{{.ID}}"{{if .AskOpen}} open{{end}}><summary>{{if .Stated}}{{copy "chat.connections.email_change"}}{{else}}{{copy "chat.connections.email_add"}}{{end}}</summary><form method="post" action="/conversation/connections/{{.ID}}/email" equipo-conn-token data-email-form autocomplete="off"><label for="email-{{.ID}}">{{copy "chat.connections.email_ask"}}</label><span equipo-conn-token-row><input rst-input id="email-{{.ID}}" type="email" name="email" maxlength="254" value="{{.Stated}}" autocapitalize="off" spellcheck="false" data-email-field><button rst-btn type="submit" data-email-save>{{copy "form.save"}}</button></span><span equipo-conn-small>{{copy "chat.connections.email_hint"}}</span><span equipo-conn-small data-email-note role="status" hidden data-bad="{{copy "chat.connections.email_bad"}}" data-tone="bad"></span></form></details>{{end}}
{{if .Renew}}<div equipo-conn-renew data-token-renew>{{copy "chat.connections.token_renew"}} <form method="post" action="/conversation/connections" data-add-form equipo-inline-form><input type="hidden" name="provider" value="{{.Provider}}"><button equipo-link type="submit" data-renew>{{copy "chat.connections.sign_in_again_action"}}</button></form></div>{{end}}
{{if .Roles}}<p equipo-conn-roles><span equipo-conn-roles-label>{{copy "chat.connections.serving"}}</span>{{range .Roles}}<span equipo-conn-chip{{if .Live}} data-live{{end}}>{{if .Live}}{{template "conn-star"}}{{end}}{{.Name}}</span>{{end}}</p>{{else}}{{with .RolesNote}}<p equipo-conn-roles><span equipo-conn-roles-note>{{.}}</span></p>{{end}}{{end}}
</div>
diff --git a/internal/fakeclaude/fake.go b/internal/fakeclaude/fake.go
index b621acc0..d2baff1b 100644
--- a/internal/fakeclaude/fake.go
+++ b/internal/fakeclaude/fake.go
@@ -745,6 +745,13 @@ func (f *fake) serve(stdin io.Reader, stdout, stderr io.Writer) int {
refuse()
continue
}
+ // The runner's token check is refused on quota for an account
+ // whose email starts "spent-", as for a spent weekly limit.
+ check := prompt == CheckPrompt
+ if check && strings.HasPrefix(accountEmail(), "spent-") {
+ refuse()
+ continue
+ }
// limitnoreset:<email> is a refusal with no reset time reported;
// authrefused:<email> the provider refusing the credential.
if m := noResetWord.FindStringSubmatch(newest); m != nil && m[1] == accountEmail() {
@@ -911,7 +918,15 @@ func (f *fake) serve(stdin io.Reader, stdout, stderr io.Writer) int {
}
f.record(prompt, reply)
emit(map[string]any{"type": "assistant", "session_id": f.session, "parent_tool_use_id": nil, "message": map[string]any{"model": f.model, "id": fmt.Sprintf("msg_fake_%d", turn), "type": "message", "role": "assistant", "content": []any{map[string]string{"type": "text", "text": reply}}, "usage": map[string]int{"input_tokens": len(prompt) / 4, "output_tokens": len(reply) / 4}}, "uuid": fmt.Sprintf("assistant-%d", turn)})
- emit(map[string]any{"type": "rate_limit_event", "rate_limit_info": map[string]any{"status": "allowed", "resetsAt": time.Now().Add(100 * time.Hour).Truncate(time.Hour).Unix(), "rateLimitType": "seven_day", "utilization": 0.25}, "uuid": fmt.Sprintf("limit-%d", turn), "session_id": f.session})
+ info := map[string]any{"status": "allowed", "resetsAt": time.Now().Add(100 * time.Hour).Truncate(time.Hour).Unix(), "rateLimitType": "seven_day", "utilization": 0.25}
+ if check {
+ // The check's answer carries the windows, as the CLI's does.
+ info["unifiedWindows"] = map[string]any{
+ "five_hour": map[string]any{"utilization": 0.12, "resetsAt": time.Now().Add(3 * time.Hour).Truncate(time.Hour).Unix(), "status": "allowed"},
+ "seven_day": map[string]any{"utilization": 0.25, "resetsAt": time.Now().Add(100 * time.Hour).Truncate(time.Hour).Unix(), "status": "allowed"},
+ }
+ }
+ emit(map[string]any{"type": "rate_limit_event", "rate_limit_info": info, "uuid": fmt.Sprintf("limit-%d", turn), "session_id": f.session})
failed := strings.Contains(newest, "fail")
subtype := "success"
if failed {
@@ -1054,6 +1069,10 @@ var stepLimitWord = regexp.MustCompile(`\bsteplimit:([^\s|]+@[^\s|]+[a-z])`)
const tokenEnv = "CLAUDE_CODE_OAUTH_TOKEN"
+// CheckPrompt is the runner's token check, word for word (thin's
+// tokenCheckPrompt).
+const CheckPrompt = "Reply with the single word OK."
+
// Token is a setup token the fake accepts, for email ("" for a token
// whose account the CLI does not name). Any other value is refused.
func Token(email string) string {
diff --git a/internal/headless/token_test.go b/internal/headless/token_test.go
index 61114c68..d57bc03d 100644
--- a/internal/headless/token_test.go
+++ b/internal/headless/token_test.go
@@ -6,6 +6,7 @@ import (
"crypto/rand"
"encoding/base64"
"encoding/json"
+ "math"
"os"
"path/filepath"
"strings"
@@ -295,6 +296,75 @@ func TestHeadlessTokenRejected(t *testing.T) {
})
}
+// A token connection's check reads the provider's rate limits as a turn
+// does: a check that reports windows leaves the connection with that
+// headroom on the runner, and one refused on quota leaves it limited
+// until the reset the provider gave, on the runner and on the row. No
+// turn runs on either.
+func TestHeadlessTokenCheckHeadroom(t *testing.T) {
+ env, inst, r := localEnv(t)
+ r.addToken(t, "claude-7", "tok@example.com")
+ r.addToken(t, "claude-8", "spent-tok@example.com")
+ r.only(t, "claude-7", "claude-8")
+ r.start(t)
+ s := open(t, env)
+ s.keep()
+ ids := map[string]string{}
+ s.wait(t, "both rows", time.Minute, func(cv *thintest.Conversation) bool {
+ for _, c := range cv.Connections {
+ ids[c.LocalID] = c.ID
+ }
+ return ids["claude-7"] != "" && ids["claude-8"] != ""
+ })
+ for _, local := range []string{"claude-7", "claude-8"} {
+ if err := env.Client.CheckConnection(s.ctx, ids[local]); err != nil {
+ t.Fatal(err)
+ }
+ }
+ var spent wire.Connection
+ s.wait(t, "the refused check limits its row", 2*time.Minute, func(cv *thintest.Conversation) bool {
+ spent = cv.Connections[ids["claude-8"]]
+ return spent.State == wire.ConnLimited
+ })
+ if spent.Headroom == nil || spent.Headroom.ResetsAt == nil || time.Until(*spent.Headroom.ResetsAt) < 40*time.Hour {
+ t.Fatalf("the limited row has no reported reset: %+v", spent.Headroom)
+ }
+ until(t, "both checks' usage", func() bool {
+ var n int
+ err := inst.DB.Writer().QueryRow("SELECT count(DISTINCT connection) FROM chat_usage WHERE role = 'check'").Scan(&n)
+ return err == nil && n == 2
+ })
+ r.stop(t)
+ st, err := thin.OpenState(context.Background(), r.cfg.StateDir)
+ if err != nil {
+ t.Fatal(err)
+ }
+ defer st.Close()
+ held := map[string]wire.HeldConnection{}
+ for _, h := range (&thin.Conns{Runner: r.cfg, State: st}).Held() {
+ held[h.LocalID] = h
+ }
+ windows := func(h *wire.Headroom) map[string]float64 {
+ out := map[string]float64{}
+ if h != nil {
+ for _, w := range h.Windows {
+ out[w.Name] = math.Round(w.UsedPercent)
+ }
+ }
+ return out
+ }
+ if got := windows(held["claude-7"].Headroom); held["claude-7"].State != wire.ConnHealthy || len(got) != 2 || got["five_hour"] != 12 || got["seven_day"] != 25 {
+ t.Fatalf("the check's windows were not kept: %+v %v", held["claude-7"], got)
+ }
+ if h := held["claude-8"]; h.State != wire.ConnLimited || windows(h.Headroom)["seven_day"] != 100 {
+ t.Fatalf("the refused check did not limit the connection: %+v", h)
+ }
+ var turns int
+ if err := inst.DB.Writer().QueryRow("SELECT count(*) FROM chat_usage WHERE role <> 'check'").Scan(&turns); err != nil || turns != 0 {
+ t.Fatalf("a turn ran: %d %v", turns, err)
+ }
+}
+
// until polls cond (it reads files and rows, which send no events).
func until(t *testing.T, what string, cond func() bool) {
t.Helper()
diff --git a/internal/runner/thin/run.go b/internal/runner/thin/run.go
index 55e7911e..f4daa4f4 100644
--- a/internal/runner/thin/run.go
+++ b/internal/runner/thin/run.go
@@ -167,13 +167,28 @@ func Run(ctx context.Context, c runner.Config, o Options) error {
tools := &bridge{State: state, Link: link, Forge: fg, Clones: clones, Index: index, Logger: o.Logger, SessionRoot: o.Claude.SessionRoot, Activity: link.Activity}
o.Claude.Tools, o.Claude.Catalog = tools.Call, index.Catalog
conns := &Conns{Runner: c, State: state, Logger: o.Logger, Refresh: o.Claude.Refresh, LockWait: o.Claude.LockWait}
- // A token check is a real request; its usage counts like any other.
+ // A token check is a real request; its usage counts like any other,
+ // and the rate limit the provider reported on it is recorded as a
+ // turn's is: headroom, or limited until its reset. Not for a refused
+ // token, which is no connection.
conns.Verify = func(ctx context.Context, b runner.AccountBinding) error {
- rows, err := o.Claude.CheckToken(ctx, b)
- if rerr := state.ReportCheck(context.Background(), rows); rerr != nil && o.Logger != nil {
+ res, err := o.Claude.CheckToken(ctx, b)
+ if res.Seen != nil && !errors.Is(err, provider.ErrLoginRequired) {
+ if res.Seen.Limited {
+ conns.Limit(b.ID, *res.Seen)
+ } else {
+ conns.Observe(b.ID, *res.Seen, "")
+ }
+ }
+ if rerr := state.ReportCheck(context.Background(), res.Rows); rerr != nil && o.Logger != nil {
o.Logger.Warn("token check usage", "err", sanitize(rerr))
}
- link.Notify()
+ if res.Seen != nil {
+ // The headroom goes with the next hello, not the next beat.
+ link.HelloSoon()
+ } else {
+ link.Notify()
+ }
return err
}
engine := &Engine{State: state, Conns: conns, Logger: o.Logger, Emit: link.Delta, Act: link.Activity, Notify: link.Notify, Authorize: link.Confirm, Open: func(person string, b runner.AccountBinding) (Coordinator, error) {
diff --git a/internal/runner/thin/tokencheck.go b/internal/runner/thin/tokencheck.go
index 6e295eea..e12dab5f 100644
--- a/internal/runner/thin/tokencheck.go
+++ b/internal/runner/thin/tokencheck.go
@@ -31,65 +31,78 @@ const (
// stream). It proves nothing about the token.
var errCheckFailed = errors.New("the token check did not finish")
+// TokenCheck is what one check learned: its usage rows, whatever the
+// end, and the last rate limit the provider reported on it (nil: none),
+// read from rate_limit_event as a turn reads it.
+type TokenCheck struct {
+ Rows []wire.Usage
+ Seen *connect.Limit
+}
+
// CheckToken runs one check. nil: the provider answered (a quota refusal
// answers too: the token is good, the account busy). ErrLoginRequired:
-// the provider refused the token. Rows are its usage, whatever the end.
-func (o ClaudeOptions) CheckToken(ctx context.Context, b runner.AccountBinding) ([]wire.Usage, error) {
+// the provider refused the token.
+func (o ClaudeOptions) CheckToken(ctx context.Context, b runner.AccountBinding) (TokenCheck, error) {
+ rows, seen, err := o.checkToken(ctx, b)
+ return TokenCheck{Rows: rows, Seen: seen}, err
+}
+
+func (o ClaudeOptions) checkToken(ctx context.Context, b runner.AccountBinding) ([]wire.Usage, *connect.Limit, error) {
o.defaults()
if b.Provider != wire.ProviderClaude || b.Kind != wire.KindToken || o.Manager == nil {
- return nil, provider.ErrPolicy
+ return nil, nil, provider.ErrPolicy
}
ctx, cancel := context.WithTimeout(ctx, tokenCheckLimit)
defer cancel()
direct, err := o.Runner.DirectBinding(b)
if err != nil {
- return nil, err
+ return nil, nil, err
}
lease, err := provider.OpenRuntimeCopy(ctx, direct, o.Refresh, o.LockWait)
if err != nil {
- return nil, err
+ return nil, nil, err
}
defer lease.Close()
binding := lease.Binding()
scratch, err := os.MkdirTemp(o.Runner.ScratchRoot, "policy-")
if err != nil {
- return nil, err
+ return nil, nil, err
}
defer os.RemoveAll(scratch)
// An empty workspace: the check reads nothing, and calls no tool.
work, err := os.MkdirTemp(o.SessionRoot, "check-")
if err != nil {
- return nil, err
+ return nil, nil, err
}
defer os.RemoveAll(work)
tool, err := openToolSocket(context.Background(), o.Runner.StateDir, func(context.Context, string, string, json.RawMessage) (string, bool) { return toolNoTurn, true })
if err != nil {
- return nil, err
+ return nil, nil, err
}
defer tool.Close()
sel := provider.Selection{ConnectionID: b.LocalID, Provider: b.Provider, Family: b.Family, Model: b.Model, AccountID: b.AccountID}
in, err := runner.PolicyInputs(ctx, o.Runner, sel, binding, work, "converse", scratch)
if err != nil {
- return nil, err
+ return nil, nil, err
}
session := uuid()
in.Argv = append(in.Argv, "--session-id", session)
policy, err := provider.BuildPolicy(binding, in)
if err != nil {
- return nil, err
+ return nil, nil, err
}
if claude.ExecutableDigest(policy) != o.Digest {
- return nil, provider.ErrVersion
+ return nil, nil, provider.ErrVersion
}
if err = lease.CheckCopy(ctx); err != nil {
- return nil, err
+ return nil, nil, err
}
launch := provider.Launch{ToolSocket: tool.Path, AttemptKey: "check/" + uuid(), Workspace: work, Selection: sel, Binding: binding, Policy: policy}
pctx, kill := context.WithCancel(context.Background())
defer kill()
proc, err := o.Manager.StartRecorded(pctx, launch, in.Argv, nil)
if err != nil {
- return nil, err
+ return nil, nil, err
}
// The namespace is killed at the limit (which ends the reads below)
// and at the end; its exit is observed and its record released before
@@ -112,11 +125,14 @@ func (o ClaudeOptions) CheckToken(ctx context.Context, b runner.AccountBinding)
_, err = proc.Stdin().Write(raw)
}
if err != nil {
- return nil, firstErr(ctx.Err(), errCheckFailed)
+ return nil, nil, firstErr(ctx.Err(), errCheckFailed)
}
scan := bufio.NewScanner(proc.Stdout())
scan.Buffer(make([]byte, 0, 64<<10), claude.MaxFrameBytes)
signal := ""
+ // seen is the last rate limit the provider reported, read as a turn
+ // reads it (claude.go).
+ var seen *connect.Limit
for scan.Scan() {
events, err := claude.Decode(scan.Bytes())
if len(scan.Bytes()) > 0 && err != nil {
@@ -126,6 +142,12 @@ func (o ClaudeOptions) CheckToken(ctx context.Context, b runner.AccountBinding)
if sig := connect.ClaudeSignal(ev.Payload); sig != "" {
signal = sig
}
+ if ev.Kind == "rate_limit_event" {
+ if l, ok := connect.ClaudeRateLimit(ev.Payload); ok {
+ seen = &l
+ }
+ continue
+ }
if ev.Kind != "turn.completed" && ev.Kind != "turn.failed" {
continue
}
@@ -134,17 +156,22 @@ func (o ClaudeOptions) CheckToken(ctx context.Context, b runner.AccountBinding)
if !ok || res.Failed {
outcome = wire.OutcomeFailed
}
+ if outcome == wire.OutcomeFailed && signal == connect.FailQuota && (seen == nil || !seen.Limited) {
+ // Rate-limit retries ran out: quota, no reset reported.
+ seen = &connect.Limit{Limited: true}
+ }
rows := usageRows(connect.ClaudeRows(ev.Payload), b, 1, outcome)
switch {
case signal == connect.FailAuth:
- return rows, provider.ErrLoginRequired
- case outcome == wire.OutcomeReplied, signal == connect.FailQuota:
- return rows, nil
+ return rows, nil, provider.ErrLoginRequired
+ case outcome == wire.OutcomeReplied, signal == connect.FailQuota, seen != nil && seen.Limited:
+ // A rejected rate limit is the provider's answer too.
+ return rows, seen, nil
}
- return rows, errCheckFailed
+ return rows, seen, errCheckFailed
}
}
- return nil, firstErr(ctx.Err(), errCheckFailed)
+ return nil, nil, firstErr(ctx.Err(), errCheckFailed)
}
// ReportCheck queues a check's usage for the instance (durable).
diff --git a/internal/thintest/token_row_browser_test.go b/internal/thintest/token_row_browser_test.go
new file mode 100644
index 00000000..d029cdeb
--- /dev/null
+++ b/internal/thintest/token_row_browser_test.go
@@ -0,0 +1,57 @@
+//go:build browser
+
+package thintest
+
+import (
+ "testing"
+
+ "amadan.net/oficina/equipo/internal/wire"
+)
+
+// TestBrowserTokenRowEmail: on Connections, a token row's quiet "Add the
+// account email" opens the field in place. What is typed stays while the
+// page reads itself again for another row's change; a shape the server
+// refuses says so beside the field; a good one saves with no reload, the
+// field closes and the row shows the email as the person's, "(added by you)".
+func TestBrowserTokenRowEmail(t *testing.T) {
+ r, runner, token, login := tokenRowRig(t)
+ p := openInner(t, r.inst.URL, r.inst.Cookie(), 1280, 900, false, "light", "reduce")
+ defer p.stop()
+ p.open("/conversation/settings/connections")
+ details := `document.querySelector('details[data-account-email="` + token + `"]')`
+ field := details + `.querySelector('[data-email-field]')`
+ p.wait(details, "the account email field")
+ p.check(`!`+details+`.open && `+details+`.querySelector('summary').textContent==='Add the account email'`, "the field is closed behind its link")
+ p.click(`details[data-account-email="` + token + `"] summary`)
+ p.check(details+`.open`, "the link did not open the field")
+ p.check(`(()=>{const f=`+field+`;f.focus();f.value='me@example';return true})()`, "type")
+
+ // Another row changes: the page reads itself again, the field stays.
+ hello := held(wire.HeldConnection{LocalID: "claude-9", Person: Owner, Provider: "claude", Kind: wire.KindToken, State: wire.ConnHealthy},
+ wire.HeldConnection{LocalID: "claude-1", Person: Owner, Provider: "claude", Kind: "subscription", Label: Owner, State: wire.ConnSignInAgain})
+ hello.Generation = runner.Welcome.Generation
+ if err := runner.Send(r.ctx, "h2", wire.FrameHello, hello); err != nil {
+ t.Fatal(err)
+ }
+ p.wait(`document.querySelector('[data-connection="`+login+`"][data-state="sign_in_again"]')`, "the other row's change in place")
+ p.check(details+`.open && `+field+`.value==='me@example' && document.activeElement===`+field, "the refresh took the field away")
+
+ // Refused by the server (the browser takes this shape): said here.
+ p.click(`details[data-account-email="` + token + `"] [data-email-save]`)
+ p.wait(`!`+details+`.querySelector('[data-email-note]').hidden`, "the refusal beside the field")
+ p.check(details+`.querySelector('[data-email-note]').textContent==='That does not look like an email address.' && `+details+`.open`, "the refusal's words")
+
+ p.check(`(()=>{`+field+`.value='me@example.com';return true})()`, "retype")
+ p.click(`details[data-account-email="` + token + `"] [data-email-save]`)
+ row := `document.querySelector('[data-connection="` + token + `"]')`
+ p.wait(row+` && `+row+`.querySelector('[data-stated-email]') && `+row+`.querySelector('[data-stated-email]').textContent==='me@example.com'`, "the stated email on the row")
+ p.check(row+`.querySelector('[equipo-conn-said]').textContent==='(added by you)' && !`+details+`.open && `+details+`.querySelector('summary').textContent==='Change the account email'`, "the saved row")
+ p.stayed("saving the email")
+ p.fits("the token row")
+ p.shot("token-row-email-1280")
+ waitFor(t, "the email stored", func() bool {
+ var got string
+ err := r.inst.DB.Writer().QueryRow("SELECT coalesce(stated_email, '') FROM chat_connections WHERE id = ?", token).Scan(&got)
+ return err == nil && got == "me@example.com"
+ })
+}
diff --git a/internal/thintest/token_row_pages_test.go b/internal/thintest/token_row_pages_test.go
new file mode 100644
index 00000000..d4bc5640
--- /dev/null
+++ b/internal/thintest/token_row_pages_test.go
@@ -0,0 +1,167 @@
+package thintest
+
+import (
+ "net/http"
+ "net/url"
+ "strings"
+ "testing"
+ "time"
+
+ "amadan.net/oficina/equipo/internal/wire"
+)
+
+// tokenRowRig is a runner whose hello holds the owner's Claude token
+// connection (no account named, no usage reported) and a Claude login
+// the provider named, with its week window. It returns the token row's
+// id and the login's.
+func tokenRowRig(t *testing.T) (r *toolRig, runner *FakeRunner, token, login string) {
+ t.Helper()
+ r = &toolRig{rig: newRig(t)}
+ runner = r.dial(0)
+ reset := time.Now().Add(30 * time.Hour).UTC().Truncate(time.Minute)
+ hello := held(wire.HeldConnection{LocalID: "claude-9", Person: Owner, Provider: "claude", Kind: wire.KindToken, State: wire.ConnHealthy},
+ wire.HeldConnection{LocalID: "claude-1", Person: Owner, Provider: "claude", Kind: "subscription", Label: Owner, State: wire.ConnHealthy, Headroom: &wire.Headroom{Windows: []wire.Window{{Name: "seven_day", UsedPercent: 40, Minutes: 10080, ResetsAt: &reset}}}})
+ hello.Generation = runner.Welcome.Generation
+ if err := runner.Send(r.ctx, "h1", wire.FrameHello, hello); err != nil {
+ t.Fatal(err)
+ }
+ r.wait("both rows", func(c *Conversation) bool {
+ for _, v := range c.Connections {
+ switch v.LocalID {
+ case "claude-9":
+ token = v.ID
+ case "claude-1":
+ login = v.ID
+ }
+ }
+ return token != "" && login != ""
+ })
+ return r, runner, token, login
+}
+
+// rowHTML is one connection's row on the page.
+func rowHTML(t *testing.T, page, id string) string {
+ t.Helper()
+ _, row, ok := strings.Cut(page, `<article equipo-conn-row data-connection="`+id+`"`)
+ if !ok {
+ t.Fatalf("no row %s", id)
+ }
+ row, _, _ = strings.Cut(row, "</article>")
+ return row
+}
+
+// TestPagesTokenRowFacts (Paul, 2026-11-11: "Why does this Claude
+// account not show its email address or its usage?"): a token row the
+// provider named no account for and reported no usage on says so
+// honestly. It offers the account email field (open once, after the
+// sign-in), says usage shows once Claude reports it, and, once turns
+// were answered on it with still no window, that Claude has not
+// reported usage for it. An email the owner types shows as theirs,
+// "(added by you)", and goes nowhere else: not in the API, not to the
+// runner. A teammate, a cross-site post and a bad shape are refused.
+func TestPagesTokenRowFacts(t *testing.T) {
+ r, runner, token, login := tokenRowRig(t)
+ owner := r.inst.Cookie()
+ const page = "/conversation/settings/connections"
+
+ row := rowHTML(t, r.get(owner, page, 200), token)
+ for _, want := range []string{`data-account-email="` + token + `"`, "Add the account email", "Claude account email", `data-usage-note>Usage shows after Claude reports it<`} {
+ if !strings.Contains(row, want) {
+ t.Fatalf("the token row lacks %q: %s", want, row)
+ }
+ }
+ if strings.Contains(row, "(added by you)") || strings.Contains(row, `data-account-email="`+token+`" open`) {
+ t.Fatal("the token row claims an email, or opens the field unasked")
+ }
+ if other := rowHTML(t, r.get(owner, page, 200), login); strings.Contains(other, "data-account-email") || strings.Contains(other, "data-usage-note") || !strings.Contains(other, Owner) {
+ t.Fatalf("the named, metered row changed: %s", other)
+ }
+ // Just signed in: the question is open, once.
+ if row = rowHTML(t, r.get(owner, page+"?added="+token, 200), token); !strings.Contains(row, `data-account-email="`+token+`" open`) {
+ t.Fatal("the question is not asked after the sign-in")
+ }
+
+ // Refused: a teammate, a cross-site post, a bad shape.
+ email := func(c *http.Cookie, id, v string) int {
+ status, _ := r.post(c, "/conversation/connections/"+id+"/email", url.Values{"email": {v}})
+ return status
+ }
+ if status := email(r.memberCookie(), token, "mallory@example.com"); status != http.StatusNotFound {
+ t.Fatalf("a teammate set the email: %d", status)
+ }
+ cross, _ := http.NewRequest("POST", r.inst.URL+"/conversation/connections/"+token+"/email", strings.NewReader(url.Values{"email": {"cross@example.com"}}.Encode()))
+ cross.AddCookie(owner)
+ cross.Header.Set("Content-Type", "application/x-www-form-urlencoded")
+ cross.Header.Set("Origin", "https://elsewhere.example")
+ cross.Header.Set("Sec-Fetch-Site", "cross-site")
+ if res, err := http.DefaultClient.Do(cross); err != nil || res.StatusCode != http.StatusForbidden {
+ t.Fatalf("a cross-site post: %v %v", res.StatusCode, err)
+ } else {
+ res.Body.Close()
+ }
+ for _, bad := range []string{"not an email", "me@example", "me@@example.com", "@example.com", "me@example.com\u202e", "me\x07@example.com", strings.Repeat("a", 243) + "@example.com"} {
+ if status := email(owner, token, bad); status != http.StatusUnprocessableEntity {
+ t.Fatalf("%q: %d", bad, status)
+ }
+ }
+ if status := email(owner, login, "me@example.com"); status != http.StatusConflict {
+ t.Fatalf("an email on a login the provider names: %d", status)
+ }
+ if row = rowHTML(t, r.get(owner, page, 200), token); strings.Contains(row, "(added by you)") {
+ t.Fatal("a refused email was kept")
+ }
+
+ // The owner's: theirs on the row, nowhere else.
+ if status, loc := r.post(owner, "/conversation/connections/"+token+"/email", url.Values{"email": {" me@example.com "}}); status != http.StatusSeeOther || loc != page {
+ t.Fatalf("the owner's email: %d to %q", status, loc)
+ }
+ row = rowHTML(t, r.get(owner, page, 200), token)
+ for _, want := range []string{"<span data-stated-email>me@example.com</span> <span equipo-conn-said>(added by you)</span>", "Change the account email", `value="me@example.com"`} {
+ if !strings.Contains(row, want) {
+ t.Fatalf("the stated email row lacks %q: %s", want, row)
+ }
+ }
+ list, err := r.client.Connections(r.ctx)
+ if err != nil {
+ t.Fatal(err)
+ }
+ for _, c := range list.Items {
+ if c.ID == token && c.Label != "" {
+ t.Fatalf("the stated email became the provider's label: %+v", c)
+ }
+ }
+ var sent int
+ if err := r.inst.DB.Writer().QueryRow("SELECT count(*) FROM runner_commands WHERE body LIKE '%me@example.com%'").Scan(&sent); err != nil || sent != 0 {
+ t.Fatalf("the stated email went to the runner: %d %v", sent, err)
+ }
+ if raw := rawEvents(t, r.rig); strings.Contains(raw, "me@example.com") {
+ t.Fatal("the stated email is in the event stream")
+ }
+ // The next hello keeps it; the provider's own name would win.
+ hello := held(wire.HeldConnection{LocalID: "claude-9", Person: Owner, Provider: "claude", Kind: wire.KindToken, State: wire.ConnHealthy})
+ hello.Generation = runner.Welcome.Generation
+ if err := runner.Send(r.ctx, "h2", wire.FrameHello, hello); err != nil {
+ t.Fatal(err)
+ }
+ r.wait("the login signed out", func(c *Conversation) bool { return c.Connections[login].State == wire.ConnSignedOut })
+ if row = rowHTML(t, r.get(owner, page, 200), token); !strings.Contains(row, "me@example.com</span> <span equipo-conn-said>") {
+ t.Fatal("the next hello dropped the stated email")
+ }
+
+ // Turns answered on it a while ago and still no window: Claude has
+ // not reported usage for it. A recent one, or a check, proves nothing.
+ usage := func(role string, ago time.Duration) {
+ if _, err := r.inst.DB.Writer().Exec("INSERT INTO chat_usage(person, connection, provider, model, role, turn_id, step_id, attempt, outcome, recorded_at) VALUES(?,?,?,?,?,?,?,?,?,?)", Owner, "claude-9", "claude", "claude-opus-5-5", role, "t-"+role+ago.String(), "", 1, wire.OutcomeReplied, time.Now().UTC().Add(-ago)); err != nil {
+ t.Fatal(err)
+ }
+ }
+ usage("check", time.Hour)
+ usage("coordinator", time.Minute)
+ if row = rowHTML(t, r.get(owner, page, 200), token); !strings.Contains(row, "Usage shows after Claude reports it") {
+ t.Fatal("a check or a fresh turn was taken as usage never reported")
+ }
+ usage("coordinator", time.Hour)
+ if row = rowHTML(t, r.get(owner, page, 200), token); !strings.Contains(row, `data-usage-note>Claude has not reported usage for this connection<`) {
+ t.Fatalf("the served row does not say usage is not reported: %s", row)
+ }
+}