Repository navigation
Description
Client or integration
Codex App
Area
Service lifecycle
Summary
On Korean Windows (ko-KR), the Task Scheduler service never launches the proxy. The generated wrapper %USERPROFILE%\.opencodex\opencodex-service.cmd stops parsing before the bun line, so opencodex-proxy fires at every logon/unlock, appends its 7-line header to service.log, and exits silently. Last Run Result stays 0 (wscript does not propagate the batch exit code), so RestartOnFailure never engages either. The proxy only runs when started by hand, and Codex cannot connect until then.
This is the same defect as #5093 (ja-JP, 2.59.0), which was auto-closed by the issue-quality bot as not planned (missing template headings) and never fixed — the offending template lines are still present in 2.73.0.
Root cause: cmd.exe percent-expands %DATE% while parsing a parenthesized block, before the if condition is evaluated. The ko-KR short date is 2026-09-30(수); the ) inside the expanded value closes the block early, the remainder becomes a syntax error, and cmd aborts the whole batch. Since the block is dead code when the runtime files exist, the failure happens on every single start:
if not exist "%OCX_BUN%" (
>>"%OCX_SERVICE_LOG%" echo [%DATE% %TIME%] installation is incomplete: bundled Bun is missing; reinstall opencodex, then run ocx service repair
exit /b 3
)The parse error goes to the hidden wscript console, so nothing is visible anywhere. Top-level echo [%DATE% %TIME%] lines outside blocks are unaffected, which is why the header block still lands in service.log and the failure looks silent.
Impact data from this machine: 9,459 lines of service.log (2026-08-19 → 2026-09-30) contain exactly one proxy startup banner (2026-09-07, presumably an older template generation) and zero child exited lines — every wrapper block ends at the token_file= echo. Instrumenting the generated wrapper confirmed execution stops between that echo and the bun launch line.
Reproduction
Minimal repro of the parse abort (any ko-KR/ja-JP machine, no opencodex needed):
@echo off
if not exist "C:\definitely-missing-file.xyz" (
echo [%DATE% %TIME%] installation is incomplete
exit /b 3
)
echo REACHED-AFTER-BLOCK$ cmd /c date-paren-repro.cmd
12:16:55.17]은(는) 예상되지 않습니다. <- "...was unexpected at this time." (ko-KR cmd)
EXIT=255
REACHED-AFTER-BLOCK is never printed — the batch dies at the block even though the condition is false. The 12:16:55.17] fragment is the tail of the expanded %TIME% after the date's ) closed the block, matching the 8:12:31.98] was unexpected at this time. output in #5093.
Full repro with opencodex:
- Windows with a locale whose short date contains parentheses — ko-KR (
2026-09-30(수)); ja-JP per [Bug][Windows] Service wrapper fails to parse on locales where %DATE% contains parentheses (e.g. ja-JP); proxy never starts under Task Scheduler #5093 (2026/09/19 (土)). npm i -g @bitkyc08/opencodex(2.73.0), thenocx service install(orrepair).schtasks /run /tn opencodex-proxy(or just relogon).- Actual:
service.loggains only thewrapper startheader block;curl http://127.0.0.1:10100/healthznever answers; nobun.exeprocess; task showsLast Run Result: 0.ocx service repairreports "repaired" but nothing serves.
Running the same bun <cli> start --port 10100 by hand with OCX_SERVICE=1 works fine, so the failure is purely in the wrapper.
Template source: src/service/windows-taskxml.ts — the two installation is incomplete lines (~105, ~112) sit inside if not exist (...) blocks, and restored previous install from %%B has the same pattern inside the nested for parens of :restore_backup.
Version
2.73.0
Operating system
Windows 11 Pro (10.0.26100), system locale ko-KR
Logs or error output
service.log after schtasks /run — the block always ends at token_file, nothing follows, no bun process (paths shortened):
[2026-09-30(수) 11:23:58.85] opencodex service wrapper start
bun="...\npm\node_modules\@bitkyc08\opencodex\node_modules\bun\bin\bun.exe"
bun_source="bundled"
cli="...\npm\node_modules\@bitkyc08\opencodex\src\cli\index.ts"
opencodex_home=""
codex_home=""
token_file="C:\Users\me\.opencodex\service-api-token"
Screenshots and supporting files
Verified workaround — rewrite the wrapper with goto-based flow so no %DATE% is ever expanded inside parentheses. After patching, schtasks /run /tn opencodex-proxy launches bun, /healthz answers, and the log gains runtime files OK; launching bun / child exited with code ... lines:
Working wrapper shape (env/PATH lines elided)
@echo off
setlocal EnableExtensions DisableDelayedExpansion
set "ERRORLEVEL="
cd /d "%USERPROFILE%\.opencodex"
set "OCX_SERVICE=1"
set "OCX_WINDOWS_WRAPPER_PROTOCOL=1"
rem ... same OCX_* / PATH / token lines as the generated wrapper ...
:loop
>>"%OCX_SERVICE_LOG%" echo [%DATE% %TIME%] opencodex service wrapper start
rem ... same header echoes as generated ...
if not exist "%OCX_BUN%" goto bun_missing
if not exist "%OCX_CLI%" goto cli_missing
"%OCX_BUN%" "%OCX_CLI%" start --port 10100 >>"%OCX_SERVICE_LOG%" 2>&1
>>"%OCX_SERVICE_LOG%" echo [%DATE% %TIME%] child exited with code %ERRORLEVEL%
if "%ERRORLEVEL%"=="42" goto stopped
>>"%OCX_SERVICE_LOG%" echo [%DATE% %TIME%] restarting in 5s
ping -n 6 127.0.0.1 >nul
goto loop
:stopped
endlocal
exit /b 0
:bun_missing
>>"%OCX_SERVICE_LOG%" echo [%DATE% %TIME%] installation is incomplete: bundled Bun is missing; reinstall opencodex, then run ocx service repair
endlocal
exit /b 3
:cli_missing
>>"%OCX_SERVICE_LOG%" echo [%DATE% %TIME%] installation is incomplete: CLI entry is missing; reinstall opencodex, then run ocx service repair
endlocal
exit /b 3Suggested template fixes (any one suffices):
setlocal EnableDelayedExpansionand use!DATE!/!TIME!inside blocks — expansion moves to execution time, so parentheses in the value become harmless;- or a small
:logsubroutine so%DATE%only ever expands at top level; - or the
%DATE:~0,10%substring slice suggested in [Bug][Windows] Service wrapper fails to parse on locales where %DATE% contains parentheses (e.g. ja-JP); proxy never starts under Task Scheduler #5093 (note it is locale-shape-dependent).
Two smaller hardening observations from the same debugging session:
- The long-running child holds its
>>service.loghandle open for its whole lifetime; any concurrent wrapper instance then fails its appends withThe process cannot access the file because it is being used by another process, and cmd skips the command entirely when redirect setup fails — so a racing wrapper (logon + unlock + console-connect triggers can overlap with a stray instance) can silently never launch bun. Per-instance child log files avoid it. chcp 65001early in the wrapper also produced silent mid-script stops in fresh Task Scheduler consoles during testing; dropping it changed nothing functionally (the log timestamps were mojibake either way).ocx service repair/ocx doctorcurrently report the service as installed/viable while nothing serves. A one-shot wrapper smoke test (runcmd /conce and look forwas unexpected at this time.or a header-only log) would surface this class of failure immediately.
Checks
- I searched existing issues and documentation. ([Bug][Windows] Service wrapper fails to parse on locales where %DATE% contains parentheses (e.g. ja-JP); proxy never starts under Task Scheduler #5093 reports the identical defect and was auto-closed as not planned by the template bot; no fix ever landed — the template lines are unchanged in 2.73.0.)
- I removed secrets, tokens, account details, request credentials, and personal data.
Activity
coderabbitai commentedon Sep 30, 2026
📝 Issue Planner
Check the box below or use the
@coderabbitai plancommand to generate an implementation plan and prompts that you can use with your favorite coding assistant.🧪 Issue enrichment is currently in open beta.
To disable automatic issue enrichment, add the following to your
.coderabbit.yaml:💬 Have feedback or questions? Drop into our discord!
Ingwannu commentedon Oct 1, 2026
Confirmed that current dev 6429463 still emits %DATE% inside parenthesized wrapper blocks; closing #5093 did not land a fix. #6298 is the active fix PR, so I am keeping this report open rather than treating the old closure as resolution. Its author reports Windows cmd.exe fixtures; those are the relevant evidence, since Linux skips this path. Before integration it still needs current-dev/head readiness and required CI. An installed old wrapper also needs the documented repair step after a fixed release; this comment does not authorize or perform a live service repair.
github-actions commentedon Oct 1, 2026
Automated translation bookkeeping — detected language: English.
fix(probe): re-anchor standalone wrapper flow check on the single-lin…
fix(service): tolerate locale dates in Windows service wrappers (carry …
lidge-jun commentedon Oct 1, 2026
Fixed on dev by #6391 (8a3a776). It ships in the next release.