Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(preview): Return Request Timeouts Without Disconnecting Other Agents #23564

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

A stalled server-browser request can outlive its deadline and cause the broker to disconnect the shared host. Other agents then lose their pending requests and browser access.

Bound the complete request handler by request.timeoutMs so it returns the existing typed timeout before the broker evicts the host. Ownership checks and the serial tab queue stay in place. A started action may still finish after its timeout; expired queued actions cannot start later.

This uses the focused obvious-bug exception in CONTRIBUTING.md. It enforces the existing deadline without adding a recovery workflow or changing product defaults. Related #23107 covers timeout diagnostics and recovery instructions separately.

Validation against main e9236274a3a6e0c731a7df4092db1e686f039068:

  • The two regressions fail on the unmodified handler. They cover another agent's pending request surviving a stalled operation and an expired queued navigation never running later.
  • All 64 tests pass across ServerBrowser.test.ts, PreviewAutomationBroker.test.ts and SessionControl.test.ts.
  • Scoped formatting, lint, server typechecking and GraphQL generation checks pass.
  • The Windows check:changed wrapper stalls in its ignored-file cache-key scan. That invocation was interrupted; its result is not a pass. Applicable checks were run directly.

The rebase preserves upstream's new desktop-focus and navigation-timeout tests. Installed-app acceptance is separate; this PR contains the timeout rather than diagnosing every stalled navigation or snapshot.

Prepared with GPT-6.1-Sol through the Codex harness in T3 Code.

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

    2. Approvability

      Verdict: Approved at a618bcf

      Macroscope's review found this PR approvable — This is a small, localized preview bug fix that enforces the existing request deadline and prevents a stalled tab from disconnecting the shared browser host. Regression tests cover both preservation of another agent's request and suppression of expired queued navigation.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    3. coderabbitai[bot](GitHub profile, opens in a new tab)commented
      Review in Change Stack →

      No actionable comments were generated in the recent review.

      Recent review info
      Run configuration
      Commits

      Reviewing files that changed from the base of the PR and between a618bcffe9a7132d2dae716240a42ebb1accf989 and cad23730603b7895f76678fb2b7307e662e4cc80.

      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; 9 remain after this review.

      Walkthrough

      handleRequest now applies request.timeoutMs and returns a PreviewAutomationTimeoutError when a request exceeds its deadline. Tests cover a stalled navigation while another agent remains usable and a queued navigation that expires before execution.

      Changes: Preview request timeouts

      Layer / File(s)Summary
      Apply and verify request deadlines
      apps/server/src/preview/ServerBrowser.ts, apps/server/src/preview/ServerBrowser.test.ts
      handleRequest returns PreviewAutomationTimeoutError when a request exceeds its timeout. Tests check continued access by another agent and confirm an expired queued navigation is not replayed.
      Priority: Normal

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

      Change: Bug fix

      Possibly related issues

      • pingdotgg/t3code#16921 — Addresses the objective of preventing timed-out preview actions from evicting the shared browser host or disrupting other requests.
      • pingdotgg/t3code#8732 — Addresses timeout behavior when navigation can complete after the caller times out.

      Possibly related PRs

      • pingdotgg/t3code#24356 — Preserves the navigation timeout through the broker, which connects to this change’s request timeout handling.
      • pingdotgg/t3code#23107 — Uses a typed timeout while preserving the browser connection, a closely related timeout-recovery path.
      • pingdotgg/t3code#24523 — Changes timeout eviction and capture serialization to keep the browser connection usable after a stalled snapshot.

      Suggested labels: bugfix

      Suggested reviewers: juliusmarminge

      Merge Risk: Minimal · up to cad23

      The change appears ready to merge after normal checks. A stalled request can time out without starting an expired queued action.

      Pre-merge checks: Passed 4
      Check nameStatusExplanation
      Title checkPassedThe title clearly and concisely describes the main change: returning preview request timeouts without disconnecting other agents.
      Description checkPassedThe description covers the problem, change, scope approval exception, related issue, focused verification, observed results, limitations, and agent attribution. It also reports an interrupted check in…
      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: Description check

      Explanation

      The description covers the problem, change, scope approval exception, related issue, focused verification, observed results, limitations, and agent attribution. It also reports an interrupted check instead of presenting it as passing.

      Finishing Touches
      🧪 Generate unit tests (beta)
      • Create a new PR
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
      Comment `@coderabbitai help` to get the list of available commands.
    4. juliusmarminge closed this

    5. Thanks @ajpemok for the earlier work on keeping other agents connected when a browser request stalls. Closing this as a duplicate of #32866 by @juliusmarminge, which bounds the same handler deadline and covers stuck-tab recovery too. This branch has not been updated in over a week while main has changed the affected files.

Sign in to join this conversation.