Repository navigation
fix(mcp): soft-fail stalled package retrievers during search/execute - #920
Conversation
Package retrievers are optional enrichment with short sandbox budgets (previously 1s search / 300ms context). After #551, a single timed-out retriever failed the entire MCP search or execute call with "Execution timed out", which agents hit whenever a cold package ran long. Restore per-retriever isolation (skip + warn), raise default budgets to 3s/1s, and keep healthy results for the surrounding tool call.
|
No actionable comments were generated in the recent review. π βΉοΈ Recent review infoβοΈ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: π Files selected for processing (3)
π WalkthroughWalkthroughPackage retriever execution now uses updated timeout budgets and soft-fails individual retrievers. Failed retrievers are logged and returned as warnings while successful results remain available. Documentation and tests cover the timeout and failure behavior. ChangesPackage retriever resilience
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant runPackageRetrievers
participant RetrieverExecution
participant consoleError
runPackageRetrievers->>RetrieverExecution: execute healthy and stalled retrievers
RetrieverExecution-->>runPackageRetrievers: successful result or timeout error
runPackageRetrievers->>consoleError: log failed retriever
runPackageRetrievers-->>runPackageRetrievers: keep healthy results and accumulate warning
Suggested reviewers: π₯ Pre-merge checks | β 5β Passed checks (5 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 |
|
π Preview deployed: https://kody-pr-920.kody-a99.workers.dev Worker: Mocks:
|
Summary
Agents were seeing MCP
Error: Execution timed outonsearch(and sometimesexecute) after ~1β2s β far below the documented ~90s execute sandbox budget.Root cause: package retrievers are optional enrichment with short sandbox budgets (previously 1s search / 300ms context). After #551, a single timed-out retriever used
Promise.alland failed the entire MCP tool call with the sandbox string"Execution timed out". That matches SentryKODY-CLOUDFLARE-P/KODY-CLOUDFLARE-12durations (~1β2s) and "some agents" (those with slow/cold package retrievers).Fix:
Promise.allSettled+ warning); keep healthy resultsValidation
packages/worker/src/package-retrievers/service.node.test.ts(soft-fail keeps healthy results)System recap β extends existing primitives (medium risk)
Mode: recap Β· Base:
main@dc25e719Β· Head:f111178eClassification: extends β optional package-retriever enrichment no longer fails MCP
search/executewhen one retriever times out.Primitives touched
packagesmcp-serverClassifier note:
packages/worker/src/package-retrievers/**is not yet under acoderoot inprimitives.yaml; behavior is package-enrichment for MCP tools.System map
Package retrievers enrich MCP search/execute; a stalled retriever now skips instead of aborting the tool.
Legend: green = composes (wiring only) Β· amber = extended by this PR Β· red = new primitive Β· gray = context.
Before / after
Before: one retriever
"Execution timed out"failed the whole MCPsearch/executecall (~1β2s wall time).After: that retriever is skipped with a warning; other retrievers and core search/execute results still return.
Invariants
Retriever runs remain user-scoped (
userIdon package/source lookups). Soft-fail never substitutes another user's retriever data.Docs
docs/contributing/packages-and-manifests.mddocuments host budgets and fail-soft enrichment.Note
Medium Risk
Changes MCP search/execute enrichment behavior and timeout defaults; failures are isolated but agents may see new warnings instead of hard errors when retrievers stall.
Overview
Fixes MCP
searchandexecutefailing withExecution timed outwhen a single optional package retriever stalled under the old short budgets.runPackageRetrieversnow usesPromise.allSettledso one slow or broken retriever is logged, recorded inwarnings, and skipped while other retrievers still contribute results. Default host budgets rise to 3s search / 1s context (caps 5s / 3s), and contributor docs describe fail-soft enrichment behavior.A unit test covers the timeout skip path; per-retriever execution errors are normalized via
getErrorMessagebefore surfacing in warnings.Reviewed by Cursor Bugbot for commit f111178. Bugbot is set up for automated code reviews on this repo. Configure here.
Summary by CodeRabbit
New Features
Documentation