Skip to content

fix(gateway): MCP App standalone UI hangs when sandbox fetch never resolves - #119276

Merged
RomneyDa merged 8 commits into
openclaw:mainfrom
xialonglee:fix/gap-mcp-app-standalone-fetch-timeout
Aug 10, 2026
Merged

RomneyDa merged 8 commits into
openclaw:mainfrom
xialonglee:fix/gap-mcp-app-standalone-fetch-timeout

Conversation

@xialonglee

@xialonglee xialonglee commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor
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:

  • the initial view fetch times out after 30 seconds and tells the user to reload;
  • tool/resource operations use the view's configured MCP request deadline plus the repository's canonical timer-safe grace;
  • runtimes with no deadline contract continue without an invented operation timeout;
  • configured deadlines are snapshotted from the connected MCP session into the view lease, so tools/list_changed catalog invalidation cannot erase or replace them;
  • the stringified browser host is self-contained under the production build transform, including its injected __name helper.

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 optional operationTimeoutMs = 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 __name helper used by the existing Control UI serialized-host test owner, preventing the build transform's __name(...) calls from becoming detached unresolved references after Function#toString().

User impact

  • Blank or permanently loading standalone views become an actionable timeout message.
  • Hanging operations return MCP App operation timed out; try again.
  • Valid near-deadline MCP responses retain a 5-second outer delivery grace.
  • Custom server deadlines survive catalog refresh/invalidation for the lifetime of the view.
  • Normal requests and native no-deadline runtimes preserve their existing behavior.

Evidence

Reviewed head: 6b87395f6ab6d915443437c2efc779c57de13ba6

Blacksmith Testbox run 31299757689 executed the actual generated shell in headless Chromium over real HTTP:

  • hanging initial GET aborted at 30.379 seconds and rendered MCP App view timed out; reload to try again;
  • hanging operation POST aborted and returned MCP App operation timed out; try again;
  • the normal operation completed with its expected result;
  • both intentionally hanging HTTP requests were observed aborted.

The same run passed:

  • src/gateway/mcp-app-standalone.test.ts: 11/11;
  • src/agents/agent-bundle-mcp-runtime.test.ts plus src/agents/mcp-ui-resource.test.ts: 101/101;
  • targeted oxfmt and oxlint for all eight changed files;
  • full 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.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime size: XS labels Aug 4, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Aug 4, 2026
@clawsweeper

clawsweeper Bot commented Aug 4, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 9, 2026, 3:49 AM ET / 07:49 UTC.

ClawSweeper review

What this changes

The PR adds bounded initial-load and operation deadlines to standalone MCP App browser requests while preserving configured server deadlines across catalog refreshes.

Merge readiness

⚠️ Ready for maintainer review - 1 item remains

Keep 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
Reviewed head: 6b87395f6ab6d915443437c2efc779c57de13ba6

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A focused owner-boundary repair with exact-head browser evidence, targeted regression coverage, and no actionable review finding.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body provides exact-head headless-Chromium HTTP evidence that both intentional hangs abort and yield the new visible outcomes; redact private data in any future proof updates.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body provides exact-head headless-Chromium HTTP evidence that both intentional hangs abort and yield the new visible outcomes; redact private data in any future proof updates.
Evidence reviewed 5 items Current-main gap: Current standalone-host POST and initial GET fetches have no abort signal, so an unresolved Gateway request can leave the browser host pending.
Owner-boundary repair: The PR records the established session timeout on the view lease before retention, avoiding catalog-derived timeout rediscovery after invalidation.
Timeout behavior and safety: The generated host applies a fixed initial deadline and an optional grace-extended operation deadline; the shared helper clamps timer values safely.
Findings None None.
Security None None.

How this fits together

An 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]
Loading

Before merge

  • Complete next step (P2) - This is already a coherent implementation PR with no concrete repair task remaining.
Agent review details

Security

None.

PR surface

Source +43, Tests +167. Total +210 across 8 files.

View PR surface stats
Area Files Added Removed Net
Source 5 48 5 +43
Tests 3 168 1 +167
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 216 6 +210

Review metrics

Metric Value Why it matters
Production versus test LOC production +48/-5; tests +168/-1 The production growth implements one session-to-view deadline contract plus visible browser cancellation; regression coverage exercises serialization and catalog invalidation.

Stored data model

