Skip to content

fix(web,mobile): MCP apps that report no content collapse instead of leaving an empty box - #46259

Open
rgodha24 wants to merge 3 commits into
pingdotgg:mainfrom
rgodha24:rohan/mcp-app-zero-height
Open

rgodha24 wants to merge 3 commits into
pingdotgg:mainfrom
rgodha24:rohan/mcp-app-zero-height

Conversation

@rgodha24

Copy link
Copy Markdown
Contributor

Problem

Every Datadog MCP call that returns no chart leaves an empty gray box in the thread. Datadog attaches its dataviz app (ui://apps/dataviz) to execute_code and get_datadog_metric. When a result has no charts (_meta["datadog/inline-chart-collection"].entries is []), the app renders nothing and sends ui/notifications/size-changed with height: 0. clampMcpAppHeight raises that to the 80px minimum. The app's own body paints a solid background, so each call becomes an 80px gray card with nothing in it. A busy Datadog turn stacks one per call, and they stay visible while "Worked for" is collapsed and after a reload.

Fixes #38253.

Change

A height of 0 now collapses the app's row. Every other height sizes exactly as before.

  • clampMcpAppHeight and the 80px floor from feat: MCP apps render and run inline in threads #16236 are unchanged. Heights from 1 to 79 still round up to 80. The host now tracks one extra fact: the app's last inline report was <= 0.
  • Web (McpAppFrame): while that flag is set, the row is 0px tall and drops its prefersBorder border. The iframe stays mounted, so the app grows back when it reports content. The "left its page and was stopped" message ignores the flag and keeps its height. "Show app" after a close clears the flag, the same way it already resets the frame.
  • Mobile (ThreadMcpApp): same rule for the live WebView row. It is 0px with no bottom margin. The bridge-missing, navigated-away and crashed messages ignore the flag, and the closed and full-screen placeholders don't read it. The flag is cleared wherever the row already resets its height: app change, reopen, inline reload and process restart.

Because the flag is separate from height, every status view renders exactly as on main.

Scope

Fixes #38253. #38086 and #39961 make the same fix by changing clampMcpAppHeight to return 0, which sends 0 into the status views and the reopen path that reuse height. Those views then each needed their own floor. This PR leaves the clamp and those views alone, so it touches only the live app row. #35911 (small non-zero heights) is out of scope.

Verification

Reproduced with Datadog's real app. The stub fixture in #39961 drew transparent blank space. This repro serves Datadog's own dataviz HTML (dataviz-mcp-ui v35.156918072, which loads its bundle from static.datadoghq.com) from a stdio MCP server. Its execute_code returns the same shape as a stored Datadog result: a JSON text block, _meta["datadog/inline-chart-collection"].entries: [], and "openai/closeWidget": true. A Claude thread (claude-haiku-5-5, started with t3 thread start --wait) called it three times. I opened the thread on the dev web client in dark mode, at 1280×900 and 2x scale, and measured each dataviz app row after the bundle loaded.

Before (main, d8b9253) After
Rows [80, 80, 80] px Rows [0, 0, 0] px
Three empty gray Datadog app cards between "Worked for" and the reply The reply sits directly under "Worked for"

The same thread and DB were used for both. Only McpAppFrame.tsx was toggled.

Test. New browser test collapses an app that reports no content until it reports some in McpAppFrame.browser.test.tsx. The app sets prefersBorder and reports 0: the row must be 0px and the box must have no height, so no border line is left. It then reports 12, and the row must come back at 80px.

  • With McpAppFrame.tsx from main: Tests 1 failed | 5 passed (6).
  • With the fix: Tests 6 passed (6). The existing reopen and navigated-away tests pass unchanged.

vp run check:changed: format, lint, knip, typecheck (3 packages), test and React Compiler (2 files) all pass.

Not checked: mobile on a device or simulator. The mobile change mirrors the web rule, and the typecheck and React Compiler checks cover it.

Model: Claude Opus 5.5. Harness: Claude Code in T3 Code.

@github-actions github-actions Bot added vouch:unvouched Author is not yet trusted in the VOUCHED list. size:M 30-99 changed lines (additions + deletions). labels Nov 30, 2026
@coderabbitai

coderabbitai Bot commented Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Important

Review skipped

Review was skipped as selected files did not have any reviewable changes.

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 388d558 and 1d87b08.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • Trigger review

No actionable comments were generated in the recent review.

Walkthrough

The web and mobile MCP app views now track reports of nonpositive height and collapse inline rows under platform-specific conditions. The changes also reset empty state during specified app and document lifecycle actions.

Changes: Empty MCP app rows

Layer / File(s) Summary
Web frame empty-height handling
apps/web/src/components/chat/McpAppFrame.tsx, apps/web/src/components/chat/McpAppFrame.browser.test.tsx
The frame ignores missing heights and tracks whether a reported height is zero or less. It collapses the row unless the app has navigated away, resets the state when reopened, and omits the preferred border while collapsed. The browser test checks collapse at zero and expansion after a height report of 12.
Mobile inline empty-height handling
apps/mobile/src/features/threads/McpAppWebView.tsx
The view resets empty state when the app reference changes or the WebView restarts. It ignores undefined or invalid heights and collapses eligible inline rows. Fullscreen sizing remains unchanged.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Possibly related issues

  • pingdotgg/t3code#35911 — The PR collapses rows for zero or negative heights, but retains the existing minimum-height clamp for positive heights below 80.

Suggested reviewers: juliusmarminge

Merge Risk: Minimal · previous review 388d5

This change collapses empty MCP app rows, such as Datadog results with no charts, to zero height on web and mobile. Other sizing behavior is unchanged. No merge-blocking risk was found. The mobile behavior has not been checked on a device or simulator.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: MCP apps that report no content now collapse instead of showing an empty box. It also names both affected areas (web and mobile). It follows the conventional commit fo…
Description check Passed The description follows the repository template. It has Problem, Change, Scope, and Verification sections, and each one is filled in. It gives a clear reproduction with Datadog's real dataviz app, wit…
Linked Issues check Passed [#38253] The issue requires that Datadog execute_code results with no charts stop leaving empty 80px cards. The head keeps clampMcpAppHeight and its 80px floor. The PR adds a separate empty flag, set …
Out of Scope Changes check Passed All changed files serve the #38253 fix. The web change in McpAppFrame.tsx adds the empty flag and the collapsed row. It keeps the stopped message at its height and clears the flag on 'Show app'. The m…
Full details: Title check

Explanation

The title names the main change: MCP apps that report no content now collapse instead of showing an empty box. It also names both affected areas (web and mobile). It follows the conventional commit format the template suggests. The changeset matches it: the live app row goes to 0px when an app reports a height of 0 or less, in both McpAppFrame.tsx and McpAppWebView.tsx.

Full details: Description check

Explanation

The description follows the repository template. It has Problem, Change, Scope, and Verification sections, and each one is filled in. It gives a clear reproduction with Datadog's real dataviz app, with before and after measurements. It links issue #38253 and explains why the clamp and status views stay unchanged. It includes a focused browser test with pass/fail results and a list of what was not checked (mobile on device). It also names the model and harness, as the template asks. The Verification section includes before/after screenshots, as the template requires for UI changes.

Full details: Linked Issues check

Explanation

[#38253] The issue requires that Datadog execute_code results with no charts stop leaving empty 80px cards. The head keeps clampMcpAppHeight and its 80px floor. The PR adds a separate empty flag, set when the app reports height <= 0. While the flag is set, the web row (McpAppFrame.tsx) is 0px and drops its border. The mobile live row (McpAppWebView.tsx) is 0px with no bottom margin. The iframe and WebView stay mounted, so the row grows when the app reports content. The browser test 'collapses an app that reports no content until it reports some' covers the 0px case and the recovery to 80px. The author reports that this test fails on main and passes with the change. The reproduction in the PR uses Datadog's real dataviz app, and the row measurements are [80, 80, 80] on main and [0, 0, 0] with the change. The #35911 small-height concern is excluded, as the PR states. This assessment used the whole-PR summary and one focused file read. The incremental diff from the previous head could not be read, so the head changes are assessed from the summary only. Mobile was not verified on a device. That is a verification gap, not a missing coding requirement.

Full details: Out of Scope Changes check

Explanation

All changed files serve the #38253 fix. The web change in McpAppFrame.tsx adds the empty flag and the collapsed row. It keeps the stopped message at its height and clears the flag on 'Show app'. The mobile change in McpAppWebView.tsx applies the same rule to the live row. It clears the flag at the existing reset points. The browser test in McpAppFrame.browser.test.tsx verifies the new behavior. The PR does not change clampMcpAppHeight, the status views, or the #35911 small-height behavior. The mobile summary states that inline size updates are ignored in fullscreen. The web summary does not state this. The previous review raised a possible fullscreen regression, where an inline 0 report followed by fullscreen could collapse the row. The incremental diff could not be read, so this point stays unverified. It is a possible regression, not a demonstrated unrelated change, so it does not change the verdict.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 418df26 and 388d558.

Files selected for processing: 2

  • apps/mobile/src/features/threads/McpAppWebView.tsx
  • apps/web/src/components/chat/McpAppFrame.tsx
Files with no reviewable changes: 2

  • apps/mobile/src/features/threads/McpAppWebView.tsx
  • apps/web/src/components/chat/McpAppFrame.tsx

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

@juliusmarminge juliusmarminge added the takeover:in-progress A takeover lead is working on this PR label Nov 30, 2026
@juliusmarminge juliusmarminge added takeover:needs-julius Takeover done; route gate says Julius decides and removed takeover:in-progress A takeover lead is working on this PR labels Nov 30, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:M 30-99 changed lines (additions + deletions). takeover:needs-julius Takeover done; route gate says Julius decides vouch:unvouched Author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Datadog execute_code results with no charts leave empty 80px app cards in the thread

2 participants