Repository navigation
fix(pod): wait out a brief sharing violation in pod down - #16124
Conversation
Design Review (Fable 5) — ✅ PASSDesign-level review of Design-Verdict: PASS Confirm the required Windows Pod Boot Canary lane is green on this run — it is the only live reproduction of the hold being fixed. [DESIGN-REVIEWED] 80c1eeb Description read[DESCRIPTION-READ] 6beff1b45825443bb84a79b4014447d3850b90c7910f5c5a9d60bec372c82c05 That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with |
GPT 5.6 Review — ✅ no blocking findingsGPT 5.6 completed its review of This comment is updated in place on each push. Review detailsFINDING -- src/kiro_crew/pod/windows.py:162 -- False positive or not applicable? A repository writer can comment: |
First Principles Review (Fable 5) — 🟡 CONCERNSPremise-level review of First-Principles-Verdict: CONCERNS The fix covers one of the two deletes of this wrapper: Not justified as shipped
What this change shipsInventory (4 items) — 3 justifiedIntent:
[FIRST-PRINCIPLES-REVIEWED] 80c1eeb Description read[DESCRIPTION-READ] 06f9d72e3914f94455f39863ae759a1277c6118938034e86fd56ca944cf65214 That sha256 names the PR description this verdict read. Recompute it with |
…e task wrapper On Windows the pod's .cmd wrapper can still be open in a process the backend does not own (Task Scheduler finishing with the action file, an indexer or AV) right after the pod's own processes are drained, so pod down failed with WinError 32 and reported the pod as not zero-residue. Retry only ERROR_SHARING_VIOLATION under a bounded deadline; any other error, or a hold past the deadline, still fails closed.
208590a to
80c1eeb
Compare
Opus 5 Review — ✅ no blocking findingsReviewed Verdict parsed from the review's SHA-scoped output markers for commit False positive or not applicable? A repository writer can comment: |
Problem / Motivation
Goal:
pod downon Windows does not fail just because another process is briefly still reading the pod's task wrapper.Pod Boot Canary (Windows)failed on #16102, a PR that touches no pod code:pod downreturned[WinError 32] The process cannot access the file because it is being used by another process: '...\env\kcboot....KiroCrew.cmd'. HOME and remaining task/run evidence were preserved; this pod is NOT proven zero-residue.Why it matters
The canary is a required Windows lane, so this reds unrelated PRs at random. For a real operator the same hold makes
pod downrefuse and leave the pod's HOME behind, although the pod is fully stopped.Not a goal
stopproves the pod's processes are gone (Job drain, publisher retirement, receipt) or to its fail-closed answer.What changed (motivation → approach → change)
By the time
stopdeletes the.cmd, the pod's own processes are already drained through the boot-contained Job. What can still hold the wrapper open is a process the backend does not own: the Task Scheduler service finishing with the action file, an indexer or AV scanner. Those holds last milliseconds to seconds, and a bareunlinkreads one as a leak.src/kiro_crew/pod/windows.py:_unlink_waiting_out_sharing(path)retriesPermissionErrorwithwinerror == 32(ERROR_SHARING_VIOLATION) every 0.1s for up to 10s, then re-raises it unchanged; every other error raises at once.stopdeletes the wrapper through it.docs/system-specs/common/platform-compat.md: the paragraph on retryingERROR_SHARING_VIOLATIONfor opens gains the delete case and the rule (that one error only, with a deadline).Backwards compatibility
Compatible: a delete that succeeded before succeeds the same way; one that failed for any reason other than a sharing violation fails the same way and as fast. A sharing violation now waits up to 10s before the same failure.
Tests
test/test_pod_windows_stop_race.py, with an injected clock so nothing waits for real:stopreaches the wrapper only through the retrying delete.On Windows: the stop-race, run and liveness pod files plus the 35 tree-scan pin files pass (3042 passed); flake8, mypy and the comment-history gate are clean. The real canary runs on CI.
Manual verification
N/A — unit coverage plus the CI canary; reproducing an outside process's transient hold on demand on a real Task Scheduler host is not practical.
Related Issues
Seen on #16102 (
Pod Boot Canary (Windows)).Pattern harvest
Rule candidate: review-prompt — on Windows, a teardown
unlink/rmdirof a file another process may just have used must retryERROR_SHARING_VIOLATION(only) under a deadline instead of treating the first failure as residue.Checklist