oficina / equipo Public
Connections slice 1 progress: several accounts, Codex, in-app sign-in
Branch thin-v1-conn1 from thin-v1-slice4c (2d1edaf), with design-connections merged (28f8455, eaf2f38, then the accepted rev 3 at 87684fd), the slice 4c fixes (aaf04aa) and staging's line thin-v1-ux1 (f2eac36: inner screens, slice 4c final cfae4f8). Spec: docs/superpowers/specs/2026-11-08-equipo-connections.md rev 3, §8 slice 1 (gates 1a to 1d), with Astra's round-1 and round-2 findings (~/.cache/tmp/equipo/connrev-final.md, connrev2-final.md) and Paul's rulings: Claude on a remote runner finishes signing in on the runner (no paste through Equipo, no token importer); Pi with OpenCode in reserve is a later slice. Conventions as in SLICE1-PROGRESS.md to SLICE4C-PROGRESS.md.
Done
- Contracts (
internal/wire/connections.go,frames.go, fixtures):Connection,ConnectionList,Connect; framesconnect,cancel_connect,disconnect(instance to runner, durable),connectionandusage(runner to instance, durable);hello.connectionsandsync.connectionsreplaceaccounts;Reply.usage,StepReport.usage,AnswerReport.usageare usage rows;Reply.switched,Step.switched,Message.switched,Turn.connection,Snapshot.connections; turn statewaiting(nonterminal;wire.InFlight); reasonsno_connection,limited,connection_removed;ToolResult.replayed;wire.WriteTools. Guard: no connection type, frame or fixture has a secret-shaped field (TestConnectionTypesCarryNoSecrets,...FixturesCarryNoSecrets).
- Gate 1a, usage (
internal/runner/connect/usage.go): one row per attempt and model with outcome (replied | failed | cancelled | superseded),complete, and nullable figures. Claude: the result'smodelUsageper model (reasoning null). Codex:CodexTallytakes the attempt's lasttotalless the total seen before it began (the first total afterthread/resumeis the baseline), drops other threads' notices, so several notices and a resent one count once. The base is verified only for a fresh thread or after this process saw the previous turn's last total; a resumed thread's first turn is counted from its own notices and recordedcomplete: false(the pinned app-server has no read of a thread's token usage). Rows of attempts that did not reply go in ausageframe. The instance keys rows(turn, step, attempt, connection, model)(chat_usage, migration 0049), so a resent frame is a no-op; raw rows kept 90 days.fakecodex(internal/fakecodex) reproduces the pinned app-server: initialize, account/read (refresh, revoked), config/read echoing the-csession flags, device-code sign-in, rate limits with and without windows, thread start and resume with a rollout, turns with deltas, items, several cumulative usage notices and the resume replay, MCP approvals by elicitation,usageLimitExceeded, interrupt.
- Gate 1b, protocol and auth. Connections from the app (
internal/runner/thin/connector.go,connect/login.go): - Codex by device code: the pinned app-server in a new dedicated home asks for a code (account/login/start {chatgptDeviceCode}); the card shows OpenAI's page and code;account/login/completedthenaccount/readandaccount/rateLimits/read; healthy with email, plan and windows. Refused (device login not enabled):provider_refused. The same account twice:already_connected. - Claude at the runner's machine (same_machine): the unmodifiedclaude auth login --claudeaion a pty, with BROWSER set to a recorder in scratch, so the runner learns the loopback authorize URL the CLI would open (checked: Anthropic's host, redirect to localhost); the person's browser on that machine finishes it; nothing is written to the CLI. Verified against the real 2.1.312 binary that BROWSER receives the loopback URL (redirect_uri=http:// localhost:<port>/callback), while the printed URL is the paste flow. - Claude elsewhere: the "Finish signing in on <runner>" card withequipo-runner login claudeand "I am at this machine"; the runner watches the bindings and turns the card healthy when the terminal login finishes. - Cancel: recorded before the attempt saves, so it wins; a cancel that arrives after a success signs that connection out on the runner. - Sign out:DELETE /api/v1/connections/{id}, durabledisconnect, the provider's own logout, binding dropped (setup.RemoveAccountBinding), home deleted,signed_outreported. - Health:Conns(thin/conns.go) keeps state per connection in thin.db: refreshed on first use and hourly with the CLI under the source lock (Claude and Codex: thin v1's Codex refresh debt), limits the providers reported, cool-off 15 min doubling to an hour when no reset is reported. Onlyhealthyconnections are chosen. - Failure kinds: Clauderate_limit_event {rejected}is quota (reset only when reported),api_retry {error: rate_limit}running out is quota without a reset, an assistant errorauthentication_failed,oauth_org_not_allowed,account_on_holdorbilling_erroris auth (signinagain, never limited); CodexusageLimitExceededis quota,unauthorizedauth, anything else transient (no move). - Instance (chat/connections.go): records from hello and sync (only the runner's own person's), attempts, the API (GET/POST /api/v1/connections,GET /connections/{id},POST /connections/{id}/cancel,DELETE /connections/{id}), events, attempts expiring after 15 minutes with no progress.
- Gate 1c, failover and continuity: -
connect.Chooseis the one choice: capable, healthy (or limited with its reset passed), not avoided; the current binding kept while eligible (across a restart too: the connection that answered last); else the most reported headroom, unknown after any figure; reasonsonly_option | headroom | failover. It replacespickReviewerand the coordinator's first-binding choice. - Coordinator (thin/failover.go): a quota or auth failure, then the old attempt's exit proven by the containment, then durably in one transaction: the attempt's usage,turn{waiting, limited | sign_in_again}, the run's attempt advanced andturn{running, n+1}; the new session on the next connection is fresh (notebook, house rule, tail) and told what the turn already did. No eligible connection:turn{waiting, no_connection}, the card, and the turn goes on its own when one returns. A reply from another connection than the last carries the switched line. Returning to a connection starts afresh rather than resuming a session that missed turns. - Exactly-once writes, the turn's mutation ledger (rev 3, §3 step 4): the instance records each designated mutation (wire.MutationKinds: addproject, createproject, setprojecthome, recordtask, starttask, canceltask, addfinding, askperson) by kind and target when it completes, and holds a later attempt of the turn to it whatever the wording: one question card, the n-th recordtask is the n-th task the turn recorded, start and cancel once per task, a project once per name, the home once per person, a finding once per task and normalised text; the stored result answers,replayed: true. Reads (status, readtask, find, ...) and writenote always run fresh. On the runner, every write is recorded before and after it runs (thin/effects.go): an exact repeat is answered from the record, an unseen answer is reconciled under its earlier call id, and the record gives the new attempt its summary of what was done. - Engineering and Review: a quota or auth failure, termination proof, then the attempt runs again on another connection from a fresh tree (Engineering) or the same tree (Review); the step shows "Engineering, attempt 1: done (Claude was limited)". No eligible connection: the step waits deferred in the queue and goes on when one returns. - Ask stays pinned to the step's own kept session and connection; a limited or signed-out connection fails itaccount_unavailable. - Codex coordinator (thin/codex.go): the pinned 0.165.0 app-server in the converse containment (bubblewrap, egress relay to the provider, credential home denied to tools, runtime copy), validated as the certified launcher does (codex.ValidateThinPolicy, initialize at /home/runner, account, config/read against the policy, thread policy), tools through the MCP proxy after an elicitation approval correlated with the started tool call (anything else refused), rollout kept for resume.codex.PolicyInputsnow rendersconverse(the coordinator surface: no shell, no patch, no search, MCP limited to the conversation's own tools) andanswer(read-only git tools);inspectalready passed; the deny profile is unchanged (TestThinActionPolicies).
- Gate 1d, UI: the Connections page under the conversation (header plug icon, and linked from Settings): each connection with its state in words ("Limited until Tue 10:00 UTC", "Limited, no reset time reported", "Needs signing in again", "Signed out"), Add Codex, Add Claude, the device-code card, the sign-in link, the finish-on-runner card, Cancel; scriptless (the page reloads every 3 s while connecting). The chat: the switched line under a reply, the no_connection card with Add a connection, no "Send your message again". Reset times are shown in UTC until a person's zone is known.
- Merged
thin-v1-ux1(f2eac36): step activity beside the switched line and usage on steps; migration 0049 after ux1's 0048; fixtures regenerated; ux1's tests moved from accounts to connections.
Tests
- Unit:
connect(choice table, cool-off, Claude and Codex limits, failure classes, usage over the recorded probe and the resume case, Claude rows);codexthin policies; wire guards. - Contract (
internal/thintest/connections_contract_test.go): hello and attempts, duplicates, late frames, cancel, sign-out, the held turn and the switch, usage rows; writes replayed across attempts. - Contract
TestContractWritesReplayAcrossAttempts: a reworded recordtask, a paraphrased question, a reworded start and the same addproject in attempt 2 are folded (one task, one card, one step); status after addproject is fresh; a further recordtask records. - Headless (
TestHeadlessConnections, fake CLIs in real bubblewrap): U1/U2 usage rows (replied, failed before a failover, cancelled); C1 Claude to Claude failover; C2 Codex coordinator with tools, a task, usage and a cold resume; C3 device code (also refused, already connected) then failover to Codex; C4 Claude at the machine (loopback callback) and by the terminal card; A5 cancel and sign-out; A6/A7 no reset and auth; F2 a limit straight after five writes, the new attempt rewording each (three folded by the instance's ledger, two exact repeats answered by the runner's record) and F2b its status fresh; C5 Engineering and Review moving connection; C6/F5/F7 waiting, cancel while waiting, answered once Codex is added. - Browser (
-tags browser): A1, A4, F1, F7. - Mutations, each observed failing a test: a secret-shaped field on a connection frame (guard); both write guards removed (F2: two question cards); the runner ledger removed (F2: recordtask reached the instance twice); the instance replay removed (contract: a second task); the stickiness rule removed (choice table); the Codex baseline removed (tally: the resumed turn counted the old total); failover without a proven exit (C1: failed
limited); the switched line dropped on settle (browser F1, a real bug the test found); `enabledtools` back to the old coordinator tools (thin policy test).
Decisions
- In-app sign-in runs the provider's CLI unconfined in the new home, as
equipo-runner loginand the account refresh already do (not in the converse namespace the spec sketches); egress for the login is the CLI's own. - The coordinator and steps hold a turn or step on the runner rather than ending it; "messages sent while it waits join the waiting turn" is not built: a later message queues as its own turn behind it.
- The ledger's per-kind rules hold a later attempt to what earlier attempts made; within one attempt only an exact repeat replays. Rev 3 says "any later call in the same turn": applied within one attempt it folded a second task the person asked for in the same message into the first (the review contract tests record two tasks in one turn), so the rules are applied across attempts only. Controller to confirm.
- Stickiness: the coordinator leaves its connection only on failure. The rev 3 exception (return to a recovered preferred connection at a natural boundary, the start of a new turn after the session's turn ended with nothing queued, never mid-turn) has nothing to return to in slice 1: preferences are slice 3. A reply from another connection than the last always carries the switched line.
- The runner's own durable ledger gives the new attempt its summary of done effects; there is no
tool_calls{turn}request to the instance. - Stickiness survives a restart through the last connection that answered; returning to a connection starts a fresh session (the spec says resume with a fresh notebook injection: fresh is simpler and the notebook and tail carry the context).
- Staging: in-app connections live in the staging root's own
accounts/and survive a restage (scripts/staging-thin.py); the suite person runs on the owner's in-app Codex account the way it runs on claude-a.
Staging
Restaged b555d46 (CI green; built by scripts/staging-thin.py build, deployed with --swap hold at 12:53:48, serving b555d46, both runner units installed by 12:54:44; about a minute of skew, in which the old runners' streams were refused the new frames). ux1's iOS fixes (06c0217) are merged on the branch after it, not deployed.
Live, the suite person, one message ("Reply with one short sentence: which model family are you?") on claude-a (paul@tito.io), whose weekly limit Paul hit today: the unmodified CLI refused with a rejected ratelimitevent, reset 2026-11-10T21:00Z, window sevenday, no utilization reported; the runner proved the attempt's exit, marked claude-a limited until then, advanced the turn to attempt 2 and, with no other connection, held it waiting noconnection (6.6 s after the send). The chat page showed "Nothing can answer right now. Claude resets Tue 21:00 UTC." with Add a connection, and no "Send your message again". Cancelled while waiting: cancelled at attempt 2.
Next, needing Paul:
- Paul enables device code login for Codex in ChatGPT's security settings, opens the staging Connections page, taps Add Codex, and enters the code at OpenAI's page.
scripts/staging-thin.py runneragain so the suite runner gets the owner's in-app Codex binding.EQUIPO_STAGING_CONN_WITNESS(messages separated by---) withscripts/staging-thin.py suite conn1_witness: with claude-a still limited the first turn meets the real limit and moves to Codex.
Live runs (budget: 6 coordinator turns, paul@tito.io homes only)
Used: 1 coordinator turn (refused by the provider on quota before any model output; the waiting turn was cancelled).
Open issues
- Version skew at deploy, as before: an old runner refuses the new frames; install runners right after the instance.
- Preferences (spec F8, "switch back to the preferred connection") are slice 3; without them stickiness keeps the session where it moved.
- A step waiting for a connection shows as queued, without the no_connection reason on the task yet.
- The ask card does not yet show the reset time of its limited connection.
- Reset times render in UTC.
- Codex
account/updatedto signed out is not read as an auth failure during a turn (the hourly refresh catches it). - A connection not yet checked is reported "healthy" in hello until its first check (20 s after start, or on first use); a weekly limit shows only once a turn meets it (the CLI's refresh does not report quota).
- CI flake seen once:
TestContractNoRetroactiveMerge(4c) got a 401 on an Answer; a rerun of the same commit was green.
Round: Astra round 2 (on fa3860a), the final round (2026-11-08)
Eight of nine resolved; the three open items, each with a test that fails first and a mutation shown to fail it:
- Durable sign-out: the cleanup record keeps the home and provider from before the binding goes until the home is deleted; logout is tried twice; signed_out is reported only once the home is gone; a replay after a stop between the binding and the home deletes the home (TestConnectorSignOutFinishesTheHomeAfterACrash, TestConnectorNeverReportsSignedOutWhileTheHomeExists). A late cancel now owes its cleanup before it runs.
- record_task never maps by order: a later attempt's call is the earlier task in the same project whose title or brief reads like it; like none, it is new and made; like several, it is refused (code ambiguous) with the earlier tasks listed, so the model names one or says separate (TestContractRecordTaskNeverByOrder). separate: true skips matching.
- Review filters by family first: another family's healthy connection is chosen before preference or headroom; the engineer's family, then its own account, only when none can (C5reviewotherfamilyfirst).
Round: Astra round 1 (on 7946111), the Connections page (2026-11-08)
Astra's nine findings, each with a test that fails first or a mutation shown to fail it:
- Ledger within an attempt: one question card per turn, the home and a finding once per target, in any attempt; start, cancel and project against earlier attempts (the tools refuse a second within one). record_task within an attempt keeps its similar-task answer; across attempts a call maps to the task it reads like (same arguments, then title or brief, then order). Tests: TestContractWritesOncePerTurn WithinAnAttempt, TestContractRecordTaskMapsBackAcrossAttempts.
- One ledger: the runner no longer answers exact repeats; every write goes to the instance. F2 now counts five folded writes.
- Late cancel: the attempt lets go of the home lock before signing out (TestConnectorLateCancelLetsGoOfTheLock, lock probe).
- Sign-out and a cancel that finds the connection saved are recorded in the frame's transaction (connect_cleanups) and done at startup; an attempt saved then cancelled is owed at startup; a done cleanup marks the attempt removed so a reused local id is never signed out (TestConnectorSignOutSurvivesACrash, TestConnectorCancelSurvivesACrash).
- Codex runs Engineering and Review (codexstep.go, by a delegated agent, merged): C5engineeringtocodex, C5reviewoncodex.
- A refused step attempt advances durably (advanceStep: usage for the refused attempt, the instance takes attempt n+1); cancels and sync follow the step to its later attempt.
- With nothing left the step waits (deferred) and resumes; Review fails over on a refused credential and marks it signinagain (C5engineeringwaits, C5reviewauth).
- Codex usage: never subtract an unverified base; a resumed thread sums the turn's last figures, complete: false; complete only with a verified base and the turn's completion seen; resent notices dropped.
- Cancelled and timed-out Codex turns keep their usage; answers carry theirs (recorded for failed and cancelled answers too).
Preference (the mockup's Prefer control): one per person, by provider (Automatic, Claude, Codex), PUT/GET /api/v1/connections/preference (/api/v1/preferences is the person's notes), a durable preference frame to the runner, resent on hello; the choice moves the coordinator to it at a turn's start, never over health (P1preference). Per-role rows wait for routing (slice 3). Kept in chatsettings: no migration (UX1 took 0050 and 0051).
The page to Paul's approved mockup: what is answering with Prefer, rows (monogram, state in words with a dot, headroom only when reported, roles with the live mark, tokens today, quiet actions on hover or behind ⋯), Add a connection with its chooser (Claude and Codex; local models, Mistral and TensorX greyed), the loading card, the three-step cards with Copy, the success card and the row sliding in, Forget for a signed-out record. Paul's row feedback: a row that needs the person gets one secondary button (Sign in again, Connect again) at the end of the action column, the usage under it, a tint and a hairline, full width under the state line at 390. Stardust is shared (stardust.js, the calm look from UX1); chat-stream.js reads it from there. "Healthy" reads "Ready". Browser test: chooser, card at once, code once, Copy, approval with the success card and no reload, Prefer, the Claude card, sign out and the recovery button's place, at 390 and 1280; screenshots in docs/mockups/built/2026-11-08/conn-*.png.
Round: waiting turns, live Connections page (2026-11-08)
- Waiting turns: a turn waiting with noconnection, and every turn queued behind it, render no thinking line, sparkle or timer, live or after a reload; each person's message gets a quiet "Waiting for a connection" under it and one noconnection card stands after the last of them. The thinking line comes back only when an attempt starts.
- Messages sent while waiting queue behind the waiting turn (no joining): they keep their own turn, reply and receipt, and run in order once a connection is usable. Chosen because joining would merge two person turns into one reply and break exactly-once per turn.
- Waiting turns start on their own when a connection is added or a limit resets; Recover no longer restarts a run whose last report was waiting no_connection at the same attempt (test
TestRecoverKeepsWaitingTurns, mutation shown). - No page refreshes: the meta refresh and every location.reload are gone from the chat and Connections pages; both re-read the page in place from their event stream. Without scripts, an open attempt shows a "Check again" link only.
- Connections page: Add shows a loading card at once (rotating phrases, still under reduced motion), then the three-step card. Codex: Open OpenAI (new tab), the code once with Copy, approve then come back, a living "Waiting for you to approve…" line, the device sign-in small print, Cancel. Claude terminal: open a terminal on the runner, the command with Copy, sign in in the browser it opens. Approval lands in place with a short flourish and "Codex connected". Rows: provider mark, account, state with a dot, usage today, Sign out under ⋯ (visual layout waits for Fable's mockup).
- Logging: "kept sessions" logs only on change, or hourly.
- Browser tests:
TestBrowserWaitingTurns(1280 and 390, after a reload: zero thinking lines, one card, both turns answer in order once Codex is added; mutation shown),TestBrowserConnectionsAdd(390 and 1280: card at once, code once, Copy shows "Copied", approval with no reload or navigation; mutation shown; Claude terminal card). Screenshots indocs/mockups/built/2026-11-08/conn-*.png(EQUIPOCONNSHOTS=1). - Fixed on the way: the Claude terminal card returned a 500 (template read a field the line did not carry).
Copy for review
Accepted for now with the existing marker in copy.go:
chat.connections.title"Connections",.empty"Nothing is connected yet.",.add_codex"Add Codex",.add_claude"Add Claude",.same_machine"I am at this machine",.cancel"Cancel",.healthy"Healthy",.limited"Limited, no reset time reported",.limited_until"Limited until %s",.signed_out"Signed out",.sign_in_again"Needs signing in again",.error"Not working",.offline"Your runner is offline. Start it to add a connection."- Connect cards:
.title_codex"Connect Codex",.title_claude"Connect Claude",.open_openai"Open OpenAI",.enter_code"Enter this code:",.approve_back"Approve, then come back. Equipo connects on its own.",.waiting_approve"Waiting for you to approve…",.device_off"OpenAI says device sign-in is off? Turn it on in ChatGPT, Settings, Security.",.copy"Copy",.copied"Copied",.open_terminal"Open a terminal on %s.",.run"Run:",.browser_back"Sign in in the browser it opens, then come back.",.waiting_sign_in"Waiting for you to sign in…",.open_claude"Open Claude",.claude_back"Sign in, then come back. Equipo connects on its own.",.connected"%s connected",.check_again"Check again" - Loading phrases:
.loading_codex_1"Knocking on OpenAI's door…",_2"Asking for a pairing code…",_3"Warming up a fresh desk for Codex…";.loading_claude_1"Finding your runner…",_2"Warming up a fresh desk for Claude…",_3"Starting Claude's own sign-in…" - The page to the approved mockup:
.lede,.your_runner,.answering.*(on, while, rests, restsuntil, too, back, connecting, none, noreset, needssignin, kept, see),.and,.prefer,.prefer_auto,.prefer_hint_auto,.prefer_hint,.preferred,.make_preferred,.group,.usage_resets,.serving,.roles.*(none, restingmoved, restingnone, signinfirst),.tokens_before,.sign_in_again_action,.connect_again,.forget,.window_hours,.window_week,.window_used,.resets,.add,.add_hint,.chooser_lede,.claude_desc,.codex_desc,.soon,.local,.local_desc,.mistral,.mistral_desc,.tensorx,.tensorx_desc,.loading_sub,.codex_sub,.claude_sub,.code_once,.codex_fine,.claude_fine,.same_machine_hint,.waiting_runner,.connected_big,.connected_next,.empty_title,.empty_body,.empty_fine;.healthynow "Ready". All words as in the mockup Paul approved. - Rows:
.usage_today"%s tokens today",.sign_out"Sign out",.more"More"; conversation:chat.waiting_connection"Waiting for a connection" - Removed:
.device"Go to %s and enter %s",.sign_in_claude,.finish_on,.finish_how..connecting"Connecting %s" stays in copy but is no longer shown. chat.connections.reason.timed_out"The sign-in was not finished in time.",.cancelled"Cancelled.",.provider_refused"The provider did not complete the sign-in.",.runner_offline"Your runner went offline during the sign-in.",.identity_mismatch"The sign-in did not match an account.",.already_connected"That account is already connected."chat.switched"Switched to %s",chat.switched_reset"Switched to %s; %s resets %s",chat.no_connection"Nothing can answer right now. %s",.resets"%s resets %s",.limited"%s is limited",.signed_out"%s is signed out",.none"Nothing is connected.",.add"Add a connection"work.reason.limited"its model account reached its limit",work.reason.no_connection"nothing connected can run it",work.switched"%s was limited"- Changed:
chat.failed"The coordinator could not answer this message." (was "... Send your message again to retry.")
Blockers
None.