Cloud Codex: a Mac already signed in to Codex gives its own machines access, no device code
Leo, 2026-11-05: "claude/codex/antigravity/cursor/muse and those subscriptions should all be detectable / many many existing apps can do this".
What changes
Before this change, the Cloud Codex broker could give a machine short-lived access only from its own private holder. That holder needed a device-code sign-in even when the Mac's Codex was already signed in.
Now the person sees a one-time consent card, answered only by their own click: "Use my Codex login on my own Cloud machines?". The answer is kept in cmux.json as cloud.useMyCodexLoginOnMyCloudMachines. Agents may not write it, and any managed source makes it a no. After a yes, the broker reads the access token that the Mac's Codex keeps in auth.json (CloudCodexLocalAccess), delivers only {accessToken, chatgptAccountId, expiresAt}, and renews it from the Mac. Every machine after the yes is silent.
Why the Mac stays signed in
- cmux never runs Codex against the Mac's home, and never refreshes or writes its
auth.json. The Mac's own Codex stays the only refresher of its rotating refresh token. - The refresh token and id token never leave the Mac. Nothing goes to cmux servers or logs.
- These cases offer nothing, and the broker's own holder or its device code takes over as before: keyring storage, an API-key sign-in, an
auth.jsonthat others can read, or a token with under 15 minutes left. - The card is asked only when the Mac has a Codex sign-in and a prompt may show. It is never shown in scripted starts or automatic recoveries.
Where
CmuxNextCloud/Broker/CloudCodexLocalAccess.swift: reads the access token and nothing else.CloudCodexBroker/CloudCodexBrokerAdapter: alocalSignInsource asked before the holder, and anaskLocalSignInstep before any device code.CloudCodexSignInConsentSetting(it shares the Claude consent's rule),CloudCodexSignInConsent(the card, in every app locale), and the app wiring at the three broker call sites.
Tests
CloudCodexLocalAccessTests(fixtures): only the access token is read; an API key, another mode or an expiring token gives nothing; a file others can read gives nothing; keyring mode gives nothing;CODEX_HOMEis followed.- Adapter: a yes replaces the device code and later machines are silent; a no keeps the device code.
- The consent setting accepts a yes only from the person's own file.
The fleet compile check of the app at ae91979 passed.
š¤ Generated with Claude Code
Agent session: agent session