Skip to content

connectors: a lent token that ran out marks needs-sign-in, and a finished sign-in stamps its time - #476

Merged
SiddDevZ merged 1 commit into
DuskBotAI:devfrom
colorlesspilgrimage:diag/connector-issues
Dec 3, 2026
Merged

SiddDevZ merged 1 commit into
DuskBotAI:devfrom
colorlesspilgrimage:diag/connector-issues

Conversation

@colorlesspilgrimage

Copy link
Copy Markdown
Contributor

Opened by Felix, an AI agent (a Claude-based software engineering bot), on behalf of @colorlesspilgrimage. Base: dev.

Closes #475

What changed

  • server/mcp-oauth.ts: in refresh(), a lent token that ran out now calls markNeedsSignIn instead of returning null silently. The holder's next token replaces the entry through borrow(), which already accepts that state.
  • server/index.ts: the onSettled callback of McpOAuthManager now calls connectorSyncRef?.signedIn(url) for a remote server when its sign-in succeeds, so the sign-in time sync compares is the real one rather than the first time a listing saw it.
  • Tests: server/mcp-oauth.test.ts (a lent token that ran out marks needs-sign-in and takes the holder's next token; failed before the patch) and server/connector-sync.test.ts (new; signedIn() restamps a holder's signedInAt).

Why

Connectors failed after reconnecting on desktop and going back to mobile, with bots reporting only "access unavailable". See #475 for the full analysis, the held step and other candidate causes.

Checked

  • 86 tests pass across the oauth, store, sync and sync end-to-end suites.
  • tsc --noEmit is clean (it needed a larger Node heap).
  • Both size ratchet tests and oxlint --deny-warnings on the changed files pass.

Not checked / uncertain

  • Not reproduced against real accounts, so this is not confirmed to fix the reported failure.
  • The server/index.ts wiring has no direct test, only the typecheck. The new test shows signedIn() works and was already passing before the wiring.
  • The Electron test suite was not run. electron/connector-sync.mjs is unchanged. This needs a server build on each place: the cloud for the bots' failures, and a desktop release for the local place.
  • Behaviour change: bots may now see needs-sign-in and ask for a reconnect where an open desktop would have re-lent a token on its own.

Held

The step where a newer sign-in replaces an older holder's is not in this PR. It reverses the choice asserted at electron/connector-sync.node-test.mjs:112-116 and depends on trustworthy sign-in times, which this PR starts to provide.

🤖 Generated with Claude Code

…in, and a finished sign-in stamps its time for connector sync

A place borrowing a connector's token never refreshes it. When that token ran out, refresh() returned null and left the entry as is, so every caller on the place only heard that access was unavailable, with nothing to tell the person or a bot to reconnect. It now marks the connector needs-sign-in, which borrow() already lets the holder's next token replace.

Connector sync decides which sign-in is newer from times.signedIn, but nothing called sync.signedIn() when a sign-in completed, so the time was only the first moment a listing saw the sign-in. The sign-in completion callback now stamps it.

Tests: a lent token that ran out marks needs-sign-in and takes the holder's next token (failed before, passes now); signedIn() restamps a holder's signedInAt.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@SiddDevZ
SiddDevZ merged commit eacccb0 into DuskBotAI:dev Dec 3, 2026
17 of 21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants