Repository navigation
Description
Client or integration
Other
Area
Dashboard
Summary
When bun.exe (the opencodex proxy process) is killed by an external process—such as a VPN or Clash for Windows TUN driver loading during network stack reset—the Windows service wrapper (opencodex-service.cmd) fails to restart it. The batch wrapper only restarts on ERRORLEVEL NEQ 0, but TerminateProcess by an external killer often results in ERRORLEVEL=0 or an undefined value. The wrapper therefore treats the kill as a clean exit, terminates normally, and Task Scheduler records success—so RestartOnFailure never triggers.
Expected: The service should detect that bun.exe died (regardless of exit code) and automatically restart it, so the proxy recovers without manual intervention.
Actual: The proxy stays dead until the user manually runs ocx stop && ocx start.
Reproduction
Reproduction
- Install and start the service:
ocx service install
ocx start - Verify proxy is healthy:
curl http://localhost:10100/healthz
:: returns 200 - Open Clash for Windows (or any VPN with TUN/network-filter driver). The problem occurs as soon as the software initializes its network stack—no login or connection required.
- Within seconds, observe that the proxy is dead:
curl -v http://localhost:10100/healthz
:: Connection refused on both ::1 and 127.0.0.1
netstat -ano | findstr 10100
:: (empty — no listener)
ocx status
:: Proxy: not running
5. Check service log — confirms unclean shutdown:
C:\Users\yx.opencodex\service.log
:: Shows: "Previous session (PID xxxxx) did not shut down cleanly"
6. Exiting Clash/VPN does not restore the proxy. Only manual restart works:
ocx stop
ocx start
Frequency: Reproducible every time. Occurs consistently whenever Clash for Windows or 零信任VPN (Sangfor aTrust/EasyConnect) is opened, even without logging in.
Version
2.59.0
Operating system
Windows 11 (Chinese locale), 64-bit
Provider and model
No response
Logs or error output
Screenshots and supporting files
No response
Redacted configuration
Checks
- I searched existing issues and documentation.
- I removed secrets, tokens, account details, request credentials, and personal data.
Activity
lidge-jun commentedon Sep 26, 2026
Fixed on
devby #5938, carried in bug-PR merge train batch 9B, #5985 (merge bf04176). The Windows service wrapper now restarts after zero and crash exits too, and only an explicit stay-out exit code ends it. Thecmdwrapper regression passed on a hosted Windows shard. Closing; please reopen if the service still stays stopped on a build that includes bf04176.