Persistent data-model change detected: serialized state: src/gateway/mcp-app-standalone.test.ts, vector/embedding metadata: src/agents/mcp-ui-resource.test.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best 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.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides exact-head headless-Chromium HTTP evidence that both intentional hangs abort and yield the new visible outcomes; redact private data in any future proof updates.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body provides exact-head headless-Chromium HTTP evidence that both intentional hangs abort and yield the new visible outcomes; redact private data in any future proof updates.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.
  • remove merge-risk: 🚨 compatibility: Current PR review selected no merge-risk labels.
  • remove merge-risk: 🚨 availability: Current PR review selected no merge-risk labels.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P1: An unresolved standalone MCP App request can leave an active user workflow permanently loading without an outcome.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): The PR body provides exact-head headless-Chromium HTTP evidence that both intentional hangs abort and yield the new visible outcomes; redact private data in any future proof updates.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides exact-head headless-Chromium HTTP evidence that both intentional hangs abort and yield the new visible outcomes; redact private data in any future proof updates.

Evidence

What I checked:

  • Current-main gap: Current standalone-host POST and initial GET fetches have no abort signal, so an unresolved Gateway request can leave the browser host pending. (src/gateway/mcp-app-standalone.ts:323, 499d81cdbdad)
  • Owner-boundary repair: The PR records the established session timeout on the view lease before retention, avoiding catalog-derived timeout rediscovery after invalidation. (src/agents/mcp-ui-resource.ts:268, 6b87395f6ab6)
  • Timeout behavior and safety: The generated host applies a fixed initial deadline and an optional grace-extended operation deadline; the shared helper clamps timer values safely. (src/gateway/mcp-app-standalone.ts:336, 6b87395f6ab6)
  • Exact-head real behavior proof: The PR body identifies Blacksmith run 31299757689 on this head, using generated-host Chromium traffic over HTTP: hanging initial and operation requests aborted and rendered the stated timeout outcomes, while a normal operation completed. (src/gateway/mcp-app-standalone.test.ts:220, 6b87395f6ab6)
  • Feature history: Blame maps the current standalone-host baseline to a recent current-main MCP App area change by steipete; the linked baseline PR is adjacent context, not a duplicate or replacement. (src/gateway/mcp-app-standalone.ts:323, 7b076155d09f)

Likely related people:

  • steipete: Current baseline host and view/runtime seam lines attribute to this area’s recent main-branch history; shallow history limits stronger ownership attribution. (role: current-main MCP App area contributor; confidence: medium; commits: 7b076155d09f; files: src/gateway/mcp-app-standalone.ts, src/agents/mcp-ui-resource.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (13 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-06T08:32:44.634Z sha 871816d9f921d9a48e406d505580b5244cafb5aa :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-06T11:39:37.029Z sha 871816d9f921d9a48e406d505580b5244cafb5aa :: needs changes before merge. :: [P2] Clamp the grace-extended browser timeout
  • reviewed 2026-08-06T12:35:28.064Z sha 6f12cf20ffd83831f884f7aec37d7f89bb303980 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-06T14:48:04.645Z sha 6f12cf20ffd83831f884f7aec37d7f89bb303980 :: found issues before merge. :: [P1] Preserve native MCP App request budgets
  • reviewed 2026-08-07T02:35:21.176Z sha 11d910a1b7f2d871fe48af6312111df2f3ead195 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-07T03:46:57.763Z sha 11d910a1b7f2d871fe48af6312111df2f3ead195 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-08T08:43:33.829Z sha 48fd82a5e357ceb2e895f09e0a18a25ed03bb869 :: needs real behavior proof before merge. :: [P1] Cover catalog refreshes before enforcing the browser deadline
  • reviewed 2026-08-08T08:54:10.436Z sha 48fd82a5e357ceb2e895f09e0a18a25ed03bb869 :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. P1 High-priority user-facing bug, regression, or broken workflow. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. P2 Normal backlog priority with limited blast radius. labels Aug 4, 2026
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S and removed size: XS labels Aug 5, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 6, 2026
@clawsweeper clawsweeper Bot added status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 6, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 6, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 8, 2026
xialonglee and others added 8 commits August 9, 2026 14:24
…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.
…wser timeout when runtime has no deadline contract
@RomneyDa
RomneyDa force-pushed the fix/gap-mcp-app-standalone-fetch-timeout branch from 48fd82a to 6b87395 Compare August 9, 2026 07:07
@openclaw-barnacle openclaw-barnacle Bot added triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. and removed triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Aug 9, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Aug 9, 2026
@RomneyDa
RomneyDa merged commit f502607 into openclaw:main Aug 10, 2026
147 of 150 checks passed
@xialonglee
xialonglee deleted the fix/gap-mcp-app-standalone-fetch-timeout branch August 10, 2026 08:41
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 11, 2026
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling gateway Gateway runtime P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants