fix(addie): create_github_issue prompts reauth when token has missing scopes#3648
Merged
Conversation
The Pipes getAccessToken call returns { status, accessToken, scopes,
missingScopes } but create_github_issue only branched on status. Users
with a stale OAuth connection that lacked public_repo silently called
the GitHub API and got a 403 fallback ("Failed to create issue (403).
Use draft_github_issue…") instead of the reconnect prompt that would
actually fix it.
Diagnosed from PostHog $exception events on 2026-04-29 — two 403s,
~18min apart, from create_github_issue. Now: when status='ok' but
missingScopes is non-empty, route the user to the same reconnect path
as needs_reauthorization, and log missingScopes at info so operators
can see which scope(s) Pipes is reporting missing.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
bokelley
enabled auto-merge (squash)
April 30, 2026 10:07
2 tasks
bokelley
added a commit
that referenced
this pull request
Apr 30, 2026
…3650) Add JSDoc context next to the level guide in server/src/logger.ts explaining that logger.error / logger.fatal trigger the #aao-errors Slack alert and PostHog $exception capture via the pino hook, so they should be used only for unexpected, page-worthy failures. Expected failures with a graceful fallback (third-party 4xx, validation, etc.) should be logger.warn so the alert path is not taken. Same anti-pattern surfaced as ":rotating_light: System error: unknown" noise in PRs #3578, #3622, #3648. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3 tasks
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.
Summary
create_github_issuewas silently calling the GitHub API with a token that didn't have the right scopes — users got a generic "Failed to create issue (403)" fallback instead of the reconnect prompt that would actually fix it.Root cause
server/src/services/pipes.ts:9returns{ status, accessToken, scopes, missingScopes }for the'ok'variant. The handler atserver/src/addie/mcp/member-tools.ts:5085only branched onstatus !== 'ok'—missingScopeswas unused. When WorkOS Pipes returned{ status: 'ok', missingScopes: ['public_repo'] }(e.g., for a user whose OAuth connection predates a scope change), we plowed ahead and let GitHub return 403.Diagnosis
PostHog
$exceptionevents on 2026-04-29 showed two 403s fromcreate_github_issue, ~18 min apart, hittingapi.github.com/repos/adcontextprotocol/adcp/issues. 403 (not 401) = token authenticated but lacked permission, which fits the missing-scope hypothesis. (We were unable to attribute these to a user because of themodule: unknownbug fixed in #3578 / #3622.)Fix
When
status === 'ok' && missingScopes.length > 0, route the user to the same reconnect path asneeds_reauthorization. Also logmissingScopesatinfoso operators can see which scope(s) Pipes is reporting missing.Test plan
not_connected,needs_reauthorization, throw-on-getAccessToken, success path, 422 retry, and 500 fallback all still pass (55/55)test:unit + test-dynamic-imports + typecheck) — green🤖 Generated with Claude Code