Skip to content

fix(update): make conductor update reliable on Windows (running-process check, retry, better errors)#155

Merged
jrob5756 merged 1 commit intomainfrom
fix/update-windows-reliability
May 6, 2026
Merged

fix(update): make conductor update reliable on Windows (running-process check, retry, better errors)#155
jrob5756 merged 1 commit intomainfrom
fix/update-windows-reliability

Conversation

@jrob5756
Copy link
Copy Markdown
Collaborator

@jrob5756 jrob5756 commented May 6, 2026

Summary

conductor update fails frequently on Windows. Root cause: when another conductor process is running (foreground conductor run --web, background dashboards from --web-bg, IDE-spawned workers), it holds file locks on the entrypoint executable and on files inside %LOCALAPPDATA%\uv\tools\conductor-cli\. uv tool install --force then errors with "Access is denied" or "file is in use", and the previous error reporting only printed proc.stderr with no remediation.

Changes

1. Pre-flight running-process check

Detects other Conductor processes via tasklist on Windows and ps elsewhere. If any are found, prints them with PIDs and aborts with guidance:

Warning: 2 other Conductor processes are running:
  • PID 12345: /usr/local/bin/conductor run plan.yaml --web
  • PID 67890: conductor-cli (uv tool venv child)

Running processes can hold file locks that cause the upgrade to fail
(especially on Windows).
Stop them first (e.g. `conductor stop --all` for background dashboards),
then re-run `conductor update`.
To upgrade anyway, re-run with `conductor update --force`.

_looks_like_conductor_process() matches the conductor entrypoint, python -m conductor, and uv tool run conductor without false positives on unrelated paths.

2. Retry loop (mirrors install.ps1)

run_update now retries the uv tool install invocation up to 3 times with a 2-second delay, matching the existing logic in install.ps1 for transient Windows Defender / file-lock failures. Mid-sequence success short-circuits.

3. Better error reporting

  • Surfaces both proc.stdout AND proc.stderr (previously only stderr)
  • On Windows, detects "access is denied" / "in use" / "locked" patterns and points users at stopping conductor processes
  • Always shows the Defender exclusion command (Add-MpPreference -ExclusionPath ...) on Windows failure

4. Broader Windows .exe rename

_rename_windows_exes() now also moves these out of the way before uv tool install:

  • %LOCALAPPDATA%\uv\tools\conductor-cli\Scripts\conductor.exe — the most common cause of failed self-upgrades
  • %APPDATA%\uv\tools\conductor-cli\Scripts\conductor.exe — alt path on some uv versions

(In addition to the previously-covered ~/.local/bin/conductor.exe and the exe found on PATH.)

5. New --force flag

conductor update --force skips the pre-flight check for users who are confident the install will succeed.

Tests

  • +5 new tests in TestRunUpdate:
    • test_aborts_when_other_conductor_running — pre-flight detects processes and aborts without invoking install
    • test_force_skips_pre_flight--force proceeds even with running processes
    • test_retry_succeeds_on_second_attempt — transient failure → success short-circuits
    • test_failure_surfaces_stdout_and_stderr — both streams shown
    • Pre-flight & sleep autouse fixture so existing tests are unaffected
  • Updated test_upgrade_failure to assert call_count == 3 (retries to exhaustion)
  • All 62 update tests pass; full tests/test_cli (301 tests) passes
  • make lint
  • uv run ty check

Verification path on Windows

After this lands, a Windows user hitting "update fails almost every time" should:

  1. Run conductor update — gets immediate, actionable feedback if processes are running
  2. Run conductor stop --all to clean up background dashboards
  3. Close any foreground conductor run terminals
  4. Re-run conductor update — now succeeds, or shows a clear error with Defender remediation if Defender is the issue

The 'conductor update' command often fails on Windows when other
conductor processes are running because they hold file locks inside
%LOCALAPPDATA%\uv\tools\conductor-cli\. uv tool install --force
then errors with 'Access is denied' or 'file is in use'.

Improvements:

1. Pre-flight check for other running conductor processes
   Detects via 'tasklist' on Windows and 'ps' elsewhere. Lists matching
   PIDs and exits with guidance to stop them (or pass --force to skip
   the check). Includes a smart command-line filter so we match the
   conductor entrypoint, 'python -m conductor', and 'uv tool run
   conductor' without false positives on unrelated paths.

2. Retry loop (3 attempts, 2s delay) mirroring install.ps1
   Absorbs transient Windows Defender / file-lock failures. Mid-sequence
   success short-circuits.

3. Better error reporting
   Surfaces full uv stdout AND stderr (not just stderr), and on
   Windows points users at the most common remediations: stopping
   running conductor processes and adding a Defender exclusion.

4. Broader Windows .exe rename
   _rename_windows_exes now also moves
   %LOCALAPPDATA%\uv\tools\conductor-cli\Scripts\conductor.exe and
   the %APPDATA% equivalent out of the way (in addition to ~/.local/bin
   and the exe on PATH), covering every location uv may have placed
   the entrypoint in.

5. New 'conductor update --force' flag
   Skips the running-process check for users who are confident the
   install will succeed.

Tests: +5 new tests (pre-flight abort, --force skip, retry-then-success,
stdout+stderr surfacing, abort message). Existing tests updated for the
new retry call counts. 62/62 update tests pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jrob5756 jrob5756 merged commit 3694e39 into main May 6, 2026
7 checks passed
@jrob5756 jrob5756 deleted the fix/update-windows-reliability branch May 6, 2026 01:26
jrob5756 added a commit that referenced this pull request May 6, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jrob5756 jrob5756 mentioned this pull request May 6, 2026
jrob5756 added a commit that referenced this pull request May 6, 2026
* chore: release 0.1.12

Bumps version to 0.1.12 and updates CHANGELOG with the four PRs
merged since v0.1.11:

- #149: Windows install diagnostics
- #151: Tag-based registry versioning with # ref syntax
- #152: Unified reasoning.effort configuration
- #153: Dashboard layout fix for human_gate options + loop-backs

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* chore: add #155 (Windows update reliability) to 0.1.12 changelog

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant