fix: preserve MCP account authorization denials - #359
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Live OAuth evidence for the follow-up QA: on 2026-09-10 at 03:44:54Z, |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
@greptile review |
Summary
Why
The MCP gateway currently collapses both resolver 401 and 403 responses into an OAuth invalid-token response. Account rollout or access denials therefore make clients discard valid WorkOS grants and repeat authorization. Only resolver 401 means the credential is invalid; resolver 403 is an authenticated account authorization denial.
This change improves protocol correctness and makes the present AskT49/Eve rejection diagnosable. It does not grant account access or turn a genuinely invalid credential into a valid one.
Verification
@terminal49/mcp: 15 files, 214 tests passedThe preview deployment is healthy, but it intentionally does not contain the production OAuth resolver secret; therefore full end-to-end OAuth cannot be proven on that preview. Production QA completed WorkOS authorization for both the demo account and a real Terminal49 account, then reproduced the resolver rejection. After this diagnostic change reaches an appropriately configured environment, repeat that QA to classify and correct the underlying resolver result.
Draft only; no production deployment is included.
Related: Terminal49/t49#3543 and Linear DEV-12439.
Greptile Summary
This PR corrects MCP connected-client resolver semantics so authenticated account-level denials remain HTTP 403 responses without prompting clients to discard valid OAuth grants.
Confidence Score: 5/5
The PR appears safe to merge, with the resolver authorization distinction implemented consistently and covered by a focused test.
No new changes exist since the previous review SHA, no previous Greptile findings were supplied as outstanding, and the full PR currently preserves fail-closed authorization while correctly distinguishing invalid credentials from account access denials.
Important Files Changed
Sequence Diagram
sequenceDiagram participant Client participant MCP as MCP Gateway participant Resolver as Connected Client Resolver Client->>MCP: Bearer OAuth token MCP->>Resolver: Resolve access token alt Resolver returns 401 Resolver-->>MCP: Invalid credential MCP-->>Client: 401 + OAuth challenge else Resolver returns 403 Resolver-->>MCP: Account access denied MCP-->>Client: 403 without OAuth challenge else Resolver returns another error Resolver-->>MCP: Upstream failure MCP-->>Client: Retryable gateway error endReviews (2): Last reviewed commit: "chore: clean up MCP anti-slop warnings" | Re-trigger Greptile
Context used: