fix(preview): Return Request Timeouts Without Disconnecting Other Agents #23564
main fromrefs/pull/23564/head·opened View on GitHubA 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.tsandSessionControl.test.ts. - Scoped formatting, lint, server typechecking and GraphQL generation checks pass.
- The Windows
check:changedwrapper 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
github-actions[bot](GitHub profile, opens in a new tab) added labelssize:S
macroscopeapp[bot](GitHub profile, opens in a new tab) approved these changes
No actionable comments were generated in the recent review.
Recent review info-
Run configuration-
- Source mode: Auto
- Repository: pingdotgg/t3code
- Branch: main
- File: .coderabbit.config.ts
- Commit: e923627
- Layers: Repository TS config
- Review profile: CHILL
- Plan: Advanced
- Run ID:
3346366b-acc9-46c1-b828-d4e9d733df0c
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.tsapps/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
-
handleRequestnow appliesrequest.timeoutMsand returns aPreviewAutomationTimeoutErrorwhen 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
Priority:Layer / File(s) Summary Apply and verify request deadlines
apps/server/src/preview/ServerBrowser.ts,apps/server/src/preview/ServerBrowser.test.tshandleRequestreturnsPreviewAutomationTimeoutErrorwhen a request exceeds its timeout. Tests check continued access by another agent and confirm an expired queued navigation is not replayed. NormalEstimated 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:
bugfixSuggested reviewers:
juliusmarminge
Merge Risk:
Minimal · up tocad23-
The change appears ready to merge after normal checks. A stalled request can time out without starting an expired queued action.
Pre-merge checks:
4-
Check name Status Explanation Title check The title clearly and concisely describes the main change: returning preview request timeouts without disconnecting other agents. Description check 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 in… Linked Issues check Check skipped because no linked issues were found for this pull request. Out of Scope Changes check Check 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
-
juliusmarminge closed this
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.
Approvability#
Verdict: Approved at
a618bcfMacroscope'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).