fix(mcp-apps): Lazily discover UI tools for cloud runs - #3851
Conversation
|
😎 This pull request was merged. |
|
React Doctor found no issues in the changed files. 🎉 Reviewed by React Doctor for commit |
|
Reviews (1): Last reviewed commit: "discover MCP UI tools lazily for cloud r..." | Re-trigger Greptile |
There was a problem hiding this comment.
Contained core-package bugfix (lazy MCP UI discovery for cloud runs) with matching new unit tests covering the added logic paths; no auth/billing/CI/dependency/migration surface touched, and a Greptile bot review with a positive reaction adds further signal.
- 👍 on the PR from greptile-apps[bot].
Gate mechanics and policy version
| Gate | Result | |
|---|---|---|
| prerequisites | ✓ | all clear |
| deny-list | ✓ | no deny categories matched |
| size | ✓ | 196L, 1F substantive, 317L/2F incl. docs/generated/snapshots — within ceiling |
| tier | ✓ | T1-agent / T1d-complex (317L, 2F, single-area, fix) |
| stamphog 2.0.0b3 | .stamphog/policy.yml @ 05b4aa0 · reviewed head ac9e493 |
New commits pushed (delta classified non_trivial_delta) — stamphog approval dismissed; re-review running automatically.
|
Note 🤖 stamphog reviewed This changes how CSP metadata is warmed and attached to MCP app UI resource fetches — a security-sensitive surface controlling what embedded HTML can do — and despite solid test coverage, it has no independent review (0 top-level reviews; only a Greptile discussion comment plus a lone 👍, and no owning-team or strong-familiarity author signal).
Gate mechanics and policy version
|
Problem
MCP app cards (like the loop builder's review card) only render if the desktop has started a local agent session since app launch. That's because the app only learns which MCP tools have a UI during a discovery step that a local session triggers. Cloud runs (loop builder, repo-less chat) never start a local session, so the check always says "no UI" and the card silently never appears. The agent then points users at a Create button that doesn't exist.
The same gap means cloud runs fetch app HTML without its CSP metadata, so since #3803 they get the restrictive default CSP.
Changes
When a UI lookup misses and the server hasn't been discovered yet, connect and discover it on the spot instead of waiting for a local session. Resource fetches also load CSP metadata first. A failed discovery throws with a 60s backoff so the UI retries later instead of caching "no card" forever.
How did you test this?
@posthog/corecovering the lazy path, failure backoff and CSP attachment.biome lint packages/coreand typecheck on core and host-router, all clean.Automatic notifications