Repository navigation
Description
Posted by Felix, an AI agent (a Claude-based software engineering bot), on behalf of @colorlesspilgrimage.
Report
After reconnecting a connector on the desktop app and then going back to mobile, all connectors stopped working. Bots reported routine failures, and the only error they could give was that access was unavailable, with no exact error code. This did not happen before desktop was in use.
What we found (code reading only, not reproduced against a real account)
Connector sync runs in the desktop main process (electron/connector-sync.mjs) and only while the desktop app is open. Each place (this computer, My Cloud, servers) is a holder (keeps the refresh token), lent (borrows the holder's short-lived access token and never refreshes it), needs-sign-in or none.
- A borrowed token that ran out failed silently. In
McpOAuthManager.refresh(), an expired lent token returnednullwithout marking the connectorneeds-sign-in. Every caller on that place only heard "no access", which matches the bare "access unavailable" the bots reported. With the desktop closed (mobile), nothing tops the token up, so it runs out and stays in that state. - A finished sign-in is never stamped with its time. Sync decides which sign-in is newer from
times.signedIn[url], set bysync.signedIn(url). Nothing called it, so the time was only the first moment a listing saw the sign-in (signedInAt()uses??= now()). Any "newer sign-in wins" logic would run on unreliable times. This is a prerequisite gap, not shown to cause the failure on its own. - Two places that each hold their own sign-in are left alone.
electron/connector-sync.node-test.mjs:112-116asserts that nothing moves, so after a reconnect on desktop the cloud can keep an older sign-in that no longer works. This is tested and intentional, so changing it is a design decision (see "Held").
Items 1 and 3 together fit the symptom: after a desktop reconnect the cloud can hold a stale own sign-in or a borrowed token; once the desktop closes, it expires silently for every cloud bot.
Fix (PR to follow, base dev)
- A lent token that ran out now marks the connector
needs-sign-in.borrow()already accepts the holder's next token in that state, so sync can re-lend. - A finished sign-in now stamps its time through the sign-in completion callback.
Held, not in the PR
"A newer sign-in replaces an older holder's." This reverses the tested design choice in item 3 and needs the times from item 2 to be trustworthy first. Left for a maintainer decision.
Other things that could cause this (unchecked)
- The cloud's own copy was never a refresh-token holder, so after the desktop closes nothing can renew it (the core of item 1). The durable fix may be moving a refresh token to the cloud, not only surfacing the state.
- A provider that rotates refresh tokens could invalidate the old one when the desktop reconnects, leaving the cloud's copy dead rather than just stale.
- Short access-token lifetimes against the 10 minute top-up (
TOPUP_MS) and the 15 minute minimum a holder lends (LEND_MIN_MS). - Sync only running while the desktop app is open: a closed or sleeping desktop leaves everything on its last token.
- Servers reached by URL, including Composio Connect, may hold their own server-side session independent of the lent token.
- The bot-facing error is flattened to "access unavailable". Even with
needs-sign-in, the reason is not carried to the bot.
How to confirm
Run the same sequence on a build with and without the fix: reconnect on desktop, switch to mobile with the desktop closed, wait past the token lifetime, then check the connectors. A read-only per-place state dump (role, token time left, sign-in age, with tokens never printed) distinguishes an expired borrowed token from two competing holders.
Risk
Bots may now ask for a reconnect card where an open desktop would have re-lent a token on its own.
Activity
SiddDevZ commentedon Dec 3, 2026
Thanks to #476, merged into dev: a lent token that ran out now marks the connector as needing sign-in (so the holder's next token replaces it), and a finished sign-in stamps its real time. That was not reproduced against real accounts, so I'm leaving this open until someone confirms it on a build that includes it.