Skip to content

fix(mcp): share cold catalog search projections - #89

Merged
shuv1337 merged 6 commits into
v2from
fix/cold-app-discovery
Nov 12, 2026
Merged

shuv1337 merged 6 commits into
v2from
fix/cold-app-discovery

Conversation

@shuv1337

@shuv1337 shuv1337 commented Nov 12, 2026 •

Copy link
Copy Markdown
Owner

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-e2e and 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 $defs container. 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 $defs object. 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

Phase Before After
GitHub Linux first search 10,071 ms, unavailable/timeout 8,617 ms, success on first green run
GitHub Linux app inspection 7,486 ms 2,877 ms
GitHub Linux catalog construction 5,601 ms 2,249 ms
Linux container schema construction 1,336 ms 31 ms
Linux container first search 7,741 ms 5,317 ms

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, and actionlint .github/workflows/fork-ci.yml pass. 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 against origin/v2 at final head b96493ff0: 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, branch fix/cold-app-discovery, clean and fully pushed. Canonical /Users/shuv/repos/executor-v2 was cleanly fast-forwarded to its existing origin/v2 baseline; this PR is not merged. No uncommitted source files. No production calls or deployment.

all: changes the fork CI workflow and routes the cold-discovery scenario to the isolated catalog job

@shuv1337
shuv1337 marked this pull request as draft November 12, 2026 02:02
@shuv1337
shuv1337 marked this pull request as ready for review November 12, 2026 02:27
@shuv1337
shuv1337 merged commit e72838e into v2 Nov 12, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant