Repository navigation
fix(gateway): MCP App standalone UI hangs when sandbox fetch never resolves - #119276
Conversation
|
Codex review: needs maintainer review before merge. Reviewed August 9, 2026, 3:49 AM ET / 07:49 UTC. ClawSweeper reviewWhat this changesThe PR adds bounded initial-load and operation deadlines to standalone MCP App browser requests while preserving configured server deadlines across catalog refreshes. Merge readinessKeep open. Current main still leaves standalone MCP App browser fetches unbounded; this PR snapshots the connected session deadline at the view boundary and shows the generated host returning visible timeout outcomes, with no blocking patch finding. Priority: P1 Review scores
Verification
How this fits togetherAn MCP App view is created from a connected MCP server session, retained as a Gateway lease, then fetched by a standalone browser host. The host renders the sandboxed UI and forwards permitted app operations back through the Gateway. flowchart LR
A[Connected MCP session] --> B[Create MCP App view]
B --> C[Retained view lease]
C --> D[Gateway view response]
D --> E[Standalone browser host]
E --> F[Sandboxed App UI]
E --> G[Visible timeout outcome]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +43, Tests +167. Total +210 across 8 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Land the view-lease timeout snapshot and browser cancellation path so every stalled standalone MCP App action reaches a bounded, actionable outcome. Do we have a high-confidence way to reproduce the issue? Yes. Current main’s standalone GET and POST fetches have no abort signal, and the supplied exact-head Chromium-over-HTTP run demonstrates the repaired hanging-request path. Is this the best way to solve the issue? Yes. Capturing the connected session’s timeout on the view lease is the narrowest owner-boundary fix; catalog rediscovery would be invalidation-sensitive and browser-local policy would duplicate runtime ownership. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 499d81cdbdad. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (13 earlier review cycles; latest 8 shown)
|
…n and add gateway grace - Snapshot requestTimeoutMs onto McpAppViewLease at view creation so the configured deadline survives catalog invalidation (e.g. tools/list_changed). - Add bounded gateway grace to the browser-side operation fetch signal so the outer timer expires after the runtime MCP deadline, avoiding false failures for valid near-deadline operations. - The initial view load remains bounded at 30s.
…validatable catalog
…wser timeout when runtime has no deadline contract
48fd82a to
6b87395
Compare
…solves (openclaw#119276) * fix(gateway): add timeout to MCP App standalone fetch calls * fix(gateway): honor configured MCP request deadline in standalone app operations * fix(gateway): preserve MCP request timeout across catalog invalidation and add gateway grace - Snapshot requestTimeoutMs onto McpAppViewLease at view creation so the configured deadline survives catalog invalidation (e.g. tools/list_changed). - Add bounded gateway grace to the browser-side operation fetch signal so the outer timer expires after the runtime MCP deadline, avoiding false failures for valid near-deadline operations. - The initial view load remains bounded at 30s. * fix(gateway): read MCP App view deadline from runtime session, not invalidatable catalog * fix(gateway): pass initial-load timeout through serialized MCP App host config * fix(gateway): clamp MCP App browser operation timeout to timer-safe maximum * fix(gateway): preserve native MCP App request budgets by omitting browser timeout when runtime has no deadline contract * fix(gateway): own MCP app deadlines at the view boundary --------- Co-authored-by: Dallin Romney <[email protected]>
Additional instructions
MUST: Keep Allow edits from maintainers enabled for this PR so maintainers can help update the branch when needed.
What Problem This Solves
Standalone MCP Apps now give every stalled browser action a bounded, visible result:
tools/list_changedcatalog invalidation cannot erase or replace them;__namehelper.Ownership and implementation
The connected MCP session owns each server's configured request timeout. View creation records that fact on the lease immediately after
resources/read; the combined runtime delegates the same accessor. The Gateway then emits optionaloperationTimeoutMs = addTimerTimeoutGraceMs(view.requestTimeoutMs)in the standalone view payload. The browser host consumes that already-normalized value and does not rediscover catalog/default policy.The generated host passes the fixed initial-load deadline through serialized config. Its wrapper injects the same local no-op
__namehelper used by the existing Control UI serialized-host test owner, preventing the build transform's__name(...)calls from becoming detached unresolved references afterFunction#toString().User impact
MCP App operation timed out; try again.Evidence
Reviewed head:
6b87395f6ab6d915443437c2efc779c57de13ba6Blacksmith Testbox run 31299757689 executed the actual generated shell in headless Chromium over real HTTP:
MCP App view timed out; reload to try again;MCP App operation timed out; try again;The same run passed:
src/gateway/mcp-app-standalone.test.ts: 11/11;src/agents/agent-bundle-mcp-runtime.test.tsplussrc/agents/mcp-ui-resource.test.ts: 101/101;pnpm build.After the final LOC-only config extraction, run 31300131443 passed the exact final gateway test (11/11), oxfmt, and oxlint. Final Codex autoreview is clean at 0.99 confidence with no actionable/P0 finding.
Repair Doctrine / LOC
Original contributor head: production
+61/-2(net+59), tests+167/-8(net+159), total net+218.Final head: production
+48/-5(net+43), tests+168/-1(net+167), total net+210, across the intended eight files.Removed duplicate paths include the transport-level default-timeout export/fallback, catalog-derived deadline fallback, browser-side grace/clamp policy literals, unused serialized config, redundant clamp/synthetic tests, and duplicate VM scaffolding. The remaining positive production LOC records the session/view deadline contract and supplies the browser/Gateway cancellation and visible-outcome capability.