fix(desktop): surface an actionable hint when Smart App Control blocks a backend DLL - #89636
Open
chelsealong wants to merge 1 commit into
Open
Conversation
…s a backend DLL Windows Smart App Control blocks Hermes's unsigned bundled Python C extension DLLs (e.g. _sqlite3.pyd), so the backend aborts on import before it can announce readiness. The desktop app only showed the generic "Hermes backend exited before it became ready" message, giving affected users no lead on what actually happened or how to work around it (NousResearch#89627). describeBackendExitHint() recognizes the "DLL load failed while importing" signature in the backend's recent log output and appends a pointer to the new Windows guide troubleshooting entry, which documents the incompatibility and the WSL2 workaround until the bundled Python is signed.
Contributor
Review of "fix(desktop): surface an actionable hint when Smart App Control blocks a backend DLL". Nice DX addition: dependency-free pure diagnosis function (testable without Electron), a pattern that matches the real-world Chinese-localized SAC error string, honest docs stating SAC and unsigned bundled Python are incompatible until signing happens (with WSL2 as the workaround), and the hint rides both the UI progress message and the rejection error. One nit:
No blocking issues found. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
With Windows Smart App Control (SAC) enabled, Hermes Desktop's bundled Python interpreter can't load its own C-extension DLLs (e.g.
_sqlite3.pyd) — they aren't code-signed, and SAC blocks unsigned binaries with no cloud reputation and offers no exclusion list. The backend process aborts on import before it announces its port, so the desktop app only ever showed the generic:with the real cause (
ImportError: DLL load failed while importing _sqlite3: ...) buried indesktop.log. Full code-signing the bundled Python (the proper long-term fix) is out of scope for this PR — it needs an actual code-signing certificate and release-pipeline change that only maintainers can set up. This PR does what's achievable from the app/docs side: make the failure recognizable and point at a documented workaround.Related Issue
Fixes #89627
Type of Change
Changes Made
apps/desktop/electron/backend-exit-diagnosis.ts(new) —describeBackendExitHint(), a pure function that recognizes the WindowsDLL load failed while importingsignature in the backend's recent log tail and returns an actionable hint (mentions Smart App Control/antivirus/corrupted install as known causes, links the new docs entry).apps/desktop/electron/main.ts— the backendexithandler (when the backend dies before becoming ready) now appends this hint to the boot-progress error message and the rejected error, instead of only the generic "exited before it became ready" text. No change for any other exit cause (hint isnull, message is byte-for-byte the same as before).apps/desktop/electron/backend-exit-diagnosis.test.ts(new) — unit tests for the detector (matches, case-insensitivity, no false positive on an unrelated exit log, empty input).website/docs/user-guide/windows-native.md— new "Common pitfalls" entry documenting the SAC incompatibility and the WSL2 workaround, per the issue's suggestion Support passing morph snapshot id #2 ("If signing is not feasible short-term, document the incompatibility").How to Test
cd apps/desktop && npx vitest run electron/backend-exit-diagnosis.test.ts— passes (4/4).backend-exit-diagnosis.ts(the file this PR adds) and re-ran the same test —Cannot find module './backend-exit-diagnosis', 1 failed suite.npx vitest run --project electron— 110 passed | 1 skipped (unrelated, pre-existing), 1453 passed | 2 skipped.npx tsc -p tsconfig.electron.json --noEmit— clean.npx eslint electron/backend-exit-diagnosis.ts electron/backend-exit-diagnosis.test.ts electron/main.ts— clean.npx vitest run src/app/gateway/hooks/use-gateway-boot.test.tsx --project ui— 13/13 passed (confirms the boot-progress message consumer is unaffected for the non-hint case).Test output
Checklist
Code
fix(scope):)Documentation & Housekeeping
website/docs/user-guide/windows-native.md)null, message unchanged byte-for-byte)AI assistance disclosure
This PR was authored with AI assistance (an autonomous Claude-based coding agent), with the change scoped, implemented, and verified (tests run, lint/typecheck run, pre-fix-vs-post-fix test behavior confirmed) before opening.