Repository navigation
fix(mcp): Send a new sign-in link when the old attempt is gone - #2932
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
10 screenshot changes — 10 changed · 0 added · 0 removed Review screenshots in Frameshift |
…sign-in Fails on main: the resumed Turn reuses the finished sign-in attempt and throws Unknown MCP auth session.
A resumed Turn keeps its pending auth until it delivers. When the provider rejected the new token in that window, Junior reused the finished attempt and failed with Unknown MCP auth session instead of sending a new link. Reuse a link only while its attempt still exists.
Move the scenario to a Slack mention that resumes through the OAuth callback route and worker. Cover a rejected token with an explicit refresh failure and a step-up 403. Give the Eval Auth fake real refresh support so a refresh failure is an injected fault. Co-Authored-By: David Cramer <[email protected]>
sentry-junior
Bot
force-pushed
the
fix/pending-auth-state
branch
from
November 8, 2026 19:19
309a97a to
0d72f45
Compare
The Eval Auth fake now tracks the person's grant and its scope. Tests inject named provider faults (revoked grant, required scope, no refresh tokens) instead of counting requests. Shared helpers read private authorization links and approve a link through the callback route. Co-Authored-By: David Cramer <[email protected]>
dcramer
approved these changes
Nov 8, 2026
23 tasks done
This branch was successfully deployed
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.
After someone finishes an MCP sign-in in Slack, the resumed Turn still holds its old pending-auth entry. The OAuth callback has already deleted that authorization attempt. If the provider then rejects the new token, Junior tries to reuse the old link, because it is less than 10 minutes old. That lookup fails, so the person gets no new link and the tool call fails.
Now a recent link is reused only while its authorization attempt still exists. Otherwise Junior sends a fresh link.
Tests:
tests/integration/slack/mcp-authorization.test.tsruns the Slack path with real wiring. Each test does a mention, sends a private link, approves it through the real OAuth callback route, and resumes the Turn on the queue. The tests assert only what the person sees: two different private links, no answer before the second sign-in, then the answer with no error reply.401 invalid_token, refreshinvalid_grant).403 insufficient_scope), and it issues no refresh token. The new link asks for that scope.On
main, both tests fail: only 1 link is sent, and Junior answers without the tool.Test abstractions:
Injected fault:comments (revokeEvalMcpGrant,requireEvalMcpWriteScope,issueNoEvalMcpRefreshTokens). Tests do not count requests.slackApiOutbox.authorizationLinks(user)reads the private sign-in links, so the card layout is in one place.approveMcpAuthorizationLink()is the person approving a link. It follows the provider redirect into the callback route.The tests pass when shuffled and when run alone. The other tests that use the fake still pass.
Part of #2890 (Pending auth, related to #843).
via @dcramer.
--
View Session [Sentry]