Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(desktop): browser tabs no longer log a spurious Electron sandbox error #15026

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

Problem

Some new browser tabs log Electron sandboxed_renderer.bundle.js script failed to run and TypeError: Cannot destructure property 'preloadScripts' of 'binding.startupData' as it is null., and preview_snapshot returns both in consoleEntries. The page works, but an agent looking for console errors reads them as the page's. It is Electron bug electron/electron#54149: browser automation attaches the debugger to a sandboxed guest before its first navigation commits, and Electron 44.4.2 runs the sandbox bundle on that initial empty document.

Change

Bumps desktop from Electron 44.4.2 to 44.4.5. The fix (electron/electron#54155) shipped in 44.4.4; 44.4.5 is the latest 44.x patch and keeps the same Chromium 152.0.7977.130, Node 24.21.0, V8 15.2.124.28 and module ABI 149, so node-abi 4.33.0 still applies. The minimumReleaseAgeExclude entry follows the pin, and the lockfile changes only the Electron entries. The 44.4.3 to 44.4.5 release notes contain only patch fixes and upstream backports. 44.5.x is a minor release with new features and unrelated fixes, so this stays on the 44.4.x patch the triage named.

Scope and approval

Triaged bug #13990. Julius's triage confirms the failure on de251fc and names this bump as the fix: https://github.com/pingdotgg/t3code/issues/13990#issuecomment-5859074154

Closes #13990

Verification

  • Before and after on the exact error. A standalone Electron script (below) uses the trigger from Electron's own regression test in electron/electron#54155: a sandboxed window is kept on its initial empty document, then the debugger attaches and enables Log and Runtime, as PreviewManager.ensureControlSession does. Five runs each on macOS:
    • 44.4.2: every run records both errors, through console-message and Runtime.consoleAPICalled.
    • 44.4.5: no run records either error. In both versions the page that commits afterwards loads and its own console.log arrives.
  • The app still works. In a fresh worktree, vp i installs 44.4.5. vp run --filter @t3tools/desktop typecheck passes, and vp test run src/preview in apps/desktop passes 342 tests. vp run dev:desktop boots the dev app on the 44.4.5 runtime to app ready, with no errors in the desktop trace.
  • Not checked: preview_snapshot inside the dev app itself, the packaged desktop artifact (CI builds it), and Windows or Linux. The original report is from Linux; Electron's fix is in platform-independent renderer code.
Repro script

Run with npx electron@44.4.2 main.js and npx electron@44.4.5 main.js.

// Deterministic repro for pingdotgg/t3code#13990 (electron/electron#54149),
// using the trigger from Electron's own regression test in electron/electron#54155:
// keep a sandboxed frame on its initial empty document, attach the DevTools
// protocol the way PreviewManager.ensureControlSession does, and collect what
// the debugger session and the console report.
const http = require("node:http");
const { app, BrowserWindow } = require("electron");

const PATTERN = /failed to run|startupData|sandbox_bundle/;

setTimeout(() => {
  console.error("watchdog timeout");
  app.exit(2);
}, 60000);

app.on("window-all-closed", () => {});

app.whenReady().then(async () => {
  const server = http.createServer((req, res) => {
    if (req.url === "/redirect") {
      res.writeHead(302, { Location: "/page" });
      res.end();
    } else {
      res.end("<html><body><script>console.log('page log')</script></body></html>");
    }
  });
  await new Promise((resolve) => server.listen(0, "127.0.0.1", resolve));
  const base = `http://127.0.0.1:${server.address().port}`;

  const win = new BrowserWindow({ show: false, webPreferences: { sandbox: true } });
  const wc = win.webContents;
  const entries = [];
  wc.on("console-message", (event) => entries.push(`console-message: ${event.message}`));

  // Cancel the first navigation before it commits, so the frame stays on its
  // initial empty document, which never receives startup data.
  wc.once("will-redirect", (event) => event.preventDefault());
  await wc.loadURL(`${base}/redirect`).catch(() => {});

  wc.debugger.attach("1.3");
  wc.debugger.on("message", (_event, method, params) => {
    if (method === "Runtime.consoleAPICalled")
      entries.push(`${method}: ${params.args.map((a) => a.value ?? a.description).join(" ")}`);
    else if (method === "Runtime.exceptionThrown")
      entries.push(`${method}: ${params.exceptionDetails.exception?.description ?? params.exceptionDetails.text}`);
    else if (method === "Log.entryAdded") entries.push(`${method}: ${params.entry.text}`);
  });
  await wc.debugger.sendCommand("Log.enable");
  await wc.debugger.sendCommand("Runtime.enable");
  const { result } = await wc.debugger.sendCommand("Runtime.evaluate", { expression: "location.href" });
  const emptyDocumentHref = result.value;

  // The document that commits afterwards still loads normally.
  await wc.loadURL(`${base}/page`);
  await new Promise((resolve) => setTimeout(resolve, 300));

  const { electron, chrome, node, v8 } = process.versions;
  const spurious = entries.filter((e) => PATTERN.test(e)).map((e) => e.split("\n")[0]);
  console.log(
    JSON.stringify(
      {
        electron,
        chrome,
        node,
        v8,
        emptyDocumentHref,
        spuriousErrors: spurious,
        pageLogSeen: entries.some((e) => e.endsWith("page log")),
      },
      null,
      2,
    ),
  );
  win.destroy();
  server.close();
  app.quit();
});

Claude Opus 5.5 via T3 Code

    1. Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Approved at 31f0a6a

      Macroscope's review found this PR approvable — This is a narrowly scoped Electron patch upgrade that fixes a documented sandbox error in existing browser-tab automation while preserving the same major/minor runtime line. The accompanying lockfile and install-policy changes are mechanical, with no new capability, schema change, deployment change, or diagnostic suppression.

      Notes:

      • Diff unchanged. Approvability was decided on eligibility alone.
      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. Review in Change Stack →

      Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

      No actionable comments were generated in the recent review. 🎉

      ℹ️ Recent review info
      ⚙️ Run configuration
      • Configuration used: Repository: pingdotgg/t3code/.coderabbit.yaml
      • Review profile: CHILL
      • Plan: Advanced
      • Run ID: a8c13353-7224-41fb-91b5-8d3dbb6d61ca
      📥 Commits

      Reviewing files that changed from the base of the PR and between 9333509c918083cbfb7e66759ddbcbfa71a3a452 and 31f0a6a094021d08e0b40985c91dc9711e9d6e50.

      ⛔ Files ignored due to path filters (1)
      • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
      📒 Files selected for processing (2)
      • apps/desktop/package.json
      • pnpm-workspace.yaml

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


      📝 Walkthrough

      Walkthrough

      Electron changes from version 44.4.2 to 44.4.5 in the desktop dependency and in the workspace minimum release age exclusion.

      Changes

      Electron patch update

      Layer / File(s)Summary
      Update Electron version
      apps/desktop/package.json, pnpm-workspace.yaml
      The desktop dependency and the minimum release age exclusion change from Electron 44.4.2 to 44.4.5.

      Priority: ⬇️ Low

      Estimated code review effort: 1 (Trivial) | ~5 minutes

      Change: Bug fix · Severity of issue fixed: Low

      Suggested reviewers: juliusmarminge

      Merge Risk: ⚪ Minimal · up to 31f0a

      The dependency update and its lockfile and release-age configuration are aligned; no concrete merge risk remains.

      Architecture Summary

      Architecture risk: 🔵 Low · up to 31f0a

      The change affects 2 systems.

      Changed systems: apps/desktop, pnpm-workspace.yaml

      Architecture concerns No architecture-level concerns identified.

      Review details

      Systems and components

      • observed — apps/desktop (service) was modified; 1 changed file maps to changed impact.
      • observed — pnpm-workspace.yaml (service) was modified; 1 changed file maps to changed impact.

      Before / after behavior

      • observed — Modified behavior in apps/desktop/package.json: The electron dependency version changed from 44.4.2 to 44.4.5.
      • observed — Modified behavior in pnpm-workspace.yaml: The electron version excluded from the minimum release age changes from 44.4.2 to 44.4.5.
      🚥 Pre-merge checks | ✅ 4 | ❓ 1

      ❌ Failed checks (1 inconclusive)

      Check nameStatusExplanationResolution
      Out of Scope Changes check❓ InconclusiveThe visible Electron pin and minimumReleaseAgeExclude update support [#13990]. The PR description says the lockfile changes only Electron entries, but pnpm-lock.yaml is excluded by `!**/pnpm-lock.…Reviewable evidence of the pnpm-lock.yaml changes is needed to determine whether all changes in that excluded file support the Electron update.
      ✅ Passed checks (4 passed)
      Check nameStatusExplanation
      Title check✅ PassedThe title clearly describes the main change: preventing spurious Electron sandbox errors in browser tabs.
      Description check✅ PassedThe description covers the problem, change, scope and approval, and verification. It also states which checks were not performed and includes a focused reproduction script.
      Linked Issues check✅ PassedIssue [#13990] expects preview console output to exclude Electron sandbox startup errors. The PR updates apps/desktop/package.json from Electron 44.4.2 to 44.4.5, the version identified by the issue…
      Docstring Coverage✅ PassedNo functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
      Full details: Out of Scope Changes check

      Explanation

      The visible Electron pin and minimumReleaseAgeExclude update support [#13990]. The PR description says the lockfile changes only Electron entries, but pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml and is not represented in the change summary. I cannot verify whether that file contains unrelated changes.

      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create a new PR
      • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

      Comment `@coderabbitai help` to get the list of available commands.
    5. juliusmarminge added labelsmacroscope-review

    6. Note

      Grok responding on behalf of Julius.

      Closing as superseded. #16961 already landed the Electron 44.4.2 → 44.4.5 bump and closed #13990.

    7. juliusmarminge closed this

Sign in to join this conversation.