Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): preview_status tabs list preserves the crashed URL after a renderer crash #48295

Opensaphid(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/48295/headopened View on GitHub

Problem

After a headless server preview tab crashes and reopenCrashedTab replaces its dead Playwright page with a fresh about:blank page while preserving tab.crash, preview_status reports the crashed URL in status.url and status.loadError.url but reports url: null for that same tab in status.tabs. In statusWithTitle (apps/server/src/preview/ServerBrowser.ts), status.tabs checked candidate.page.url() === "about:blank" before consulting loadErrorOf(candidate)?.url, whereas top-level statusUrl checked loadError?.url first.

Deterministic repro on origin/main (b020481e35c72c07183cec265dcde54e618e906a):

  1. Open a headless server preview tab, navigate/commit https://example.com/app?..., emit a renderer crash event (so reopenCrashedTab replaces the page with about:blank and preserves tab.crash), and invoke preview_status (operation: "status").
  2. Or run the extended crash regression case in apps/server/src/preview/ServerBrowser.test.ts:
    vp test run apps/server/src/preview/ServerBrowser.test.ts -t "a tab whose renderer crashes stays open instead of vanishing"
  • Observed on origin/main: status.url and status.loadError.url are the crashed URL (capped at 2048 chars), while status.tabs.find((entry) => entry.tabId === tabId)?.url is null.
  • Expected: status.tabs.find((entry) => entry.tabId === tabId)?.url matches status.url and status.loadError.url.

Change

Extracted a shared statusUrlOf(tab, loadError) helper in apps/server/src/preview/ServerBrowser.ts and used it for both status.url and each entry in status.tabs inside statusWithTitle, so loadErrorOf(candidate)?.url is always consulted before falling back from "about:blank" to null. ServerBrowser.ts is the only producer of PreviewAutomationStatus, so this covers all preview_status and automation status responses across web, desktop, and mobile agents; added assertions on status.url and status.tabs to the existing crash test in apps/server/src/preview/ServerBrowser.test.ts.

Scope

Small fix for an obvious bug; no issue needed under CONTRIBUTING.md.

Verification

  • Base failure (b020481e35c72c07183cec265dcde54e618e906a): vp test run apps/server/src/preview/ServerBrowser.test.ts -t "a tab whose renderer crashes stays open instead of vanishing" failed with AssertionError: expected null to be 'https://example.com/app?aaaaaaaaaaaaa…' at status.tabs?.find((entry) => entry.tabId === tabId)?.url (while status.url passed).
  • Head pass (b95b97940b1724cd90d1cdc8c1bea026a58b410a): The same targeted test passed (1 passed | 126 skipped).
  • Changed checks: vp env exec --node 26.13.1 vp run check:changed exited 0 (format, lint, knip, graphql, typecheck across 3 packages, and test across 2 files: 129 passed, including all 127 tests in ServerBrowser.test.ts).
  • Before/after transcript: https://gist.github.com/saphid/e0ba53397a47c4c4d3da4c02ce6b9239
  • Not shown: Manual live Chromium renderer crash in the full Electron desktop app; verified via ServerBrowser's real statusWithTitle / reopenCrashedTab path over PreviewAutomationBroker.

Authored by Gemini 4 Neon (Antigravity); reviewed by GPT-6.2 Sol (Codex).

Not shown

  • apps/server/src/preview/ServerBrowser.test.ts:2355 — The transcript exercises the real crash-recovery path with a simulated Playwright event and stops at the broker. Note that a live headless Chromium crash through the MCP endpoint was not run, and that reproducing the red test on base requires applying the two new assertions without the fix.
  • scripts/check-changed.ts:490 — The linked transcript contains the focused red/green runs, but not the reported check:changed exit on HEAD. Attach the HEAD-stamped check summary if available.
    1. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:trusted

    2. Approvability

      Verdict: Approved at be28a32

      Macroscope's review found this PR approvable — Preview status tab listings now retain the recorded crash URL when the renderer reports about:blank, matching top-level status behavior. The change is limited to status reporting and preserves existing thread scoping.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. tanstack-source added labelsbug

    4. Explain Change →

      No actionable comments were generated in the recent review.

      Walkthrough

      The browser status response now uses a shared helper to derive URLs for the active tab and listed tabs. Tests check that crashed-tab URLs are truncated to 2,048 characters.

      Changes: Browser status URL handling

      Layer / File(s)Summary
      Derive and report tab status URLs
      apps/server/src/preview/ServerBrowser.ts, apps/server/src/preview/ServerBrowser.test.ts
      A shared helper derives status URLs from load errors or page URLs. The active-tab and tab-list status paths use it. Tests assert that crashed-tab status and tab-list URLs are truncated to 2,048 characters.

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

      Change: Bug fix

      Suggested reviewers: juliusmarminge, tiliakoos

      Merge Risk: Minimal · up to be28a

      This change makes the preview status tab list keep the crashed page's URL after a renderer crash, matching the top-level status URL. The new test covers the blank replacement-page case. No merge-blocking risk remains.

      Pre-merge checks: Passed 4

      Check nameStatusExplanation
      Title checkPassedThe title names the fix (preview_status tabs list preserving the crashed URL after a renderer crash) and the affected area (server). The raw summary confirms the change: a shared statusUrlOf helper ma…
      Description checkPassedThe description follows the template's main sections: Problem, Change, Scope, and Verification. The Problem section gives the bug, the cause in statusWithTitle, and a deterministic repro with expected…
      Linked Issues checkPassedCheck skipped because no linked issues were found for this pull request.
      Out of Scope Changes checkPassedCheck skipped because no linked issues were found for this pull request.
      Full details: Title check

      Explanation

      The title names the fix (preview_status tabs list preserving the crashed URL after a renderer crash) and the affected area (server). The raw summary confirms the change: a shared statusUrlOf helper makes listed tabs report the load-error URL even when the page URL is about:blank. The title is specific and matches the main change, though its length (86 characters) is somewhat long.

      Full details: Description check

      Explanation

      The description follows the template's main sections: Problem, Change, Scope, and Verification. The Problem section gives the bug, the cause in statusWithTitle, and a deterministic repro with expected and observed behavior. The Change section explains the statusUrlOf helper and the test additions. Scope explains why no issue is linked. Verification lists the base-fail and head-pass runs, the check:changed result, and what was not tested. The template asks for before/after screenshots only for UI changes, which does not apply here. Two items remain open: the 'Not shown' notes flag a missing live headless Chromium crash run and a missing HEAD-stamped check:changed summary. The description also includes a stray t3-pr-hunter tracking comment and an unrelated 'Not shown' section at the end.

      Resolution

      Optional improvements: attach the HEAD-stamped check:changed summary, state the live headless Chromium crash that was not run, and remove the tracking comment and trailing 'Not shown' notes from the final description.

      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 43328e8f0a680a491c84995b398f5c635ff37a90 and be28a325d9c0a299d8fed8e44a6462da09fb4b14.

      Files selected for processing: 2

      • apps/server/src/preview/ServerBrowser.test.ts
      • apps/server/src/preview/ServerBrowser.ts

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

Sign in to join this conversation.