Files
t3code/apps
Josh Gratton 6bf864d277 fix(web): timeout each WSL register attempt + expose reconciler trace
Two issues from a fresh cold-start launch:

1. The first register attempt hit ERR_CONNECTION_REFUSED (WSL not
   listening yet), surfaced as Failed to fetch, and then no retries
   fired. Most likely a registration step hung past the descriptor
   fetch (IPC bearer read, WS open, etc) so the per-instance pending
   promise never resolved, which kept reconcileOnce awaiting forever
   and left pendingReconcileRun wedged for every subsequent retry
   tick. Wrap each attempt in a 25s hard ceiling via Promise.race so
   a stuck step is force-rejected, the catch wrapper logs it, and the
   scheduleAutoRetry chain keeps progressing.

2. Production renderers don't have CDP, so when the silent failure
   above happened there was no way to inspect what state the reconciler
   was actually in. Expose window.__t3LocalSecondaryDebug with two
   methods:
     - getState() returns the most recent bootstraps list, per-instance
       registration errors, last reconcile timestamp, and attempt count.
     - retryNow() re-fires the reconcile loop on demand.
   Wrapped behind exposeDebugGlobal() so non-browser environments
   (vitest under node) don't poison globalThis.

Also wrapped the IPC call to getLocalEnvironmentBootstraps in a
try/catch with logging, in case the bridge throws during a startup
race.
2026-05-18 09:53:31 -04:00
..