Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: pingdotgg/t3code
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: main
Choose a base ref
...
head repository: Entrpi/t3code
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: fix/preview-host-timeout-eviction
Choose a head ref
Checking mergeability… Don’t worry, you can still create the pull request.
  • 1 commit
  • 3 files changed
  • 1 contributor

Commits on Nov 8, 2026

  1. fix(server): one slow preview request no longer cuts off the browser …

    …for every thread
    
    When a preview automation request got no answer within its timeout plus
    the 1 s grace, PreviewAutomationBroker evicted the host: it removed the
    host from routing, deleted every thread's current-tab lease on that
    queue, failed every other in-flight request with "client disconnected"
    (while those actions were still running in the browser), and ended the
    host stream. The only host on main is the in-process server browser, so
    one slow tab gave every thread about 1 s of "No preview automation host
    is available" until the ServerBrowser reconnect loop re-registered, and
    wiped every thread's lease, so a later call without a tabId could land
    on a different tab. A tab that kept timing out repeated the outage.
    
    The eviction came from transport-backed desktop/web hosts (#11381,
    #12535), whose connection could really be dead. #15328 removed those
    WS host RPCs and exempted metadata reads, but left the eviction in place
    for the in-process host. That host cannot lose its connection and forks
    a fiber per request, so a missing answer only ever means one slow
    operation on one tab. Eviction also never cancelled the running
    Playwright work.
    
    The broker now skips the disconnect on a response timeout when the host
    is the server browser (the clientId check the file already uses for
    that host). The timed-out call still fails with
    PreviewAutomationTimeoutError and the same text; other threads keep
    their pending requests, their leases and their routing. Any other
    clientId keeps today's eviction. The ServerBrowser reconnect comment is
    reworded, since timeouts no longer end the stream; the loop stays as a
    self-heal.
    
    The new broker test gives two threads distinct leases, lets one click
    time out under TestClock, and checks that the other thread's in-flight
    snapshot still completes and the first thread's next implicit request
    still routes to its tab. On main the other snapshot fails with
    PreviewAutomationClientDisconnectedError.
    
    User story: When one preview tab is slow, my other threads' agents keep using their browser tabs without getting "disconnected" or "no preview host" errors.
    Entrpi committed Nov 8, 2026
    Configuration menu
    Copy the full SHA
    4297bf6 View commit details
    Browse the repository at this point in the history
Loading