Repository navigation
fix(mcp): share cold catalog search projections - #89
Merged
Merged
Conversation
shuv1337
marked this pull request as draft
November 12, 2026 02:02
shuv1337
marked this pull request as ready for review
November 12, 2026 02:27
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.
Fixed and verified on Linux — ready, not merged or deployed
Fixes cold MCP discovery for product-feedback
pc_9d42e8844c6d. Head:b96493ff069bc378782048dee89bfbbd5d9e928d. The 10 s discovery wait and its existing progress/idle policy are unchanged. No retries, smaller fixture, prewarming reads, migrations, or deployment changes.Final Linux CI: all checks green, including
security-e2eand its isolated cold-discovery step. Socket checks also pass. No merge or deployment: deployment remains the user's call.Root cause and measured fix
The earlier optimization removed duplicate search-row projections, but Linux still timed out. Instrumented failing run reproduced a 10,071 ms first search: app inspection alone consumed 7,486 ms, including 5,601 ms in catalog construction; search-row work was still unfinished at the timeout.
The remaining repeated work was in OpenAPI
bundler: each of 8,549 operations traversed the same cyclic graph of 601 definitions and allocated a fresh$defscontainer. Catalog validation and encoding consequently visited/interned those duplicate containers too.Cache the reachable definition graph by its ordered root-reference list, within that one bundler's immutable definitions, and share the resulting
$defsobject. This preserves definition contents/order, unresolved references, schema-local overrides, account filtering and parameter defaults. No cross-account or cross-revision cache was introduced.The full diff also retains the earlier optimizations: one weakly keyed projection per immutable listing, and one position-to-digest projection per interned
$defs. Database writes and authorization remain per target.Linux evidence
First green Linux run: four concurrent cold searches succeeded in 7,995–8,005 ms; warm search 79 ms. Phase split: app evaluation <1 ms, compile 1,730 ms, compile+serialization 1,875 ms, operation reads 202 ms, definition reads 44 ms, schema construction 50 ms, index projection 2,338 ms, persistence 2,970 ms. Ranking is SQL BM25, not embeddings.
Final-head timing caveat: the final runner was slower: initial search 11,431 ms, concurrent 10,223–10,230 ms, warm 54 ms, all successful with no unavailable app. Its existing progress-aware discovery policy is not a strict 10,000 ms wall-clock bound; this PR does not change that policy or claim otherwise. Final phase split: inspect 3,745 ms, catalog 2,938 ms, compile 2,289 ms, schema construction 47 ms, projection 2,918 ms, persistence 4,168 ms, ranking 31 ms. The product code is identical to the first green run; the final commit adds full-schema assertions only. Both complete fork CI runs passed, not reruns of failed jobs.
Low-cardinality spans cover compile/serialization, operation/definition reads, schema construction, index projection and persistence. CI retains timing-only summaries (no credentials or schema contents), so the Linux diagnosis is recoverable from its log.
Coverage
The regression immediately searches a newly deployed catalog, activates changed metadata, launches four concurrent native MCP searches, checks warm search, verifies the complete 601-entry cyclic schema via the public tool endpoint, and walks all 8,549 updated tools exactly once. No management read prewarms discovery.
Focused Linux container scenarios passed:
Cold MCP discovery serves 8549 generated OpenAPI tools after activation(including the final full-schema assertions).an OpenAPI app whose resources expand into one another lists its tools in bounded pages, each tool's schema complete, and MCP search ranks them.Live OpenAPI lists and calls account tools whose schemas carry extensions holding references.MCP execute pays for a slow app's tool listing once and reuses it.MCP execute lists tools again for a new version, link change or credential, never across callers or after revoked access.Final fork CI also passes the security scenarios, both local MCP search scenarios, static checks and its configured self-contained suites. Local
bun run format,bun run check, andactionlint .github/workflows/fork-ci.ymlpass. Cloud Worker memory/deployed behavior is not claimed as verified.Full-diff review
Requested Cursor
claude-opus-5-5, high effort, reviewed all eight changed files againstorigin/v2at final headb96493ff0: no blockers. Verified schema equivalence/order, revision/account isolation, safe shared objects, digest equivalence, interruption handling, telemetry and E2E wiring.Nonblocking caveats retained explicitly: completed projections live with their weak-keyed listing and are not included in its cache byte estimate (a Cloud memory tradeoff, not measured here); rare digest failures remain cached; a scheduler handoff can theoretically duplicate cache creation. Timing-summary JSON parsing is strict, and the E2E guards user-visible success rather than asserting an internal projection count. No speculative concurrency machinery was added for these nits.
Handoff
Checkout
/Users/shuv/repos/executor-cold-discovery, branchfix/cold-app-discovery, clean and fully pushed. Canonical/Users/shuv/repos/executor-v2was cleanly fast-forwarded to its existingorigin/v2baseline; this PR is not merged. No uncommitted source files. No production calls or deployment.