Windows: `ocx service start` throws WindowsSchtasksError when the task is missing, and `ocx service install` aborts because the Get-ScheduledTask state probe exceeds the 1000 ms cap
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 28/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- bun, powershell, typescript
調査の方向性
Start in src/service/windows-ops.ts around startWindows() (line 859), where schtasks /run runs without checking task existence, then read src/service/windows-checked-stop.ts near line 411 and the managerState cap in src/service/windows-stop-budget.ts line 24. Done means start reports 'service not installed' for a missing task and a slow but successful state probe is no longer classified as evidence-unreadable. The UAC fallback path needs a design decision, so this is not a good first pick.
索引モデルが issue の本文から書いたものです。
説明
Client or integration
Codex CLI
Area
Service lifecycle
Summary
Two related Windows bugs, both hit while installing the service without administrator rights
(Task Scheduler backend, not --native):
-
ocx service startcrashes instead of reporting "not installed".startWindows()
(src/service/windows-ops.ts:859) runsschtasks /run /tn opencodex-proxywithout first checking
that the task exists. On a machine where a previous install was rolled back, the task is gone, so
schtasksexits 1 and the CLI dies withWindowsSchtasksError ... reason: "other"— a dead end,
with no hint thatocx service installis what is needed. -
ocx service install(scheduler backend) then aborts with
"The installed Windows service could not be proven stopped (unknown) / the stop could not be
verified (evidence-unreadable)". The stopped-state probe shells out to
Get-ScheduledTask -TaskName opencodex-proxy -TaskPath '\', which on this machine takes
944–1786 ms, aboveWINDOWS_STOP_CAPS.managerState = 1_000
(src/service/windows-stop-budget.ts:24).windows-checked-stop.ts:411maps that timeout to
finish("unknown", "evidence-unreadable", ...), so a successful but slow query is treated as
unreadable evidence. The run then falls into the elevated fallback, which opens a UAC prompt
(consent.exe) that nobody answers in a non-interactive context and hangs.
Expected instead:
ocx service startshould detect the task is absent and either install/register it or say
service not installed — run ocx service install, never a rawschtasksexception.- A state probe that answers correctly but slower than 1 s should not be classified as
evidence-unreadable(or the cap should be raised / the probe replaced by a cheaper call). - The elevated fallback should be opt-in or time-boxed, not entered automatically.
Reproduction
Environment: Windows 11, no admin rights, @bitkyc08/opencodex 2.100.6 installed globally with npm;
bundled Bun runtime (Bun 1.4.4). No prior service installed (previous install was rolled back, so
~/.opencodex/service-state.json is absent and the task does not exist).
-
Confirm the task is gone:
schtasks /query /tn opencodex-proxy
ERROR: The system cannot find the file specified.
-
Try to install the service as a normal user:
ocx service install
→ "The installed Windows service could not be proven stopped (unknown)"
→ "The Windows service or process state could not be read (the stop could not be verified)"
→ internal elevated retry spawns a UAC prompt (consent.exe) that never completes.
-
Try to start it:
ocx service start
→ WindowsSchtasksError: Task Scheduler command failed (exit code 1): schtasks /run /tn opencodex-proxy
operation: "run", reason: "other", code: "WINDOWS_SCHTASKS_ERROR"
-
Measure the probe that feeds the 1000 ms cap:
powershell -NoProfile -Command "(Measure-Command { Get-ScheduledTask -TaskName 'opencodex-proxy' -TaskPath '' }).TotalMilliseconds"
1786 / 944 / 979 ms across three runs
For comparison, the process snapshot the same path uses is fast:
powershell -NoProfile -Command "(Measure-Command { Get-CimInstance Win32_Process }).TotalMilliseconds"
489 ms
Consistency: reproducible every time on this machine while the task is absent. Creating and running a
scheduled task itself works fine without elevation (schtasks /create ... : exit 0,
schtasks /run ... : exit 0), so it is not a permissions problem on this box.
Workaround that got it working locally (uses the package's own code, no patches to node_modules):
generate the assets with writeWindowsSchedulerAssets(runtime) + writeServiceInstallState("scheduler", ...),
register the generated opencodex-service-task.xml with schtasks /create /xml, then ocx service start.
After that, ocx service status and ocx service start both work.
Version
2.100.6 (npm global: @bitkyc08/opencodex)
Operating system
Windows 11, build 10.0.26200.9974 (x64), standard user (no administrator rights), Bun 1.4.4 bundled
Provider and model
N/A — not provider-specific. The failure happens in service management before any model request is made.
Logs or error output
C:\Users\javie>ocx service start
456 | if (error instanceof WindowsSchtasksError) return error;
457 | const operation = schtasksOperationFromArgs(args);
458 | const reason: WindowsSchtasksFailureReason = isWindowsSchtasksAccessDeniedError(error, args, taskPresent)
459 | ? "access-denied"
460 | : "other";
461 | return new WindowsSchtasksError(operation, reason, formatWindowsSchtasksError(error, args, taskPresent));
^
WindowsSchtasksError: Task Scheduler command failed (exit code 1): schtasks /run /tn opencodex-proxy
operation: "run",
reason: "other",
code: "WINDOWS_SCHTASKS_ERROR"
at toWindowsSchtasksError (C:\Users\javie\AppData\Roaming\npm\node_modules\@bitkyc08\opencodex\src\lib\windows-elevation.ts:461:10)
at schtasks (C:\Users\javie\AppData\Roaming\npm\node_modules\@bitkyc08\opencodex\src\service\windows-scheduler.ts:121:11)
at startWindows (C:\Users\javie\AppData\Roaming\npm\node_modules\@bitkyc08\opencodex\src\service\windows-ops.ts:859:40)
at <anonymous> (C:\Users\javie\AppData\Roaming\npm\node_modules\@bitkyc08\opencodex\src\service\cli.ts:396:11)
at withWindowsServiceMutationLock (C:\Users\javie\AppData\Roaming\npm\node_modules\@bitkyc08\opencodex\src\lib\windows-service-mutation-lock.ts:110:22)
at serviceCommand (C:\Users\javie\AppData\Roaming\npm\node_modules\@bitkyc08\opencodex\src\service\cli.ts:555:11)
at <anonymous> (C:\Users\javie\AppData\Roaming\npm\node_modules\@bitkyc08\opencodex\src\cli\dispatch.ts:598:16)
at dispatchCommand (C:\Users\javie\AppData\Roaming\npm\node_modules\@bitkyc08\opencodex\src\cli\dispatch.ts:1155:16)
at C:\Users\javie\AppData\Roaming\npm\node_modules\@bitkyc08\opencodex\src\cli\index.ts:1960:20
Bun v1.4.4 (Windows x64)
--- install-time failure (retyped from console output, no task existed at that point) ---
The installed Windows service could not be proven stopped (unknown)
The Windows service or process state could not be read (the stop could not be verified)
--- evidence for the 1000 ms cap ---
src/service/windows-stop-budget.ts:24: managerState: 1_000,
src/service/windows-checked-stop.ts:411: if (unreadable) return finish("unknown", "evidence-unreadable", "the stop could not be verified")
Get-ScheduledTask -TaskName 'opencodex-proxy' -TaskPath '\' -> 1786 ms / 944 ms / 979 ms
Screenshots and supporting files
No response
Redacted configuration
No provider or routing configuration is involved. Relevant on-disk state only:
- `~/.opencodex/service-state.json` is **absent** after the failed install, which is why
`ocx service status` reports "not installed" even when the Task Scheduler entry still exists.
- Backend requested: Task Scheduler (default). Runtime: bundled Bun (`durableBunRuntime()`).
- Generated task (registered manually as a workaround) contains:
- `LogonTrigger` + `SessionStateChangeTrigger` (RemoteConnect, SessionUnlock, ConsoleConnect), `Enabled=true`
- `ExecutionTimeLimit=PT0S`
- action: `wscript.exe /b /nologo "<home>\.opencodex\opencodex-service-launcher.vbs"`
- No tokens, account identifiers or request credentials are included in this report.
Checks
- I searched existing issues and documentation.
- I removed secrets, tokens, account details, request credentials, and personal data.
- 主要言語
- TypeScript
- スター
- 16.9k
- フォーク
- 1.3k
- 平均マージ
- 1日 2時間
- マージ済み PR(30日)
- 844
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
lidge-jun/opencodex のほかの issue
-
[Provider] antigravity-acp catalog omits gemini-4-hydrogen and gemini-4-neon that agy acp offersオープンcatalog provider provider-compatibility
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
lidge-jun/opencodex#9037 · コメント 1 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
Polish Spanish documentation wording and product names対応中かも @federicorv25 が 7 日前に担当しました。 オープンdocumentation
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
[Bug] Anthropic pool: one 429 leaves the active account rate limited with a fake weekly 100%, and background refresh skips it (2.100.7)対応中かも @samirmedani が今日担当しました。 オープンaccount-pool bug
難易度 4/5 3〜5日 初心者へのやさしさ 32/100
lidge-jun/opencodex#9032 · コメント 2 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug cli platform service
難易度 4/5 3〜5日 初心者へのやさしさ 25/100
lidge-jun/opencodex#9026 · コメント 4 件 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
catalog enhancement
難易度 4/5 3〜5日 初心者へのやさしさ 30/100
メンテナーはふだん 1 日以内に返信
lidge-jun/opencodex の issue をすべて見る
似ている issue
-
難易度 1/5 1時間未満 初心者へのやさしさ 62/100
slavakurilyak/awesome-ai-agents#1005 ·
-
kind/bug triage/unresolved
難易度 2/5 1〜3時間 初心者へのやさしさ 60/100
メンテナーはふだん 1 日以内に返信
-
effort:S P3 refactor
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
nightscout/nocturne#3735 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
wpilibsuite/systemcore-blocks-interface#641 ·
メンテナーはふだん 2 日以内に返信
-
[Site] Active section detection should respect scroll-margin-top対応中かも このイシューにリンクされたプルリクエストがオープン中、またはマージ済みです。 オープンarea/web reproduced type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
anomalyco/opencode#65384 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信