fix(desktop): identify foreign update blockers and close safe previews - #79018
Conversation
|
Apologies, I should have had my AI agent wait for me to approve this first before publishing some minor personal information about me in the test code. I'm getting that fixed right now. |
9b44f30 to
def9688
Compare
|
Fun story how I came up with this (skip if you don't care): I had Hermes Desktop made a website for me and host the server as a preview for me. Days later, that server was still running, and I didn't know where it was the shut it down, but it was causing Hermes Desktop to complain at me when I tried to update. So, I started up a new Hermes thread, and asked why does this keep happening when I try to update? It did some investigating and presented me with several options, and this was the recommended option. And it worked! I updated and restarted, and then I was like...wait, if Hermes Agent modified core files of Hermes Desktop itself, and Hermes Desktop updates itself, does that overwrite our fix? I asked Hermes about that, it presented several options, and recommended submitting a PR so that it's fixed for everyone, not just me. |
|
Possible duplicate of #78095 |
|
This was generated by AI during triage. Summary: Problems:
Solution: Checked against |
|
Related to #78095, but not a duplicate. #78095 fixes long-command-line Hermes gateways being misclassified as blockers. This PR handles user-launched |
|
Thanks. This was a valid gap and is now addressed in commit 894d4a367. Foreign blockers now receive a dedicated diagnostic view showing the process name, PID, and a bounded/redacted command line. They never receive an automatic termination action. For mixed blocker sets, the UI offers Close previews and check again. That action remains restricted to scanner-classified safe local previews; unrelated Python processes are left untouched and listed for manual closure. Coverage now includes foreign-only, mixed, safe-preview-only, and command-line redaction cases. The full UI suite passes with 393 files and 3,412 tests. I’ve also updated the PR description to clarify the broader #77422 coverage and the remaining out-of-scope venv rollback work. |
Summary
python -m http.serverpreviews by label and port and offer Close previews and updateProblem
Long-lived processes using the Hermes-managed venv can keep it open on Windows. This includes both disposable
python -m http.serverpreviews and unrelated user-owned Python scripts.The updater correctly aborts rather than risk a partially updated environment, but the previous dialog described every blocker as another Hermes process and told users to close Hermes windows or terminals. That guidance was misleading and unactionable for foreign processes.
Closes #77422.
Behavior
Safety boundary
Automatic termination remains restricted to blockers carrying scanner-issued
local-previewmetadata,safeToStop, and a process creation time.Immediately before termination, the Python helper reconstructs the process, compares its creation time, and checks its current argv against the strict local-preview classifier. This protects against stale PIDs, PID reuse, truncated display command lines, and unrelated Python processes.
Foreign blocker command lines are diagnostic-only. Likely credentials are redacted, ambiguous sensitive command tails fail closed, and displayed command lines are bounded to 500 characters.
A final blocker scan must be clear before update handoff continues.
Scope
This addresses the blocker classification, diagnostics, and safe preview cleanup requested in #77422, including the user-owned Python watcher reproduction.
It does not broaden automatic termination to arbitrary Python processes. Atomic venv replacement or rollback after dependency-update failure remains out of scope and is related to #68760. The Hermes gateway exemption work in #78095 is related but separate.
Test plan
24 passed)6 passed)393 files, 3,412 tests)28 passed)Localization note
Non-English strings were machine-assisted and have not been reviewed by native speakers. They follow the existing locale structure; corrections or a preference for English fallback are welcome.
Simulated screenshot
Rendered from the PR’s actual dialog component using mock blocker data; this was not captured during a live update. The screenshot shows the safe-preview-only state. Foreign-only and mixed states are covered by component tests.