Repository navigation
Conversation
…ntry Classify invalid repo_search JavaScript regexes, inactive/published repo sessions, and downstream user-connected MCP server tool failures as caller-clearable so they stay on mcp-event instead of opening platform-bug issues (KODY-CLOUDFLARE-49/4A/4B). Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
📝 WalkthroughWalkthroughThe change standardizes caller-facing errors for repository search and downstream MCP server calls. It preserves original causes, adds JavaScript regular-expression guidance, and classifies matching failures as caller failures in observability. ChangesMCP caller error handling
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant MCPCaller
participant repo_search
participant repoSessionRpc
participant observability
MCPCaller->>repo_search: submit repository search
repo_search->>repoSessionRpc: execute search
repoSessionRpc-->>repo_search: return result or caller error
repo_search-->>MCPCaller: return result or McpCallerError
MCPCaller->>observability: classify failure
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 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 |
|
🔎 Preview deployed: https://kody-pr-1333.kody-a99.workers.dev Worker: Mocks:
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 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/capabilities/repo/repo-search.ts`:
- Around line 1-9: Update the repo-search error handling helper used by
isRepoSearchInvalidRegexMessage to return the matching nested cause message, and
pass that message to McpCallerError instead of the outer getErrorMessage(error).
Preserve the outer error as the McpCallerError cause and retain existing
behavior for non-matching errors.
In `@packages/worker/src/repo/repo-session-search.ts`:
- Line 1: Move regex construction and validation out of searchInText and into
the main repository search flow after query normalization, before iterating
workspace files, so invalid patterns consistently raise the caller error even
for empty or unreadable workspaces. Reuse the resulting compiled regex during
file scanning, and add a regression test covering an empty workspace with an
invalid pattern.
🪄 Autofix
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: 2b07eab7-44da-4e4c-93f1-37302795ea56
📒 Files selected for processing (11)
packages/worker/src/mcp/capabilities/mcp-server/index.tspackages/worker/src/mcp/capabilities/mcp-server/mcp-server-caller-error.node.test.tspackages/worker/src/mcp/capabilities/repo/repo-search.node.test.tspackages/worker/src/mcp/capabilities/repo/repo-search.tspackages/worker/src/mcp/capabilities/repo/repo-shared.tspackages/worker/src/mcp/observability.node.test.tspackages/worker/src/mcp/observability.tspackages/worker/src/repo/repo-session-caller-error.node.test.tspackages/worker/src/repo/repo-session-caller-error.tspackages/worker/src/repo/repo-session-search.node.test.tspackages/worker/src/repo/repo-session-search.ts
Compile mode=regex before scanning files so empty workspaces still reject Python/PCRE patterns, and map nested DO errors to the matching guidance message in McpCallerError (CodeRabbit on #1333). Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Intent
Stop routine caller-correctable MCP failures from opening Sentry platform-bug issues during agent repo/MCP workflows.
Summary
repo_search mode=regexrejected Python/PCRE inline flags like(?s). Improve the error to name JavaScript RegExp rules, compile before scanning files, and map it toMcpCallerError(plus observability message match for DO RPC).mcp-event.McpCallerErrorinstead of looking like Kody platform bugs.Fixes https://kent-c-dodds-tech-llc.sentry.io/issues/7660915384/
Fixes https://kent-c-dodds-tech-llc.sentry.io/issues/7660931122/
Fixes https://kent-c-dodds-tech-llc.sentry.io/issues/7660974902/
Testing
repo_search, MCP-server synthesis handler, observability filtersnpm run validate(local green on pre-review revision)System recap — composes existing primitives (low risk)
Mode: recap · Base:
main@446e1f1e· Head:6e3ac66fClassification: composes — wires existing
McpCallerError/isCallerFailureclassification into repo search, inactive sessions, and MCP-server tool failures; no new primitives or schema changes.Primitives touched
capability-registryrepo_searchinvalid regex →McpCallerErrormcp-client-serversMcpCallerErrormcp-serverrepo-sessionsSystem map
Caller-correctable repo/MCP-server failures classify as non-Sentry MCP failures while remaining visible on
mcp-eventlines.Legend: green = composes (wiring only) · amber = extended by this PR · red = new primitive · gray = context (unchanged, included only when an edge crosses it).
Summary by CodeRabbit
Bug Fixes
RegExpsyntax, with literal search available by default.Tests