Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): preview navigation waits for the busy script to stop #30670

ClosedElliotDrel(GitHub profile, opens in a new tab)wants to merge 2 commits intofix/issue-28141 fromrefs/pull/30670/headopened View on GitHub

Depends on #28154, for #28141. This PR targets that PR's branch fix/issue-28141, so its diff is only the correction. It fixes the review finding in this thread.

What Changed and Why

Issue. When stopUnresponsiveScript got no answer to its probe, it sent Runtime.terminateExecution and resolved without waiting for a reply. The navigation could then start while the renderer was still running the page's script.

Why this change was necessary. A same-site navigation reuses the hung renderer, so it can only commit after the script has actually stopped. Chromium replies to the termination once the script stops.

New status quo. After the probe times out, evaluateOrTerminate waits up to 1s for the termination reply, and only inside the remaining budget. Agent navigation still passes its own timeout as the budget, and goto gets what is left, so the total time does not grow. Viewer controls default to a 1s probe plus a 1s reply window. A page that answers the probe is still never terminated. preview_evaluate behaves as before because its budget is already used up when it terminates.

Verification

Agent verification on Windows 11:

  • At correction head 1aa18f5b6e, the preview browser file passes 57 tests. Three helper cases use controlled native timers to assert acknowledgement/deadline ordering; no elapsed-time ceilings remain. Existing navigation tests retain total-budget coverage.
  • Targeted lint passes. Pre-commit formatting, lint and knip pass.
  • Server typecheck passed at original correction 6994c4e384; the later commit changes tests and a comment only.
  • Prior-head hosted lint and build/typecheck passed. Its aggregate CI failed in UsageService.test.ts (expected populated buckets, received an empty array), outside this patch; causation is not established. The updated head repeats that same usage failure. The exact clock-fixture fix is already merged in https://github.com/pingdotgg/t3code/pull/28603; the dependency branch needs a current-main integration. The Mobile Fingerprint Check run at this head completed successfully; its earlier action-required status is superseded.
  • Not checked: a real Chromium renderer, desktop CDP relay, or mobile.

Test correction and verification by gpt-6.1-sol through Codex in T3 Code. Claude Opus 5.5 (Claude Code) in T3 Code.

🤖 Generated with Claude Code

    1. chatgpt-codex-connector[bot](GitHub profile, opens in a new tab)commented

      Codex Review Summary

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

      ReviewStatusCommitReview trigger
      📝 Code Review✅ Completed 2026-11-04T06:44:34.970784Z6994c4ePR 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.

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

    3. Approvability

      Verdict: Needs Human Approval

      Macroscope's review found this PR requires human approval — Preview navigation now waits briefly for Chromium to acknowledge script termination. The default recovery window for viewer controls increases from one to two seconds, requiring human acceptance of that default timing change.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. 💡 Codex Review

      Here are some automated review suggestions for this pull request.

      Reviewed commit: 6994c4e384

      ℹ️ 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".

    5. Note

      🤖 gpt-6.1-sol responding on behalf of Elliot

      Withdrawn following the maintainer's protocol-ordering explanation: https://github.com/pingdotgg/t3code/pull/28154#discussion_r4464435644 . Our deferred fake demonstrated that the mock navigation started before acknowledgement; it did not establish a real Chromium failure. Termination is already sent before navigation, and the renderer cannot commit navigation while its script is still running. The extra acknowledgement deadline and viewer timing change are therefore unjustified. Closing this follow-up rather than carrying that machinery.

      The independent base-conflict resolution remains available at https://github.com/ElliotDrel/t3code/commit/bfab75e509bb58c3f2fc4c02d26b0b621bf1a9b3 and excludes this change. It includes main's merged usage-clock fixture fix; its focused preview and usage tests pass.

Sign in to join this conversation.