Repository navigation
fix(service): stop an update wedging on its own teardown receipts (#8960) - #9062
Conversation
…dge-jun#8960) A Windows `ocx update` claims its handover receipt before the checked stop's Part A admission. When admission refused `unverified-budget` (nothing changed), the receipt stayed on disk. The next stop inherited it and budgeted another 3 s probe on a ~53.5 s baseline against a 60 s deadline, so each refused retry needed more time than the last and the update wedged permanently. - A held snapshotless Part A that changed nothing removes the receipt this run claimed (`windowsPartAHeldUnchanged`): it describes a stop that never happened. - Admission budgets one probe per distinct exact endpoint among inherited receipts (`inheritedTeardownProbeCount`), and the recovery pass asks each endpoint once (`abandonedTeardownProbeOncePerEndpoint`). Invalid, unscannable and guessed-endpoint receipts block without probing, so they cost nothing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
✅ Deterministic PR hygiene checks passed. |
⏳ DRAFT
What to do
Review readiness checklist
0/4 boxes ticked. Automatic draft conversion failed. Please convert this pull request to a draft manually until every box above is ticked. Hygiene✅ Deterministic PR hygiene checks passed. |
|
Caution Review failedThe pull request is closed. No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
|
Maintainer integration (lane W, @lidge-jun) at exact head Changes I added since the author's head
Relaxed merge gate, checked against
Evidence:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 01a61da854
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // #8960: a held Part A that changed nothing owes no teardown, so the receipt this run claimed | ||
| // before it goes too. Kept, the next stop inherits it and budgets one more probe, so each | ||
| // refused retry needed more time than the last and an update could wedge for good. | ||
| if (teardownNonce && windowsPartAHeldUnchanged() && clearPendingTeardown(teardownNonce)) teardownNonce = undefined; |
There was a problem hiding this comment.
Preserve Link claims whose deferral may already be accepted
For a foreground Windows Link Child with native routing, Ctrl+C during Part A's pre-mutation probes can already hand teardown to this receipt: linkNativeTeardownDecision() recognizes the active clientStopOwner and matching claim and returns defer (src/client/stop-native-handoff.ts:98-105), allowing the signal handler to exit without restoring Codex/Grok. If Part A then returns an unchanged refusal, this line deletes the receipt even though teardown is now owed, while ownershipBlocked also skips the parent's restore. When this was the only claim, native routing remains pointed at the dead Child with no pending recovery receipt. Exclude Link claims from this shortcut unless their deferral is proved unaccepted; Part A's mutation flag alone cannot establish that.
Useful? React with 👍 / 👎.
Summary
Fixes the self-perpetuating
ocx updatefailure on Windows described in #8960. That issue was auto-closed for a missing version field, not fixed. I hit it on 2.100.5 → 2.100.7/2.100.8 (Task Scheduler service, ko-KR Windows 11). The failing update printed:and left one more
pending-teardown-*.jsonon every attempt.Two independent causes, both addressed:
claimHandoverBeforeManager). When Part A refusedunverified-budget, it had changed nothing, but the receipt stayed on disk. Now a held snapshotless Part A that changed nothing (windowsPartAHeldUnchanged: no manager stop, no terminate, and therefore no POST) removes the receipt this run claimed. A Part A that changed something keeps it, as before.inheritedTeardownProbeCount). The recovery pass asks each endpoint once (abandonedTeardownProbeOncePerEndpoint), so the budget matches the probes that actually run. Invalid, unscannable and guessed-endpoint receipts block without probing, so they no longer count. Previously, two leftover receipts for the same127.0.0.1:10100pushed the scheduler-only worst case from 53.5 s to 59.5 s against the 60 s deadline.structure/ops/windows-checked-stop.mdis updated to match.Verification
All commands were run on Windows 11 with Bun 1.4.4:
bun run typecheck: no type errors in 2,691 files.bun run structure:check: structure/ SSOT checks passed.bun test tests/windows/windows-stop-ocx-stop.test.ts: 20 pass, 0 fail, including 4 new tests:an update handover refused by Part A (#8960):unverified-budgetwithhandover: trueclaims a nonce, and the receipt no longer exists afterwards.survived(changed) keeps the receipt.inherited receipts are budgeted and probed per endpoint (#8960): covers the endpoint dedupe counts and one probe per endpoint.src/cli/index.tschange reverted,unverified-budget changed nothing: the receipt this run claimed is removedfails (receiptExiststrue).bun test tests/service/connected-stop-capability-auth.test.ts tests/service/stop-deferred-teardown.test.ts tests/windows/windows-stop-callers.test.ts: 199 pass, 9 skip, 0 fail on this branch. The same command gives the same result ondevat 9e0e298.bun run test:changedon this Windows machine had 4–5 failures that varied between runs. All were 5 s test timeouts in the three files above under the parallel runner. Each file passes when run directly, both here and ondev.Checklist
structure/ops/windows-checked-stop.md).🤖 Generated with Claude Code
Review readiness checklist
This PR stays in draft until every box below is ticked. Tick all four boxes once the requirements are met:
Required local validation passed; commands, results, and any full-suite exception are documented.
I pushed my PR to a recent dev commit (at most 10 behind; a maintainer may still ask for the exact tip before merge).
I resolved all correct Codex and CodeRabbit findings.
My PR is ready for review.
Summary by CodeRabbit