Skip to content

fix(windows): stop pythonw backends during desktop update - #70033

Open
xuezhaolan wants to merge 1 commit into
NousResearch:mainfrom
xuezhaolan:fix/windows-update-pythonw-backend
Open

fix(windows): stop pythonw backends during desktop update#70033
xuezhaolan wants to merge 1 commit into
NousResearch:mainfrom
xuezhaolan:fix/windows-update-pythonw-backend

Conversation

@xuezhaolan

Copy link
Copy Markdown
Contributor

Summary

  • Extends the Windows desktop update straggler cleanup to stop detached Hermes backends running under pythonw.exe/python.exe, not just hermes.exe.
  • Scopes the Python-process sweep to this install's venv path so unrelated Python or Hermes processes are not touched.

Rationale

The Windows desktop/gateway backend can run as pythonw.exe -m hermes_cli.main ... gateway run. If that process survives handoff, it can keep files in venv locked and make the update/rebuild fail with Access denied even after taskkill /IM hermes.exe succeeds.

Closes #70026

Test Plan

  • git diff --check -- apps/bootstrap-installer/src-tauri/src/update.rs
  • targeted static assertions for the updated call site and venv-scoped PowerShell predicate
  • added-line secret/security scan for this diff
  • independent Codex review: PASS

Note: Rust toolchain is not installed in this sandbox (cargo missing), so cargo fmt/cargo test could not be run locally.

@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/desktop Electron desktop app (apps/desktop/*) platform/windows Native Windows-specific behavior or breakage area/install-update Installer, updater, packaging, wheels, doctor sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows labels Jul 23, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Related: #65935 and #70026. This is a focused bootstrap-installer repair for the pythonw lock case, while #65935 covers the same update path plus base-interpreter trampoline and broader venv-holder detection. Please consolidate the overlapping bootstrap changes rather than treating either PR as a duplicate.

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for narrowing the process sweep to the install venv rather than killing every Python process.

Problems

  • The new sweep cannot run for the reported Python-only holder case. wait_for_install_locks_free() only calls force_kill_other_hermes() after its probes remain locked (apps/bootstrap-installer/src-tauri/src/update.rs:638-687), but those probes are venv/Scripts/hermes.exe plus app.asar (apps/bootstrap-installer/src-tauri/src/update.rs:693-713, 856-861). A process locking only python.exe, pythonw.exe, or a loaded .pyd exits at the clear-probe path before this sweep.
  • Current main now kills desktop-owned backend trees and then aborts handoff when the venv-holder scan finds another process (apps/desktop/electron/main.ts:2738-2765, 2926-2936). The update command independently rejects the same holder class (hermes_cli/update_cmd.py:3117-3132). This fallback needs to be reconciled with that safety boundary.

Suggested changes

  • Wire the fallback to an actual Python-holder trigger, or retain the current refusal path for external holders; do not rely only on the Hermes-shim/app.asar probes.
  • Add behavioral coverage for the selected trigger and venv-prefix scoping.

Automated hermes-sweeper review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/install-update Installer, updater, packaging, wheels, doctor comp/desktop Electron desktop app (apps/desktop/*) P2 Medium — degraded but workaround exists platform/windows Native Windows-specific behavior or breakage sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

force_kill_other_hermes() only kills hermes.exe, misses pythonw.exe backend → venv rebuild fails with "Access denied" on Windows

3 participants