You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug][Windows] Service wrapper fails to parse on locales where %DATE% contains parentheses (e.g. ja-JP); proxy never starts under Task Scheduler #5093
On Windows with a locale whose %DATE% contains parentheses (e.g. Japanese: 2026/09/19 (土)), the generated service wrapper ~/.opencodex/opencodex-service.cmd fails to parse and exits before launching Bun. The Task Scheduler job reports success (LastTaskResult = 0), but the proxy never starts. ocx service / ocx service repair then reports "registered but NOT serving".
Environment
opencodex 2.59.0 (upgraded from 2.46.0), Windows 11, ja-JP locale
Service backend: Task Scheduler (opencodex-proxy task)
Reproduction
Use a Windows locale where %DATE% includes () (ja-JP: 2026/09/19 (土)).
Run ocx service (install/repair), or run the wrapper directly: cmd /c .\opencodex-service.cmd.
Actual result (stdout of the wrapper):
8:12:31.98] was unexpected at this time.
service.log only ever contains the top-level wrapper start header lines; no Bun output and no error line follow. Running the exact same bun <cli> start --port 10100 command by hand with OCX_SERVICE=1 works fine, so the failure is in the wrapper itself.
Root cause
src/service/windows-taskxml.ts emits echo [%DATE% %TIME%] ... inside parenthesised if (...) / for (...) blocks (the installation is incomplete, child exited with code, and restored previous install lines, roughly lines 101, 108, 113, 133). cmd.exe expands %DATE% while parsing the whole block, so the ) in (土) closes the block early and the rest of the line is a syntax error. The whole batch file is rejected at that point, so nothing after the header echo runs.
The top-level echo [%DATE% %TIME%] ... lines (outside any block) are unaffected, which is why the header line is still logged and the failure looks silent. This appears to have been introduced with the restore_backup / integrity-check blocks; the pre-2.5x wrapper started fine on the same machine.
Workaround / suggested fix
Inside blocks, replace %DATE% with a substring that cannot contain parentheses, e.g. %DATE:~0,10%:
- >>"%OCX_SERVICE_LOG%" echo [%DATE% %TIME%] installation is incomplete: ...+ >>"%OCX_SERVICE_LOG%" echo [%DATE:~0,10% %TIME%] installation is incomplete: ...
(same for the CLI-missing line, the child exited with code %ERRORLEVEL% line, and the restored previous install from %%B line). After patching the template and running ocx service repair, the scheduled task launches the proxy normally (verified: wscript -> cmd wrapper -> bun, /healthz reports 2.59.0).
A more robust alternative is a small :log subroutine called from the blocks so that %DATE% is only expanded at top level.
Related hardening
Because the wrapper exits 0 on a parse error, the Task Scheduler RestartOnFailure never triggers, and ocx service only says "no proxy answered". It might be worth having ocx service / ocx doctor smoke-test the generated wrapper (e.g. detect a ... was unexpected at this time. failure) and surface the real cause.
Thanks for taking the time to submit this issue. It was closed automatically because it was not opened with a recognized issue template (Bug report, Feature request, Documentation, or Provider compatibility). Freeform and API-opened issues cannot skip this check.
This looks like a bug report but it does not use the Bug report template headings (for example Description/Log entry instead of Summary).
Please edit the issue to add:
Use the Bug report template, or edit this issue to include: Client or integration, Summary, Reproduction, Version, and Operating system.
Retitling with [Bug]: and applying the bug label alone is not enough without those section headings filled in.
Activity
github-actions commentedon Sep 18, 2026
Issue closed: use an issue template
Thanks for taking the time to submit this issue. It was closed automatically because it was not opened with a recognized issue template (Bug report, Feature request, Documentation, or Provider compatibility). Freeform and API-opened issues cannot skip this check.
Please edit the issue to add:
[Bug]:and applying thebuglabel alone is not enough without those section headings filled in.See the Contributing guide for details.
Once the report passes the automated checks, it will be reopened automatically unless a maintainer has changed its state.
fix(service): tolerate locale dates in Windows service wrappers (carry …