fix(desktop): guard git-based self-update against hung processes - #39096
Closed
foras910521-lab wants to merge 1 commit into
Closed
fix(desktop): guard git-based self-update against hung processes#39096foras910521-lab wants to merge 1 commit into
foras910521-lab wants to merge 1 commit into
Conversation
The Desktop self-update path shells out to git. If git hangs (slow remote, network glitch, host refusing connection) the spawned child runs forever and the update UI never recovers. - Cap git operations at 15s via GIT_OPERATION_TIMEOUT_MS - On timeout, kill the child with SIGTERM and resolve with timedOut=true - Clear the pending timeout once the child exits/errors to avoid double-firing Tests: - tests/test_desktop_update_safety.py pins the timeout hook + kill path The companion fix (dist/** unpack so the Python backend can reach app.asar.unpacked/dist/index.html) is split out into a separate PR to keep this change small and reviewable.
YoussefEttamimi
approved these changes
Jun 4, 2026
YoussefEttamimi
left a comment
There was a problem hiding this comment.
Reviewed and this looks good to merge.
What I checked:
runGit()now uses asettledguard to avoid double resolution.- The timeout path appends an actionable stderr message, attempts
child.kill('SIGTERM'), and resolves with{ code: null, timedOut: true }. - The normal
errorandexitpaths clear the timer, so successful/failed git operations should not leave a pending timeout behind. - Existing callers already treat
code !== 0as failure, so timeout should recover the update UI instead of hanging forever.
Checks I ran/verified during review:
python -m pytest tests/test_desktop_update_safety.py -q— passednode --check apps/desktop/electron/main.cjs— passed
Non-blocking suggestions for a follow-up:
- Validate
HERMES_DESKTOP_GIT_TIMEOUT_MSso invalid/zero/negative values fall back to a sane default instead of producing an immediate or unexpected timeout. - Consider replacing the textual Python guard with a JS behavioral test that mocks
spawnand verifiesSIGTERM,timedOut: true, timer cleanup, and no double resolution.
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.
Summary
Why
The Desktop self-update path shells out to git. If git hangs (slow remote, network glitch, host refusing connection) the spawned child runs forever and the update UI never recovers. This is an infinite-spinner failure mode observed when the network is unreliable.
Diff scope
Out of scope
The companion fix that makes the Python backend reachable in the packaged app (dist/** added to build.asarUnpack, guarded by tests/test_desktop_packaging.py) is split out into #39093 to keep this change small and reviewable.
Test plan