fix(serve-app): bind the host's own opening call instead of re-posting a large tool result (#562) - #565
Conversation
…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 detectedLatest commit: c9b142d The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
commit: |
There was a problem hiding this comment.
💡 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".
| "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) |
There was a problem hiding this comment.
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 👍 / 👎.
| "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) |
There was a problem hiding this comment.
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 👍 / 👎.
…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.
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'shauler dashboard(ScriptedAlchemy/cargo-hauler#83): on a machine with ~20 active tickets,hauler_statusreturns ~108 KB and the App never renders.Root cause
The host page round-tripped the result the host had just produced:
serve-mcp-app.tscalls the opening tool once and embeds the result in the page seed;serve-app-page.tsPOSTed{ host, input, previewProfile, result, toolName }back to/api/mcp/sessions/<id>/apps;mcp-app-routes.tsrequiredresultand reads bodies through the shared 64 KiBreadJsonBodybound.Fix
McpAppRoutesgains an optionalopeningCall(sessionId, toolName)lookup. A create request that carries neitherinputnorresultbinds 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 stillAB8021.serve-appsupplies 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 atheight: 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 anopeningCallthe 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 postsseed.result.hauler dashboardon this branch binds a 107,694-bytehauler_statusresult and returns the 333 KB App resource plus sandbox frame.Self-review
Reviewer:
generalPurposesubagent on GPT-5.6 Sol (thechange-risk-reviewercould not run — TraceDecay's daemon is down and it has no shell fallback). Findings and disposition:tests/serve-app.test.ts) — dismissed with reasoning: the routes unit test binds a >64 KiB opening result through the exactcreateRequestpath 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 postsseed.result.examples/mcp-app'sshow-statuscannot produce a large result without a fixture change, and the live run in the description (107,694-bytehauler_status) is the end-to-end proof.packages/workbench/tests/mcp-app-real.e2e.test.tsnow asserts the sandbox proxy document does not scroll, clips its body, and renders the App frame as a block.(#565).No authorization, Workbench-compatibility, fallback-data, or stale-doc defects found (authorization precedes body parsing; the Workbench still sends
inputandresult).