Repository navigation
fix(mcp): keep unavailable value/secret scopes out of Sentry - #964
Merged
Merged
Conversation
value_set defaults to scope "session", so MCP calls without a session binding threw a plain Error and opened platform-looking Sentry issues (7634425298). Throw McpCallerError for unavailable value and secret scopes so observability keeps them on mcp-event logs only. Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
📝 WalkthroughWalkthroughChangesScoped storage errors
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
kody-bot
marked this pull request as ready for review
July 26, 2026 17:55
Contributor
|
🔎 Preview deployed: https://kody-pr-964.kody-a99.workers.dev Worker: Mocks:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/worker/src/mcp/secrets/service.node.test.ts`:
- Around line 379-406: Extend the saveSecret unavailable-scope tests to cover a
null package binding alongside the existing session case. Invoke saveSecret with
scope "package" and packageId: null, then assert it rejects with McpCallerError
and the exact message 'Secret scope "package" is unavailable in this context.'
while preserving the existing session assertion.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 0a6c4755-195e-443e-88f0-7921e9264800
📒 Files selected for processing (5)
packages/worker/src/mcp/capabilities/values/value-set.tspackages/worker/src/mcp/secrets/service.node.test.tspackages/worker/src/mcp/secrets/service.tspackages/worker/src/mcp/values/service.node.test.tspackages/worker/src/mcp/values/service.ts
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Address CodeRabbit feedback on the McpCallerError carve-out. Co-authored-by: Kent C. Dodds <me+github@kentcdodds.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.
Summary
Sentry 7634425298:
value_setthrew a plainErrorwhen scope"session"was requested without a session binding (the capability defaults tosession). That is a caller mistake — MCP observability should keep it onmcp-eventlogs, not open a platform bug issue.Fix
McpCallerErrorfromgetOrCreateValueBucket/getOrCreateSecretBucketwhen the requested scope has no binding in the current storage context (same pattern as recent job/MCP caller-error triage PRs).value_setscope docs: use"user"when there is no session context.Risk
composes / low — error-class wiring only; no auth, isolation, billing, or migration surface. Intended to squash-merge after CI + AI review.
Siblings
Prefetched unresolved siblings (
updateCurrentEntry, workflow timeout, search ValidationError) do not share this root cause.System recap — composes existing primitives (low risk)
Mode: recap · Base:
main@01399f13· Head:90f324afClassification: composes — reuses the existing
McpCallerErrorcarve-out so unavailable session/app/package scopes stay off Sentry; no primitive shape or contract change.Primitives touched
mcp-serverMcpCallerErrorfor unavailable value/secret scopesvaluesvalue_setscope descriptionSystem map
value_set/ secret save hit the values/secrets services; unavailable scope bindings now surface as caller errors so MCP observability skips Sentry.Legend: green = composes (wiring only) · amber = extended by this PR · red = new primitive · gray = context (unchanged, included only when an edge crosses it).
Change flow
Summary by CodeRabbit
scope: session-scoped items require an active session, while user-scoped items are available without one.McpCallerErrorwith clear, scope-specific messages instead of a generic failure.McpCallerErrortype and exact error messages for unavailable session-scope and related scenarios.