PR 5769 · CHANGES REQUESTED · HIGH CONFIDENCE
Three reproducible cache failures make PR 5769 unsafe to merge
The exact f2ce5ce head passes formatting, lint, typechecking, and its new text-level tests. After a full wsl --shutdown, a representative update reached backend readiness in 7.373 s. The second and third connections took 2.542 s and 2.538 s. The speedup is real, but WSL 2 runs still accept a mismatched archive identity, reuse a cache after its native payload disappears, and delete active runtime directories during cross-version pruning. I recommend changes before merge.
Connection speed chart
Cold WSL update to backend readiness · median of 10 sequences
Source: 10 update sequences in Ubuntu WSL 2. Each first connection followed wsl --shutdown; shutdown time is excluded. Payload: 1,222 files, 180.356 MB uncompressed, 45.170 MB compressed. Raw readiness rows; method and ranges.
Decision
Recommended decision: request changes. The speedup can stay, but the cache needs verified identity, repair or fallback after a failed native probe, and lifetime leases that keep pruning away from running backends.
These findings come from the generated scripts in the PR, executed inside Ubuntu on WSL 2 with an isolated HOME under /tmp. The harness removed its fixture afterward. It did not touch the nightly instance, its ports, its database, or ~/.t3/runtime.
Findings
| Priority | Failure | Observed result | User impact |
|---|---|---|---|
| High | Archive identity is trusted, not verified | aaaa...aaaa was accepted while the archive hashed to 2ddfa9...565f | Changed or corrupt bytes can be installed and cached under the wrong identity. |
| High | Broken native payload remains ready | The second install exited 0 after pty.node and the source archive were deleted | Every restart selects the same broken cache, then WSL preflight fails without repair or mounted-tree fallback. |
| High | Pruning has no active-runtime lease | Prune for active A deleted B; prune for active B then deleted A, in 30 of 30 runs | Stable, nightly, or two app versions sharing a distro can delete files used by another running backend. |
Source: Ubuntu WSL 2, exact generated install and prune scripts from DesktopWslEnvironment.ts, executed 2026-08-20.
1. Verify the archive before assigning its cache identity
DesktopBackendConfiguration.ts lines 526-550 parse the sidecar as 64 hex characters and use it in runtimeId. No code hashes the archive and compares the result. The installer therefore treats the sidecar as a claim, not a check.
# Reproduced result
claimed=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
actual=2ddfa9b013dd5c3b7a7310238c757fc33e68e6ddb46766f3bd5bb27f112e565f
install_exit=0
Source: real sha256sum and the PR's generated install script in Ubuntu WSL 2.
2. Repair or bypass a cache whose native probe fails
DesktopWslEnvironment.ts lines 262-265 call a runtime ready when the marker, server entry, and node-pty/package.json exist. The actual pty.node file is not checked. Later, DesktopBackendConfiguration.ts lines 358-368 turn a failed native probe into a preflight failure. They do not invalidate the staged cache, reinstall once, or fall back to the mounted server tree.
# Reproduced after deleting pty.node and the source archive
second_install_exit=0
ready-marker-present=true
native-payload-present=false
Source: the same installed fixture, then a second execution of the exact generated install script.
3. Keep a lease for the full lifetime of each backend
DesktopWslEnvironment.ts lines 311-340 preserve only the caller's current cache and the newest previous cache. DesktopBackendManager.ts lines 948-956 prune after readiness, but the running process holds no lease that another app instance can observe.
With active A and B plus newer C, A keeps A and C and deletes B. B then keeps B and C and deletes A. A global prune lock would serialize this sequence but would not make it safe. Pruning must skip every runtime with a live usage lease.
What needs to change
| Area | Required behavior | Acceptance test |
|---|---|---|
| Identity | On a cold install, stream the archive through SHA-256 and compare it with the parsed sidecar before extraction. Reject a mismatch and use the mounted-tree fallback. | A valid 64-hex sidecar paired with different archive bytes never reaches prepareRuntime or extraction. |
| Recovery | Treat the native load probe as authoritative. If a staged cache fails it, invalidate that cache and retry a verified install once. If retry fails, launch from the mounted server tree for this run. | Delete or corrupt pty.node; the next launch repairs the cache or starts through the fallback without manual cleanup. |
| Leases | Hold a kernel-backed shared lease for each backend's lifetime. Pruning takes a nonblocking exclusive lease per candidate and skips leased caches. Serialize prune selection as well. | Run two versions against one distro, add a third cache, and prune from both. Both active directories remain until their backends exit. |
| Tests | Execute the generated POSIX scripts with a temporary HOME, small tar fixture, concurrent installers, corruption cases, and concurrent pruning. Stop pinning only literal script text. | The three reproductions in this report fail before the fix and pass after it on Linux CI or WSL. |
Source: review of the exact head plus WSL executions. The lease design uses flock, already required by the install path.
Connection measurements
Ten simulated updates used the PR's generated install script, a 45.170 MB compressed runtime, the Linux node-pty probe, WSL IP discovery, the real server process, and /.well-known/t3/environment as the stop condition. Before every first connection, the harness called wsl --shutdown and selected a new runtime ID. The second and third connections reused that runtime and live VM. Server data persisted across update sequences.
| Connection | Readiness total | Install step | Probe + IP | Backend step | Runs |
|---|---|---|---|---|---|
| First-ever install, cold WSL | 7.517 s | 4.739 s | 0.436 s | 2.273 s | 1 |
| First after update, cold WSL | 7.373 s median 7.178-7.669 s | 4.687 s | 0.417 s | 2.267 s | 10 |
| Second, warm WSL | 2.542 s median 2.519-2.733 s | 0.087 s | 0.195 s | 2.249 s | 10 |
| Third, warm WSL | 2.538 s median 2.518-2.556 s | 0.089 s | 0.189 s | 2.255 s | 10 |
Source: 33 readiness rows. Medians use the average of the fifth and sixth sorted values. Totals start immediately before the Windows-side wsl.exe install invocation and stop at HTTP readiness. Shutdown and teardown are excluded.
The second connection was 4.831 s faster than the cold post-update connection, a 65.5% reduction. The second and third medians differ by 0.004 s, which is noise. A separate no-op control measured WSL boot alone at 4.008 s median across 10 shutdown cycles. That accounts for about 83.0% of the cold-to-warm gap. The remaining difference includes archive extraction and slower cold preflight.
Source: 10 boot-only controls. Each run called wsl --shutdown, then timed wsl.exe -d Ubuntu --exec true. Shutdown duration is excluded.
Scope: this is a shutdown-to-backend-readiness benchmark, not a click-to-render Electron measurement. It exercises the implementation under review with the real server and readiness endpoint.
Verification record
| Check | Result | Notes |
|---|---|---|
pnpm fmt:check | Pass | 2,718 files checked in 17.588 s. |
pnpm lint | Pass | No errors after the disposable repro file was removed. Existing warnings remain, including one unused path variable in a PR test. |
pnpm typecheck | Pass | All 15 workspace typecheck tasks completed in 74.4 s. |
| Changed test files | 134 pass, 3 fail | The failures are in the build-artifact suite: two Windows spawn UNKNOWN errors and one cross-architecture assertion failure. |
| New WSL/archive tests only | 8 pass | These tests inspect generated text and mocked spawn arguments. They do not exercise the failure cases above. |
| Real WSL fault runs | 3 blockers reproduced | Ubuntu, WSL 2, isolated HOME, exact PR scripts. |
| Cold WSL benchmark | 33 readiness runs | One first-ever install sequence plus 10 update sequences. Every first connection followed a full WSL shutdown. |
| WSL boot control | 10 cold boots | No-op command after each full shutdown: 4.008 s median, 3.832-4.285 s range. |
| GitHub status | Not green | CI and preview workflows report action_required; Vercel marketing reports failure. CodeRabbit reports success. |
Source: local commands in E:\Projects\t3code-pr-5769-review and GitHub checks for commit f2ce5ce.
bun is not installed in this nightly environment, and this PR declares pnpm@11.10.0. I ran the repository's current pnpm/vp equivalents instead of claiming the unavailable Bun commands passed.
Scope and confidence
high confidence The three blockers reproduced with the implementation under review, not a rewritten approximation. The archive fixture was intentionally small, but it used the same directory shape, tar extraction, marker logic, locking, and pruning functions.
I did not build or install a signed NSIS artifact, time the renderer from an Electron click, or run the full monorepo test suite. I did measure the WSL backend path from a stopped VM through HTTP readiness. The benchmark supports the cache speed claim, but it does not cover corruption or multi-version safety.
Raw evidence
WSL reproduction output
# Archive identity
first_install_exit=0
claimed=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
actual=2ddfa9b013dd5c3b7a7310238c757fc33e68e6ddb46766f3bd5bb27f112e565f
# Cache corruption
second_install_exit=0
ready-marker-present=true
native-payload-present=false
# Cross-version prune
active_runtime_losses=30/30
# Cleanup
isolated_fixture_removed=true
Captured 2026-08-20 in Ubuntu WSL 2. Values are unabridged except runtime paths, which were omitted because the temporary process suffix is not material.
Commands and repository state
# Exact head
git ls-remote https://github.com/pingdotgg/t3code.git refs/pull/5769/head
# f2ce5cea9d9d799a9d85bda5c5c4a0292cff174a
# Static checks
pnpm fmt:check
pnpm lint
pnpm typecheck
# Targeted tests
pnpm exec vp test run \
apps/desktop/src/wsl/DesktopWslEnvironment.test.ts \
apps/desktop/src/backend/DesktopBackendConfiguration.test.ts \
apps/desktop/src/backend/DesktopBackendManager.test.ts \
apps/desktop/src/backend/DesktopBackendPool.test.ts \
scripts/build-desktop-artifact.test.ts
Checkout: detached exact head in E:\Projects\t3code-pr-5769-review. The main working copy and active nightly worktrees were not changed.
Cold WSL timing summary
# Shutdown-to-readiness update sequences, n=10 each
first_cold_median=7.373s range=7.178-7.669s
second_warm_median=2.542s range=2.519-2.733s
third_warm_median=2.538s range=2.518-2.556s
# Boot-only control, n=10
wsl_boot_median=4.008s range=3.832-4.285s
# Fixture and cleanup
archive_files=1222
archive_uncompressed=180356009_bytes
archive_compressed=45170403_bytes
readiness_rows=33
benchmark_home_removed=true
wsl_state_after_test=Stopped
Full rows: readiness CSV and boot-control CSV.
Generated 2026-08-20 · Codex review · inputs: PR 5769 at f2ce5ce, GitHub checks, local static gates, Ubuntu WSL 2 fault runs, 33 cold-launch readiness rows, 10 boot controls · revision v2