claude agent, operated by paul@keymail.devoperated by paul@keymail.devsession 21a32889 · claude-code/2.1.291 · MacBookPro.localdomain
The bug
homeLinkLabel offered Connect your Oficina account to every session that did not come from a Home assertion. Paul signed in with the Docs email link as paul@tito.io, to an account already linked to an Oficina identity, and still saw it.
The fix
The item is offered only when the signed-in local person has no stored link in docs_identity_links. Once linked, it never appears, however the session signed in, and that includes the same session straight after confirming.
Lookup cost: a team instance already resolves HomeSubject with the identity, so it adds nothing. Standalone Docs adds one query per menu render, SELECT 1 … WHERE issuer=? AND person_id=?, on the UNIQUE (issuer, person_id) index (linkstore.Linked). The person comes from the identity already in the request context. A lookup error offers nothing.
Paul's follow-ups (2026-10-24), all on this branch
An unknown Oficina assertion no longer dead-ends. It leaves the existing sealed, ten-minute navigation marker, now with a second action, link-resume. The marker carries no identity. - After a fresh local sign-in,/auth/local/complete begins the link exactly as the Connect button does (startLink). The browser goes through Home's max_age=300 freshness check and lands on the confirm step. - The rules are unchanged: fresh local auth, the nonce bound to this session, a fresh Home assertion, and the explicit same-origin confirm POST before anything is stored. - Fallbacks: an expired marker is ignored, so the person lands as before and the menu item is still offered. A brand-new address with no Docs person yet lands on the Connect page. - Copy: "Sign in to your Docs account once to connect it to your Oficina account."
Buttons: Connect and Back to Docs share rastrillo's rst-form-foot row, the door's, primary first.
The two steps look alike. I kept the confirm click and changed the confirm step's copy instead: - Why keep the click: without it, a remembered unknown assertion plus a local sign-in would link the two accounts with no deliberate gesture. - Why not name both accounts: the Oficina assertion carries only an opaque subject, so the Oficina address cannot be named. Only the Docs address can. - New confirm copy: the title is "Connect these two accounts?" and the body is "Your Oficina account is confirmed. Connect it to the Docs account below, and you can sign in to Docs with Oficina from now on."
Success: the confirm POST now goes to GET /account/home/confirm?connected=1&return_to=…, which shows Accounts connected. - It is shown only when the link is stored, so a crafted URL proves nothing. - Its button leads back to the page the link began from, revalidated with SafePath.
Was the link stored? Yes. Both the existing round-trip test and the new tests count docs_identity_links: 0 before the confirm, 1 after. What Paul saw was the menu bug.
Tests (home_connect_linked_test.go), each seen red with its fix reverted
Menu: shown when local and unlinked; gone in the same session after confirming; gone for a linked local sign-in and for a Home sign-in. Red with the old method check.
Unknown flow: unknown, then local sign-in, freshness check, confirm, link stored. Red without the remembered marker.
Expiry: a remembered marker at the 10-minute boundary is ignored while the menu marker still works. Red with the expiry check deleted. The session is kept fresh at the later time, so only the marker can decide.
Success page:red when the confirm returns to the page directly.
Button row:red without rst-form-foot.
Updated: existing tests that expected the confirm to return straight to the page, and the round trip, which now resumes after the unknown arrival.
Local gate
Go steps pass: vet, the browser-tag vet, go test ./..., gofmt and build, with go1.26.5.
wasm and Rust steps not run here:build-wasm.sh needs Docker on macOS and the daemon isn't running. This branch touches no Rust or wasm. Hub CI runs the whole gate.
Siblings
The same fix is on fix/connect-item-when-linked in home/connect, estilo (homeconnect row), slides, sheets, calendar, memoria and meet.
Not merged, not deployed.
claude agent, operated by paul@keymail.devoperated by paul@keymail.devsession 21a32889 · claude-code/2.1.291 · MacBookPro.localdomain
Docs main has not moved since this branch was cut (5a4f6de), and Docs vendors none of the changed estilo/home code, so no re-pin is needed. Head stays 168d679.
On "name both accounts" (item 4): the Oficina half cannot be named, by design. The assertion's subject is an opaque person ref, and Home's one rule is that it never stores a readable address, so no Oficina address exists anywhere to show. The confirm step names the local account and gets its own question for a title. The explicit click stays, because the resumed flow would otherwise link accounts with no deliberate gesture.
claude agent, operated by paul@keymail.devoperated by paul@keymail.devsession 21a32889 · codex · MacBookPro.localdomain
VERDICT: APPROVE Branch verdict: ready to merge
GPT-6-Astra (Codex), reviewing for session 21a32889. Reviewed the whole branch at 168d679811d623a12ff58e7a7ced85456c525ca1 against fetched origin/main, including Docs' own connect implementation.
No blocking P0/P1/P2 findings. Security review: I found no P0/P1 issue or demonstrated login-CSRF/account-link substitution in the changed flow. The sealed, ten-minute marker carries no identity; the resumed link still uses the actual fresh local session, a fresh nonce-bound Home assertion, and an explicit CSRF-protected confirmation POST. Success is checked against stored linkage. This is a code-review verdict, not a waiver of the required merge gate.
Docs preserves its team/principal resolution and admission rules. Its marker, freshness checks, explicit confirmation and stored-link success handling agree with the shared implementation. The menu lookup uses the existing issuer/person index; a resolved team Home subject avoids the extra lookup. The confirm screen names the local account without inventing an Oficina address.
Validation: GOTOOLCHAIN=go1.26.5 TMPDIR=/tmp .amadan/ci.d/10-gate passed completely, including Docker-backed WASM, Rust, wire compatibility, frontend checks and Go. A scratch Go-overlay router probe starting without a local person also passed: unknown Oficina identity -> verified local sign-in -> fallback /account/home -> HTTP 200 with a working Connect page. New accounts therefore take an additional Connect click; they do not dead-end. The exact-head hub CI is green.
Note: origin/main advanced with the app-switcher change; the reviewed triple-dot diff does not revert it. Land the estilo dependency and refresh its pin after squash as needed.