fix(desktop): resolve Windows userData without yielding before the Clerk bridge - #13204
Conversation
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This focused fix changes production desktop startup by introducing synchronous filesystem access before Clerk bridge registration. It also adds file- and line-level static-analysis suppressions, so the change warrants human review. You can add or adjust custom eligibility rules. Learn more. |
060756d to
d6dcd10
Compare
cb94fc5 to
42b5fb8
Compare
d2675dc to
9cbaf77
Compare
42b5fb8 to
2ff43ca
Compare
|
Effect Service Conventions found one blocking issue in Posted via Macroscope — Effect Service Conventions |
|
Effect Service Conventions found one blocking issue in Posted via Macroscope — Effect Service Conventions |
1 similar comment
This comment has been minimized.
This comment has been minimized.
6ca6a24 to
3e4ca4c
Compare
…erk bridge
resolveUserDataPath ran through the Effect Node FileSystem, so its async exists() check yielded the startup fiber; Electron then emitted ready and createClerkBridge's protocol.registerSchemesAsPrivileged threw, crashing packaged Windows (and dev) at startup with DesktopClerkBridgeInitializationError. Run the resolver against a synchronous node:fs-backed FileSystem so setPath('userData') and bridge creation complete before the first yield.
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…rting missing Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
DesktopClerk.make overrode FileSystem with a module-global sync adapter, hiding the dependency. Move the adapter to DesktopPreReadyFileSystem.layer and provide it to the Clerk layer in main.ts. The regression test now builds the Clerk layer under runSync with that real layer. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
964d66c to
8d1f200
Compare
This comment has been minimized.
This comment has been minimized.
1bd44f2
into
pingdotgg:t3code/codex-turn-mapping
…erk bridge (#13204) Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…erk bridge (#13204) Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…erk bridge (#13204) Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…erk bridge (#13204) Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: Julius Marminge <51714798+juliusmarminge@users.noreply.github.com> Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
…3204 fixed pingdotgg#13195; rebuild from trial (QM-204)
Closes #13195
What Changed
DesktopClerk.makenow runsDesktopUserData.resolveUserDataPathagainst a synchronousnode:fs-backedFileSystem(existsSync,readFileSync,mkdirSync,writeFileSync, errno mapped toPlatformError.systemErrorso thewx/AlreadyExistswrite path still works). The resolver, its tests, and thesetPath("userData")beforecreateClerkBridgeorder are unchanged.Regression test in
DesktopClerk.test.ts: builds the layer underEffect.runSyncwith an ambientFileSystemwhoseexistsis deferred, for packaged Windows and for development. Any yield beforecreateClerkBridgethrowsAsyncFiberError. Both cases fail on the current branch and pass with this change.Why
Every packaged Windows launch of the V2 branch exits with code 1 before a window appears:
Since #12480,
resolveUserDataPathinspects the profile directories on win32 (and the legacy profile in development on every platform) through the Effect NodeFileSystem.existsthere is async, so the startup fiber yields, Electron emitsreadyduring that yield, and@clerk/electron'sregisterSchemesAsPrivilegedthrows. Non-Windows packaged builds return before any I/O, which is why macOS is unaffected. Creating the bridge before resolving userData is not an option because the bridge takes the single-instance lock in the userData directory, so the I/O has to stop yielding instead. This is the approach @juliusmarminge described in the issue.Verification
Windows Server 2022 x64, Node 24.13.1, pnpm 11.10.0, Electron 44.4.2, branch
t3code/codex-turn-mappingat060756de5.Before:
pnpm dist:desktop:win:x64, installrelease\T3-Code-0.0.42-x64.exe /S, runT3 Code (Alpha).exe --enable-logging=stderr. Process exits with code 1 in about one second with the error above.After: same build and install steps. The process stays up, the onboarding window opens, and
GET http://127.0.0.1:3773/.well-known/t3/environmentreturns 200 withserverVersion 0.0.42.Checks:
apps/desktoptypecheck exit 0,vp lintandvp fmt --checkclean on the two changed files,DesktopClerk.test.ts7/7.DesktopUserData.test.ts > identifies a failed source read and preserves its causefails on this Windows machine both before and after this change (path separator in the expected error), so it is not related.Checklist