Skip to content

[Bug]: localized Windows sc.exe 1060 is misclassified as WinSW service conflict #199

Closed

Description

@0disoft

Summary

On localized Windows, ocx service install can misclassify an absent WinSW service as an unverifiable/present native service. This blocks the Task Scheduler backend install after an update and leaves the proxy stopped.

The SCM correctly reports ERROR_SERVICE_DOES_NOT_EXIST (1060), but Bun exposes the process status as 36 (1060 & 0xff) and localized sc.exe output does not contain the English text FAILED 1060.

Environment

  • Windows 11, Korean locale
  • PowerShell 7.6.3
  • @bitkyc08/[email protected]
  • npm global install
  • Task Scheduler backend previously installed
  • reproduced with the bundled Bun 1.3.14 update path and Bun 1.4.0-canary.1+10ff02889

Reproduction

  1. Have the Task Scheduler backend installed.
  2. Confirm the native service is absent:
sc.exe qc opencodex-proxy-native

Observed SCM result:

[SC] OpenService ... 1060:
The specified service does not exist as an installed service.
  1. Run an update or reinstall:
ocx update
# or
ocx service install

Actual behavior

The package update succeeds, but the service refresh fails:

Removing the native (WinSW) service before installing the Task Scheduler backend...
error: Cannot remove the native service before switching to Task Scheduler:
Cannot verify the native service registration (sc.exe query failed).

Then:

Proxy: not running
Service: installed (CONFLICT: Task Scheduler AND native WinSW both present ...)

There is no opencodex-proxy-native SCM registration. The conflict is a false positive.

A minimized Bun reproduction reports:

{
  "status": 36,
  "stdout": "[SC] OpenService <localized text> 1060: ...",
  "stderr": ""
}

Accordingly, the current check does not match:

https://github.com/lidge-jun/opencodex/blob/v2.7.28/src/lib/winsw.ts#L204-L216

if (e.status === 1060 || /FAILED 1060/i.test(text)) return false;

Expected behavior

An SCM response carrying error number 1060 should be treated as confirmed absence regardless of localized surrounding text or the truncated child-process status.

The Task Scheduler service should then reinstall and start normally.

Verified local workaround

This narrow local change made probeScmRegistration() return false, changed statusWinswRaw() from unknown to nonexistent, and allowed the Task Scheduler backend to install successfully:

if (
  e.status === 1060 ||
  e.status === (1060 & 0xff) ||
  /\b1060\b/.test(text)
) return false;

Post-repair verification:

opencodex 2.7.28
Task Scheduler: Running
Task action: wscript.exe /b /nologo opencodex-service-launcher.vbs
health: ok
port: 10100
single listener PID matches /healthz PID

Suggested regression coverage

Please cover both:

  1. child-process status 36 with localized output containing 1060;
  2. 1060 appearing without the English token FAILED.

The matcher should remain specific to SCM error number 1060 so unrelated localized failures such as access denied remain fail-closed.

Activity

  1. lidge-jun commented on Jul 21, 2026

    @lidge-jun
    Owner

    v2.7.31에 수정 반영했습니다. localized sc.exe 출력에서도 독립적인 숫자 코드 1060을 인식하도록 수정했고, 서비스 상태의 tri-state 처리까지 보강했습니다. 반영 커밋: fbd96c1

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

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions