Expand description
Google connect, connect_status and cancel: an agent connects a Google account itself
(docs/specs/SPEC_GOOGLE_PHASE_B_AGENTMUXS_OWN_CLIENT_2026_11_01.md §7, §9, D3). It runs the
same flow as the Accounts panel’s Connect (oauth_client::start), so the two can’t drift,
except that the consent page is not opened in the system browser: the agent opens it in a
Browser pane it drives (the account picker, the unverified-app screen, the scope boxes), and
stops for the person only at a password, a second factor or an administrator’s block.
POST /api/v1/google/connect: start the flow; answers the consent URL and the origins its pane may stay on.POST /api/v1/google/connect/status: where the flow is (waiting for the person, connected, failed); it may wait a few seconds for a change.POST /api/v1/google/connect/cancel: end a flow that waits.
The token never reaches the agent: it goes from Google to the keychain inside srv. A session belongs to the agent that started it. Every connect is recorded under that agent, in the account’s log once the account exists.
Structs§
- Connect
Body 🔒 - Session
Body 🔒 - Start
Slot 🔒 - An agent’s place for one connect, held while it starts; the session in
ownerstakes over after.
Constants§
- GOOGLE_
ORIGINS 🔒 - The sites a consent pane stays on, beside the page’s own loopback callback.
- MAX_
STATUS_ 🔒WAIT_ SECS - The most
connect_statuswaits for a change in one call. - POLL_
EVERY 🔒 - How often a waiting call looks at the session again.
- RECORD_
POLL_ 🔒EVERY - How often the task that records a connect looks at its flow.
- URL_
WAIT 🔒 - How long
connectwaits for the flow to produce its consent URL.
Functions§
- connected_
services 🔒 - What each service of the new account can be used for, as
Google statusshows it. - handle_
google_ 🔒connect POST /api/v1/google/connect.- handle_
google_ 🔒connect_ cancel POST /api/v1/google/connect/cancel.- handle_
google_ 🔒connect_ status POST /api/v1/google/connect/status.- owners 🔒
- The agent that started each flow, by session id: only it may ask after it or cancel it.
- owns 🔒
- pane_
origins 🔒 - The origins a consent pane may stay on: Google’s, and the loopback address Google redirects
to when the person has consented (read from the URL’s
redirect_uri). - parse_
services 🔒 - record_
connect 🔒 - Records the connect under the agent that did it, in the account’s log the person reads.
- record_
when_ 🔒connected - Records the connect under the agent that started it once its account is committed, whether or not the agent asks again; the task ends with the flow (success, failure, cancel or timeout).
- start_
connect 🔒 - starting 🔒
- The agents whose connect is starting (the keychain read and the flow’s first answer are awaits), so two overlapping requests from one agent can’t both pass the one-waiting-connect check.
- status_
answer 🔒 - union_
scopes 🔒 - The scopes a connect asks for: the services named at
level, plus every scope the account already holds (D3: always the union, whether or not Google carries earlier grants over on an installed app). - url_
ready 🔒 - Whether a flow has its consent URL (or has ended): not the pending status, and not the empty
URL
startanswers before the flow’s task has built the real one. - wait_
for 🔒 - The session’s status once
doneholds for it, or the last one seen afterwait. - waiting_
session_ 🔒of - Whether this agent already has a connect that hasn’t ended.