Skip to content

fix(serve-app): bind the host's own opening call instead of re-posting a large tool result (#562) - #565

Merged
ScriptedAlchemy merged 6 commits into
mainfrom
fix/562-serve-app-opening-result
Sep 5, 2026
Merged

fix(serve-app): bind the host's own opening call instead of re-posting a large tool result (#562)#565
ScriptedAlchemy merged 6 commits into
mainfrom
fix/562-serve-app-opening-result

Conversation

@ScriptedAlchemy

@ScriptedAlchemy ScriptedAlchemy commented Sep 4, 2026

Copy link
Copy Markdown
Owner

Closes #562.

Symptom

agent-bundle serve-app <server>/<app> shows the fallback panel — "MCP App preview failed: AB8010: Request body exceeds 64 KiB" over a JSON dump — whenever the opening tool's result is large. Reproduced with cargo-hauler's hauler dashboard (ScriptedAlchemy/cargo-hauler#83): on a machine with ~20 active tickets, hauler_status returns ~108 KB and the App never renders.

Root cause

The host page round-tripped the result the host had just produced: serve-mcp-app.ts calls the opening tool once and embeds the result in the page seed; serve-app-page.ts POSTed { host, input, previewProfile, result, toolName } back to /api/mcp/sessions/<id>/apps; mcp-app-routes.ts required result and reads bodies through the shared 64 KiB readJsonBody bound.

Fix

  • McpAppRoutes gains an optional openingCall(sessionId, toolName) lookup. A create request that carries neither input nor result binds that call; one that carries both is the Workbench's own tool run and is unchanged; one carrying only one of them, naming another tool, or another session is still AB8021.
  • serve-app supplies its selection as the opening call; its page now posts { host, previewProfile, toolName } only. The seed still carries the result for the fallback panel's display.

Also: the host page, the MCP App sandbox document (mcp-app-sandbox.ts), and the Runtime App surface proxy sized their iframes inline at height: 100%, so each level overflowed by a line-box descender and grew its own scrollbar — three nested scrollbars around the App's. They now size the iframe as a block and clip their own overflow.

Tests

  • tests/mcp-app-routes.test.ts: binds a >64 KiB opening result by tool name; rejects the half-shapes, another tool, and another session; without an openingCall the Workbench shape stays required.
  • tests/serve-app.test.ts: binds the example App the way the page now does and asserts the page no longer posts seed.result.
  • Verified live: hauler dashboard on this branch binds a 107,694-byte hauler_status result and returns the 333 KB App resource plus sandbox frame.

Self-review

Reviewer: generalPurpose subagent on GPT-5.6 Sol (the change-risk-reviewer could not run — TraceDecay's daemon is down and it has no shell fallback). Findings and disposition:

  1. >64 KiB path only exercised at the routes level (tests/serve-app.test.ts) — dismissed with reasoning: the routes unit test binds a >64 KiB opening result through the exact createRequest path that failed and rejects every half-shape; the integration test binds the example App the way the page now does and asserts the page no longer posts seed.result. examples/mcp-app's show-status cannot produce a large result without a fixture change, and the live run in the description (107,694-byte hauler_status) is the end-to-end proof.
  2. No browser assertion for the scrollbar changefixed: packages/workbench/tests/mcp-app-real.e2e.test.ts now asserts the sandbox proxy document does not scroll, clips its body, and renders the App frame as a block.
  3. Changeset summary too implementation-detailed and wrong suffixfixed: consumer-facing summary ending in (#565).

No authorization, Workbench-compatibility, fallback-data, or stale-doc defects found (authorization precedes body parsing; the Workbench still sends input and result).

…g a large tool result (#562)

The serve-app page posted the seeded tool result back to
POST /api/mcp/sessions/<id>/apps, so any opening result past the shared
64 KiB request-body bound (AB8010) dropped the App to the fallback panel —
cargo-hauler's dashboard on a busy machine, for one. The host already made
that call: McpAppRoutes gains an optional openingCall lookup, serve-app
supplies its selection, and the page binds by tool name alone. A request
that carries input and result (the Workbench) is unchanged; one that
carries only one of them, names another tool, or another session is still
AB8021.
@changeset-bot

changeset-bot Bot commented Sep 4, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: c9b142d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
agent-bundle Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 4, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-09-04T23:30:48.240905Z c32c17b PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@pkg-pr-new

pkg-pr-new Bot commented Sep 4, 2026

Copy link
Copy Markdown
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle@565
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle/create-agent-bundle@565
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle/rsc-markdown-stream@565
npm i https://pkg.pr.new/ScriptedAlchemy/agent-bundle/@agent-bundle/runtime@565

commit: c9b142d

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c32c17b42f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .changeset/serve-app-opening-call.md Outdated
"agent-bundle": patch
---

Fix `agent-bundle serve-app` (and `serveApp`) dropping the App to the "ordinary tool result" fallback with `AB8010: Request body exceeds 64 KiB` when the opening tool's result is large: the host page now binds the tool call the host already made by tool name instead of re-sending the result through `POST /api/mcp/sessions/<id>/apps`. `McpAppRoutes` accepts an `openingCall` for that purpose; the Workbench's full-body shape is unchanged. (#562)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Document large opening results in both locales

This changes user-facing behavior for agent-bundle serve-app and serveApp when an opening result exceeds 64 KiB, but neither the English nor Chinese standalone-App documentation is updated to describe the newly supported case. Update the matching pages under website/docs/en/** and website/docs/zh/** in this change.

AGENTS.md reference: AGENTS.md:L71-L77

Useful? React with 👍 / 👎.

Comment thread .changeset/serve-app-opening-call.md Outdated
"agent-bundle": patch
---

Fix `agent-bundle serve-app` (and `serveApp`) dropping the App to the "ordinary tool result" fallback with `AB8010: Request body exceeds 64 KiB` when the opening tool's result is large: the host page now binds the tool call the host already made by tool name instead of re-sending the result through `POST /api/mcp/sessions/<id>/apps`. `McpAppRoutes` accepts an `openingCall` for that purpose; the Workbench's full-body shape is unchanged. (#562)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Keep the changeset summary user-facing

The second sentence turns this release note into an implementation note by naming the internal McpAppRoutes.openingCall, HTTP request shape, and Workbench behavior. Rewrite it around the consumer-visible serve-app/serveApp outcome so the published changeset remains user-facing.

AGENTS.md reference: AGENTS.md:L105-L106

Useful? React with 👍 / 👎.

ScriptedAlchemy and others added 3 commits September 4, 2026 23:51
…ox, and surface-proxy iframes

An inline iframe at height:100% inside a 100%-tall body overflows by its
line-box descender, so the serve-app host page, the MCP App sandbox document,
and the Runtime App surface proxy each grew a scrollbar around the App's own.
Size the iframes as blocks and clip the framing documents' overflow.
@ScriptedAlchemy
ScriptedAlchemy enabled auto-merge (squash) September 5, 2026 00:19
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.

serve-app: App falls back to the JSON dump when the opening tool result exceeds 64 KiB (AB8010) — host page re-uploads a result the server already has

1 participant