fix(github): auto-repair missing installation mappings on tool calls#401
Merged
viktormarinho merged 1 commit intomainfrom Apr 23, 2026
Merged
Conversation
Connections that OAuthed before the User-Agent fix ended up with no installation:* entries in KV — captureInstallationMappings silently caught the 403 from GitHub and returned, so webhook deliveries ever since have skipped with "no mapping for installation=...". Adds ensureInstallationMappings(): cheap check via a prefixed KV list(limit=1), running the full capture only when a connection has no mappings. Called on every upstream tool execute, so the next MCP request each affected user makes auto-rebuilds their mapping. No user-visible change, no forced re-auth. Co-Authored-By: Claude Opus 4.7 (1M context) <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.
Context
Confirmed via `wrangler kv key list` on the prod `INSTALLATIONS` namespace:
```
[
{ "name": "triggers:conn_0dviUelZu80E9zZSrAa_v" },
{ "name": "triggers:conn_I1KBBnrohC6orbVqXPIcv" }
]
```
Two `triggers:` entries (good — TRIGGER_CONFIGURE populated them) but zero `installation:` entries. Webhook deliveries have been arriving correctly and immediately skipping with `no mapping for installation=120173638` because the first OAuth completed before the User-Agent fix was deployed — `captureInstallationMappings` silently caught the 403 from `GET /user/installations` and never wrote anything.
Fix
Test plan
🤖 Generated with Claude Code
Summary by cubic
Automatically rebuilds missing GitHub installation mappings during MCP tool calls, fixing skipped webhooks for affected users without re-auth. Adds a cheap pre-check and only runs the full capture when needed.
InstallationStore.hasAnyForConnection(connectionId)using KVlist({ prefix: 'connection:<id>:', limit: 1 }).ensureInstallationMappings(token, connectionId, store)to capture mappings only when absent.buildUpstreamToolsexecute inmcp-proxy.ts, and switchedmain.tsonChangeto use it.captureInstallationMappingspreviously swallowed403fromGET /user/installations, leaving noinstallation:*keys.Written for commit ef6e1c9. Summary will update on new commits.