Repository navigation
fix(desktop): stop WSL backends when they are disabled - #12696
yashranaway wants to merge 1 commit into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: pingdotgg/t3code/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe pool now constructs backend instances with unregister-owned child scopes. Tests add deterministic process and HTTP infrastructure and cover secondary unregister, restart cancellation, re-registration, and shutdown cleanup. ChangesBackend lifecycle
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~15 minutes Change: Bug fix · Severity of issue fixed: Medium Suggested reviewers: 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a narrowly scoped desktop lifecycle bug fix that makes disabled WSL backends release their process and cancel restarts through the correct instance scope. Focused tests cover teardown, re-registration, restart cancellation, primary isolation, and application shutdown, with no API, default, deployment, or static-analysis changes. You can add or adjust custom eligibility rules. Learn more. |
|
I hit a scope issue while working on the same fix independently and wanted to share a finding that may help with the test approach here. Problem: \Layer.effect's inner \Scope.Scope\ closes as soon as its build effect completes under per-test \Effect.provide. This means \pool.register\ (which calls \Scope.fork(layerScope)) always forks a closed scope in \it.effect\ tests — so the forked process never spawns, making it impossible to test In production this doesn't happen because the pool layer survives via the massive shared \provideMerge\ build in \main.ts\ (multiple consumers hold observers > 0, keeping the layer scope alive). Solution: Use \it.layer\ from @effect/vitest\ instead of \Effect.provide: \\ s \it.layer\ builds the layer once into a suite-lifetime \Scope.make()\ (kept open until the last test in the block runs), exactly mirroring production's shared-layer semantics. The \pool.register\ fork gets a live scope, processes spawn, and \pool.unregister\ correctly runs the auto-stop finalizer. I confirmed this empirically: a \Layer.effect\ with \�ddFinalizer\ only prints its close log when the \it.layer\ suite finishes — not when the test gen completes. This lets the regression test exercise the real \pool.register\ / \makeBackendInstance\ / \pool.unregister\ path with a stubbed \ChildProcessSpawner\ (counting \spawnCount), rather than mirroring the pipe externally. |
|
Thanks @NawzBlaze; here |
|
Note This comment is posted by Julius' dot The scope regression tests establish that unregister stops the supervisor. Do you have a Windows/WSL result showing the Linux t3 process also exits after disabling the backend? The triage in #12642 called out that separate process-boundary check, and the PR says it was not performed. Please provide that result or explain how the existing shutdown path establishes it under verification. |
|
The existing tests prove supervisor shutdown, but they do not prove that the Linux t3 process exits across the wsl.exe boundary. I do not have a Windows/WSL host to perform that check, so this verification gap remains open. I have kept the PR description explicit about that limitation. |
Disabling the WSL backend removes its pool entry but leaves the server running. Its supervisor can restart it afterward, even with WSL disabled, and compete with another service in the same distro for remote connectivity.
Registered instances accidentally inherit the pool's application scope from the captured Effect context. Apply the instance scope inside that context so unregistering an instance runs its stop finalizer, releases its process, and cancels scheduled restarts. The primary backend stays running, and the same WSL instance can be registered again.
Fixes #12642.
Validation:
The tests exercise the real pool and supervisor with scoped process doubles on Linux. A Windows/WSL end-to-end run was not performed. This changes desktop process ownership only; it does not touch the server provider or orchestration layers being rewritten for V2.
Model: GPT-6
Harness: Codex in T3 Code
Summary by CodeRabbit
Bug Fixes
Tests