Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(desktop): allow slow backends to start before showing recovery #26247

Mergedshivamhwp(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/26247/headmerged by maria-rcks View on GitHub

A slow managed desktop backend could become ready just after the app opened "T3 Code could not start" at the 60-second limit. Allow three minutes for readiness, and connect immediately when the backend is ready. A stuck backend takes two extra minutes to show recovery diagnostics; crash-loop recovery is unchanged.

The reporter used macOS arm64. The Linux recording exercises the same probeReadiness and DEFAULT_BACKEND_READINESS_TIMEOUT in apps/desktop/src/backend/DesktopBackendManager.ts, with no macOS branch. This changes the wait, not database startup performance.

Closes https://github.com/pingdotgg/t3code/issues/26237

Evidence

Packaged Linux x64 desktop on physical corex. Before is main dac8b11ddc25bd5da62a367fdb6c3de777ae2986, version 0.1.3 and Electron 44.9.3. After is a fresh full build of current head b9cd74da540b4215a473ced3a8564c0c2f17e178, version 0.1.5 and Electron 44.10.0.

Each run launches an unchanged release AppImage with an isolated T3 home and Chromium profile on a dedicated Xvfb display. The fixture pauses the actual managed backend child with SIGSTOP for 70 seconds and resumes that same PID with SIGCONT. Readiness probes, authentication and the client run normally. No development server or mocked readiness endpoint is involved. The original 22 GB database workload was not recreated.

Before, main opens recovery at about 63 seconds and later connects:

https://github.com/user-attachments/assets/56f830da-6c21-41dc-afa5-b7ae05c8eb92

After, current head stays below the recovery threshold throughout the pause and connects after the same child resumes. The recording names the commit before launch and runs continuously through the connected client:

https://github.com/user-attachments/assets/53d5eaf8-23b3-413c-97e9-189bfead3b01

Main opens recoveryCurrent head connects
Premature recovery on mainConnected packaged current head

Validation

CI on current head passed all 9 DesktopBackendManager.test.ts tests and 203 desktop tests overall. Required checks pass, with path-filtered jobs skipped. The regression covers readiness at 66 seconds without failure, no failure at 179 seconds, and timeout reporting at 180 seconds. Independent code review has no open findings. Macroscope requests human review of the longer wait before recovery feedback.

Build and runtime output for the new recording

Boat job j_icntbfk6jgkorbm2wom2, stage packaged-startup-b9cd74d, default machine, t3code template, attempt 1, VM bx_3h6vh87p, exit 0, pinned to b9cd74da540b4215a473ced3a8564c0c2f17e178:

vp i --frozen-lockfile
T3CODE_WEB_SOURCEMAP=0 vp run dist:desktop:artifact --platform linux --target AppImage --arch x64 --output-dir out/build

AppImage SHA-256, verified after download on corex:

13c8d30518bf7efadb4c8e780528a6c52a81ebae98141a7ac2dbd6612ad08a0a

The new recording is a continuous 97.13-second H.264 MP4, 1280 × 960 at 15 fps. Elapsed times below start at fixture setup, about one second before video capture; they are not a startup performance comparison.

 3.054s launched packaged AppImage, PID 1805848
 5.468s paused real managed backend for 70 seconds, PID 1806199
66.531s past former 60-second budget; no recovery window
75.539s resumed same managed backend, PID 1806199
77.746s backend ready and client window created; no recovery window
97.930s verified no readiness failure or recovery event

[21:52:04.989] INFO (#1): bootstrap backend start requested
[21:53:17.155] INFO (#189): backend ready
[21:53:17.260] INFO (#189): main window created

Current-head CI ran vp test run --passWithNoTests in apps/desktop:

src/backend/DesktopBackendManager.test.ts (9 tests) 509ms
Test Files 30 passed (30)
Tests 203 passed (203)

Implemented by Claude Opus 5.5 through Claude Code. Reviewed and verified by GPT-6.1-Sol through Codex in T3 Code.

    1. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Needs Human Approval

      Macroscope's review found this PR requires human approval — The desktop backend gets three minutes rather than one to become ready before timeout-based recovery reporting. Human review is required for this product-default change and its tradeoff between accommodating slow startup and delaying recovery feedback.

      No code changes detected at b9cd74d. Prior analysis still applies.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    2. 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 93a9e079b107a13b0c312920b917b5f61a8f720c and 21cefe874af40566bf0ab3c1b49c7af3a769613a.

      Files selected for processing: 2
      • apps/desktop/src/backend/DesktopBackendManager.test.ts
      • apps/desktop/src/backend/DesktopBackendManager.ts

      Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 8 remain after this review.

      Walkthrough

      The desktop backend readiness timeout increases from one minute to three minutes. A timing test checks late readiness and confirms that a backend still unavailable after three minutes reports a startup timeout.

      Changes: Backend readiness

      Layer / File(s)Summary
      Readiness window and timing tests
      apps/desktop/src/backend/DesktopBackendManager.ts, apps/desktop/src/backend/DesktopBackendManager.test.ts
      The default readiness timeout increases to three minutes. Tests verify that readiness after 66 seconds does not report a startup failure and that continued unavailability through 180 seconds reports a timeout.
      Priority: Normal

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

      Change: Bug fix · Severity of issue fixed: Low

      Possibly related issues

      • pingdotgg/t3code#23372 describes a desktop backend that remains unready during startup recovery. This change extends the readiness window but does not address startup that exceeds three minutes.
      • pingdotgg/t3code#26200 reports a WSL backend readiness timeout. This change extends the same readiness window, but does not address the separate port-release race.
      • pingdotgg/t3code#23877 reports readiness timeouts during slow cleanup and startup. This change extends the timeout but does not address the reported post-start issues.

      Possibly related PRs

      • pingdotgg/t3code#21780: Adds desktop startup behavior that waits for backend readiness; this PR changes the readiness timeout used by that flow.
      • pingdotgg/t3code#25903: Reports backend startup failures through recovery when the backend misses readiness; this PR changes when that failure can occur.
      • pingdotgg/t3code#26063: Handles WSL startup failures tied to backend readiness; this PR extends the desktop manager’s default readiness window.

      Suggested reviewers: t3dotgg, juliusmarminge, macroscopeapp

      Merge Risk: Minimal · up to 21cef

      The longer startup window allows slow backends more time to become ready. No merge-blocking risk remains.

      Pre-merge checks: Passed 4
      Check nameStatusExplanation
      Title checkPassedThe title clearly and concisely describes the main change: extending desktop backend startup time before showing recovery.
      Linked Issues checkPassedIssue #26237 asks that a backend that becomes ready shortly after the fixed 60 s readiness budget not be reported as a failed start. It allows either a larger budget or a late success that replaces th…
      Out of Scope Changes checkPassedThe reviewed diff between merge base df4132b0404a3850eec7fb0a72592b7682cd952f and head 21cefe874af40566bf0ab3c1b49c7af3a769613a changes only two files. DesktopBackendManager.ts changes one constant, a…
      Description checkPassedThe description is complete and follows the repository template. It explains the problem, implementation, scope, linked issue, verification results, runtime evidence, limitations, and tool-assisted re…
      Full details: Linked Issues check

      Explanation

      Issue #26237 asks that a backend that becomes ready shortly after the fixed 60 s readiness budget not be reported as a failed start. It allows either a larger budget or a late success that replaces the failure state. The change at head sets DEFAULT_BACKEND_READINESS_TIMEOUT from Duration.minutes(1) to Duration.minutes(3) in apps/desktop/src/backend/DesktopBackendManager.ts. The new test in DesktopBackendManager.test.ts covers the reported case: a backend that returns 503 until 66 s and then returns 200 produces no startup failure report. The same test shows a never-ready backend produces no report at 179 s and the failure report at 180 s. Per-request timeout, probe interval, and crash-loop handling are unchanged in the diff. The issue's stated database startup cost is not reduced. The issue does not require that. Related reports #26200 and #24895 are contextual and are not coding requirements of this PR. Non-coding verification (macOS fixture, recordings) does not affect this verdict.

      Full details: Out of Scope Changes check

      Explanation

      The reviewed diff between merge base df4132b0404a3850eec7fb0a72592b7682cd952f and head 21cefe874af40566bf0ab3c1b49c7af3a769613a changes only two files. DesktopBackendManager.ts changes one constant, and adds a comment that explains the new value. DesktopBackendManager.test.ts adds one regression test for readiness timing at 66 s, 179 s, and 180 s. Both changes directly implement the readiness-budget objective in #26237. No unrelated code, configuration, or dependency changes appear in the reviewed diff. The PR description references images and recordings, which are not repository changes.

      Full details: Description check

      Explanation

      The description is complete and follows the repository template. It explains the problem, implementation, scope, linked issue, verification results, runtime evidence, limitations, and tool-assisted review details.

      Finishing Touches
      📝 Generate docstrings
      • Commit to this branch
      • Create a new PR
      🧪 Generate unit tests (beta)
      • Commit to this branch
      • 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.
    3. maria-rckscommented

      Note

      Written by gpt-6.1-sol on behalf of Maria

      Verified in a real dev environment

      verified unchanged head b9cd74da540b4215a473ced3a8564c0c2f17e178 on this linux x64 boat vm. reproduced the original failure on github/main at 15fe2832727893cbdd2214383f9f971474849695 in a separate worktree first.

      ran vp i in both checkouts and vp run dev in the background, one server at a time. drove the web app with the repository’s playwright and /usr/bin/google-chrome. created startup-verification as a real local git project through the app, selected codex gpt-6.1-sol, and completed a real provider turn running git status --short (exit 0).

      then stopped the web dev server and launched each checkout’s actual electron shell with its built server, isolated state, and no mocked readiness endpoint. paused the actual managed backend child with SIGSTOP for 70 seconds, then resumed that same pid with SIGCONT. the desktop readiness probes, authentication, client and provider ran normally. used --password-store=basic for the disposable profile to avoid a linux keyring prompt.

      • main opened "T3 Code could not start" at the 60-second readiness limit, then connected after the backend resumed.

      • the pr had no recovery window at 66 seconds, resumed its backend at 70.523 seconds, and loaded the real client at 73.875 seconds.

      • after that delayed startup, opened the persisted thread in the desktop client and sent a second codex gpt-6.1-sol turn. it ran git rev-parse --is-inside-work-tree, returned true with exit 0, and displayed "desktop startup verification passed." without a reload.

      • normal startup connected immediately when ready: backend start requested at 19:14:19.154, ready at 19:14:20.338, main window created at 19:14:20.376. this confirms the three minutes are a ceiling, not a forced wait.

      • a backend held unavailable for 190 seconds still had no recovery window at 179.008 seconds, then opened recovery at 180.518 seconds. the recovery diagnostics remain reachable at the new limit.

      both desktop runtime builds passed through blacksmith. the pr’s existing DesktopBackendManager.test.ts suite passed all 9 tests through blacksmith. no source changes or pushes were needed. cafe reports 33 successful checks on this head.

      short runtime transcript:

      main:
      19:06:45.104 bootstrap backend start requested
      19:07:45.138 startup recovery window shown
      70.606s resumed same backend
      19:07:56.314 backend ready
      
      pr:
      66.002s open desktop windows=[]; recovery=false
      70.523s resumed same backend
      19:13:18.090 backend ready
      73.875s client loaded
      pr held unavailable:
      179.008s open windows=[]
      180.518s recovery appeared: T3 Code could not start
      
      codex gpt-6.1-sol: git rev-parse --is-inside-work-tree -> true, exit 0

      before: main’s premature recovery.

      main opens recovery after 60 seconds

      after: the pr’s real desktop client after delayed startup and a real codex turn.

      pr desktop connects and completes the real codex turn

      50-second recording, rendered as an animated gif for github: the former timeout passes without recovery, the resumed backend connects, then the desktop client completes its provider turn. inspected the exported clip and verified uploaded playback and seeking.

      delayed desktop startup and real codex turn

      Not verified

      macos arm64, windows/wsl, native ios/android, remote relay/tunnel, and the reporter’s 22 gb database workload were not exercised. the controlled process pause proves readiness handling, not database startup performance. this was the locally built electron shell, not an installed release artifact. the first web turn’s persisted reply was confirmed after reloading; live delivery was separately confirmed in the desktop turn.

    4. maria-rcks merged this01eb339

    5. maria-rcks closed this

Sign in to join this conversation.