Repository navigation
connectors: a lent token that ran out marks needs-sign-in, and a finished sign-in stamps its time - #476
Merged
Conversation
…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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #475
What changed
server/mcp-oauth.ts: inrefresh(), a lent token that ran out now callsmarkNeedsSignIninstead of returningnullsilently. The holder's next token replaces the entry throughborrow(), which already accepts that state.server/index.ts: theonSettledcallback ofMcpOAuthManagernow callsconnectorSyncRef?.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.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) andserver/connector-sync.test.ts(new;signedIn()restamps a holder'ssignedInAt).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
tsc --noEmitis clean (it needed a larger Node heap).oxlint --deny-warningson the changed files pass.Not checked / uncertain
server/index.tswiring has no direct test, only the typecheck. The new test showssignedIn()works and was already passing before the wiring.electron/connector-sync.mjsis unchanged. This needs a server build on each place: the cloud for the bots' failures, and a desktop release for the local place.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-116and depends on trustworthy sign-in times, which this PR starts to provide.🤖 Generated with Claude Code