Repository navigation
Description
Client or integration
CLI / Updater / Process Control
Area
Windows service stop
Environment
- OS: Windows 11 x64 (build 26300), zh-CN locale
- Install: npm global (
@bitkyc08/opencodex) under%APPDATA%\npm - Service: Task Scheduler task
opencodex-proxy - Version observed: 2.100.3 → updating to 2.100.5
Summary
ocx update can wedge itself permanently on Windows by an interaction between two
independent mechanisms in the checked stop:
- Admission budget counts inherited receipts with no cap.
windowsStopWorstCase
addsinheritedReceipts * 3000 mson top of a ~53.5 s baseline, against a fixed
60 s default deadline. Three orphaned receipts are already enough to exceed the
budget forever. Each further failed attempt adds one more. - A refused admission still leaves this run's own receipt on disk.
claimTeardown()
runs before Part A admission. On refusal the stop setsstopFailed/
restoreBlocked, soclearRestoredStopReceiptsis skipped and the nonce survives —
even though the refusal means nothing was changed.
Together they form a monotonic loop: retry → more receipts → higher required budget →
guaranteed refusal. The error text tells the operator to run ocx stop, but ocx stop
takes the same admission path and is refused for the same reason. There is no way out
from the CLI as suggested.
Budget arithmetic (measured against the shipped constants)
WINDOWS_STOP_CAPS with Task Scheduler registered, WinSW absent, PID file present:
| Step | ms |
|---|---|
| part-a | 11000 |
| post-answer | 10000 |
| child-exit | 18000 |
| part-b | 11500 |
| reserve | 3000 |
| baseline | 53500 |
| inherited-receipts (each) | +3000 |
Against the 60 s default:
receipts=0 need=53500 PASS
receipts=1 need=56500 PASS
receipts=2 need=59500 PASS
receipts=3 need=62500 FAIL
receipts=9 need=80500 FAIL
Note the baseline is 53.5 s, and the design doc (#8546) budgets a 56 s plain stop —
so the real headroom is 4–6.5 s, i.e. two orphaned receipts.
Reproduction
- On a Windows machine with the proxy installed as a Task Scheduler service, cause a
stop to fail in a way that leaves its receipt behind (any stop that does not reach
restore; in my case an unrelatedstate-unknownrefusal from [Bug][Windows] zh-CN schtasks status makes ocx stop and ocx update fail closed inside the 1s manager-state cap #8863, plus the Codex
app holding the history DB, which defers the restore and keeps the receipt). - Repeat
ocx updatetwo more times. Each attempt claims one more
pending-teardown-<nonce>.json. - Observe the third attempt fail at admission:
⏹ Stopping the running proxy before updating... ❌ The installed service manager did not stop; it may respawn the proxy. The remaining time cannot hold a verified Windows service stop, so nothing was changed; retry from a terminal. - Run
ocx stopas instructed — it is refused at the same admission check.
Confirmed on disk: 9 receipts, every ownerPid dead, all endpointSource: "exact",
all handover: "update-restart" pointing at the same live proxy port.
What made it recoverable (and why it is not discoverable)
ocx restart goes through the in-place management-API restart, which bypasses
admission entirely. On the following startup, completeUpdateTeardownHandover →
dischargeUpdateTeardownHandovers drops every abandoned update-restart receipt
whose owner is no longer alive. One ocx restart cleared all 9 receipts in a single
step, and the subsequent ocx update then succeeded.
That recovery path is correct behaviour but is not reachable from the error message.
Suggested fixes
A. Do not let inherited-receipts scale the admission budget without a bound.
The row is a pessimistic estimate; recovering one receipt is a single endpoint probe.
Either cap the row (e.g. min(receipts, N) * probe) or drop it from admission and
charge it against the reserve, so an accumulation of receipts cannot make admission
unsatisfiable on its own.
B. Release this run's own receipt when admission refuses.
A refused admission asserts "nothing was changed". The inherited obligations remain
owed, but the nonce claimed by this run was never backed by an action, so it should
be cleared on that path rather than carried into the next attempt.
C. Make the guidance in the failure message actionable.
When the refusal reason is unverified-budget and abandoned receipts exist, the
message should point at a path that actually works (e.g. "run ocx restart to release
abandoned update handovers, then retry"), rather than ocx stop, which is refused
identically.
Notes
- Related but distinct: [Bug]: Interrupted stop during update leaves orphaned pending-teardown receipts, causing subsequent ocx update runs to permanently fail-closed #4897 (fixed liveness filtering of receipts) and [Bug][Windows] zh-CN schtasks status makes ocx stop and ocx update fail closed inside the 1s manager-state cap #8863 (the
zh-CNschtasksstate parsing bug that was my first blocker). [Bug][Windows] zh-CN schtasks status makes ocx stop and ocx update fail closed inside the 1s manager-state cap #8863 is fixed in
2.100.5 and verified fixed; this report is about the layer underneath it. Even on
2.100.5, with 9 receipts present, admission still fails — I re-checked the arithmetic
against 2.100.5's unchangedwindows-stop-budget.ts. - Not a duplicate of fix(service): enforce Windows stop evidence and deadline boundaries #8931 (
fix(service): enforce Windows stop evidence and deadline boundaries), which changes the deadline/evidence boundaries rather than the
receipt-vs-admission interaction. - Platform note: this may affect every locale; the zh-CN locale only affected how I
reached the state.
Activity
coderabbitai commentedon Nov 19, 2026
🔗 Related PRs
#8573 - feat(service): wire the checked Windows stop into every stop path (
#7771slice 2) [merged]📝 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!
github-actions commentedon Nov 19, 2026
Issue closed: insufficient detail
Thanks for taking the time to submit this issue. It was closed automatically because the structured report is missing information needed to evaluate or reproduce it.
Please edit the issue to add:
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): stop an update wedging on its own teardown receipts (#8960