Skip to content

[Bug]: ocx update leaves a permanent update-in-flight tombstone on Windows after an interrupted update #8524

Closed

Description

@kevin20chan

Client or integration

Other

Area

Installation or packaging

Summary

On Windows with a global npm install and the Task Scheduler service backend, a single
interrupted ocx update permanently locks out every later update and sync.

After the update has printed "🛑 Service manager stopped." and spawned its installer, if the
launcher process is killed (closing the console window, Ctrl+C, Task Manager, sleep, power
loss), the leftover %USERPROFILE%\.opencodex\update-orchestrated.json is never cleared:

{"pid":49192,"phase":"mutating","startedAt":...,"fenceUntil":...,"terminationUnconfirmed":true}

Every subsequent ocx update / ocx sync / ocx update --plan --yes then fails with only:

opencodex: update-in-flight

Expected: inspectUpdateMarker should report free once fenceUntil is in the past and the
marker's pid no longer exists. The current code returns "unknown" unconditionally on
Windows because it requires the POSIX-only installerPgid field:

// src/update/sync-update-mutex.mjs:152
return unknown || (marker.terminationUnconfirmed && marker.installerPgid === undefined)
? "unknown" : "free";

installerPgid is only written by src/update/posix-install-supervisor.mjs, so on Windows this
is always "unknown" and the marker can never become free. Waiting out the 15-minute fence,
restarting the service, and rebooting all do nothing; the only recovery is renaming the marker
file by hand. Reproduced on 2.99.0 (updating to 2.100.1) and on an earlier run (2.97.0 ->
2.99.0). No self-healing path exists in the tree.

Reproduction

  1. Environment: Windows 11, global npm install of @bitkyc08/opencodex, background service via
    Task Scheduler (task "\opencodex-proxy", backend recorded as "scheduler" in
    %USERPROFILE%.opencodex\service-state.json), proxy healthy on 127.0.0.1:10100.

  2. Run ocx update (or start the update from the dashboard).

  3. Once these two lines are printed:

    ⏹ Stopping the running proxy before updating...
    🛑 Service manager stopped.

    and before "Updated to vX.Y.Z.", kill the launcher process. Closing the console window,
    Ctrl+C, Task Manager "End task", system sleep or power loss all produce the same result.
    In the observed incident the installer supervisor had already started (PowerShell script
    block logging shows npm-install-job.ps1 at 09:27:01, three seconds after the marker was
    written at 09:26:58) and npm had not yet written any log.

  4. Run ocx update again — and again, and after a reboot.

Observed:
C:\Users<user>>ocx update
opencodex: update-in-flight
(exit code 1; the dashboard records "update command failed")

The marker is left in this exact shape:
{"pid":49192,"phase":"mutating","startedAt":1794187555162,"fenceUntil":1794188455162,
"terminationUnconfirmed":true}

Waiting >15 minutes past fenceUntil does not help. Renaming the file is the only recovery:
ren "%USERPROFILE%.opencodex\update-orchestrated.json" update-orchestrated.json.stale
after which ocx update completes normally.

Second occurrence (dashboard-triggered, 2.99.0 -> 2.100.1): npm finished successfully at
09:23:25, the update worker received SIGTERM at 09:24:31 (recorded as
"signal":"SIGTERM","exitCode":null in %USERPROFILE%.opencodex\update-job.json), and the same
tombstone blocked every later attempt.

Note: the marker stopping at the noteUntrackedInstaller() shape (rather than phase:"failed")
indicates the launcher was terminated without running its process.once("exit", …) hook in
bin/ocx.mjs — i.e. a TerminateProcess-class kill, not a normal failure exit.

Version

2.99.0 (original occurrence); currently installed: 2.100.1

Operating system

Windows 11, build 10.0.26200.9457; Node.js v24.14.0; npm 11.9.0

Provider and model

No response

Logs or error output

# --- first run, interrupted (2.97.0 -> 2.99.0) ---
opencodex v2.97.0 (installed via npm, tag latest)
⏹  Stopping the running proxy before updating...
🛑 Service manager stopped.
✅ Proxy (PID 48320) stopped.
[process killed here; npm wrote no log at all]

# --- every later attempt ---
C:\Users\<user>>ocx update
opencodex: update-in-flight
C:\Users\<user>>ocx update
opencodex: update-in-flight

# --- marker left behind ---
%USERPROFILE%\.opencodex\update-orchestrated.json
{"pid":49192,"phase":"mutating","startedAt":1794187555162,"fenceUntil":1794188455162,"terminationUnconfirmed":true}

# --- second run, dashboard-triggered (2.99.0 -> 2.100.1) ---
%USERPROFILE%\.opencodex\update-job.json
{"status":"failed","installer":"npm","restart":true,"pid":6568,"exitCode":null,
 "signal":"SIGTERM","error":"update command failed (?)"}
marker: {"pid":40144,"phase":"mutating","startedAt":1794360090976,"fenceUntil":1794360990976,
         "terminationUnconfirmed":true}

Screenshots and supporting files

Attached: update-job.json, the dashboard job record from the second occurrence
(worker PID 6568 terminated by SIGTERM at 09:24:31 local). The two stale marker files
themselves were cleaned up during recovery; their exact JSON is quoted in the logs above.

update-job.json

Redacted configuration

{
  "note": "excerpt of %USERPROFILE%\\.opencodex\\service-state.json (paths redacted)",
  "backend": "scheduler"
}

Checks

  • I searched existing issues and documentation.
  • I removed secrets, tokens, account details, request credentials, and personal data.

Activity

  1. added
    bug
    on Nov 11, 2026
  2. added
    cli
    install
    platform
    on Nov 11, 2026
  3. coderabbitai commented on Nov 11, 2026

    @coderabbitai
    Contributor
    🔗 Related PRs

    #8103 - feat(update): orchestrated ocx update plan/apply contract (update.orchestrated/1) [merged]


    📝 Issue Planner

    Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

    • Create Plan

    🧪 Issue enrichment is currently in open beta.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    💬 Have feedback or questions? Drop into our discord!

  4. added a commit that references this issue on Nov 11, 2026
    e753651
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcliinstallplatform

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions