Repository navigation
fix(procevent): handle concurrent capture directory setup - #73
Merged
Merged
Conversation
Two extension runners recovered by one reconcile in a fresh home both found state/procevent-inbox and state/procevent-capture-reservations absent. The runner that lost the plain mkdir died with "cannot durably capture the extension result" before polling, leaving its source registered with no handled result. That is the intermittent fm-extension-binding failure "recovered source orphan-first/orphan-second never handled its private result" on fast CI runners. Create both directories with mkdir -p so the loser accepts the directory its sibling just made; the existing private-directory validation still decides whether it is safe.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Intent
Q2246 F (2026-11-18, Jobs page "q2246 f"): fix the flaky test that keeps failing PR 70 (#70) before merging it.
Context: in CI shard "Behavior portable serial 2", the fm-extension-binding tests "recovered source orphan-first/orphan-second never handled its private result" and "an isolated extension conformance section failed" failed on PR 70 three times in a row and on main push runs 43708843416 and 43640005067, while passing locally on both.
That failure is intermittent and is not caused by the diff on #70. On GitHub Actions run 44318731313, only tests/fm-extension-binding.test.sh failed in the Behavior portable serial 2 shard. One attempt failed with "recovered source orphan-first never handled its private result" and then "an isolated extension conformance section failed". The next attempt failed the same way for orphan-second. The source that fails changes between attempts, and the second line is the section coordinator rolling up that one failure. The same orphan-readiness failure also happens on main: push run 43708843416 failed "recovered source orphan-second never handled its private result", and push run 43640005067 failed the same orphan-second message. Local reruns of that section passed. The flake shows on the slower GitHub runners. Fix it so those orphan-readiness cases stop failing in CI.
What Changed
Risk Assessment
✅ Low: This is a two-line
mkdir→mkdir -pchange in the capture inbox and reservation preparers. It matches the pattern already used for every other state directory in the lib, including the capture fallback at fm-procevent-lib.sh:1129. Safety is still enforced by the unchangedfm_procevent_private_directory_valid: it rejects symlinks, foreign ownership, and any mode other than 700. The fix plausibly removes the fresh-home race where two runners recovered by one reconcile both seeprocevent-inboxabsent and the loser dies with "cannot durably capture", which is the exact orphan-first/orphan-second "never handled its private result" failure.Testing
The focused orphan-readiness scenario and default coordinated extension-binding run passed. The process-event suite’s concurrent directory-preparation case also passed; that broader suite later exited 1 at an unrelated detached-listener PPID assertion (expected 1, observed 1084). Evidence logs were saved, and the worktree remained clean.
Evidence: Orphan-readiness integration output
Source: Orphan-readiness integration output
Evidence: Process-event suite output, including the concurrent preparation result
Source: Process-event suite output, including the concurrent preparation result
Evidence: Default extension-binding aggregate output
Source: Default extension-binding aggregate output
Pipeline
Updates from git push no-mistakes
✅ **Intent** - passed
✅ No issues found.
✅ **Rebase** - passed
✅ No issues found.
tests/fm-procevent.test.sh:1912- The new regression test can only hit the race by chance. Six callers spin-wait on a go file, then race the[ ! -e ]/mkdir window across 5 trials. On a quiet machine all 30 calls can still pass with the old plainmkdir, so the test proves the fixed behavior but does not reliably fail before the fix. The callers also busy-spin (while [ ! -e go ]; do kill -0 ...; done) for up to ~15s, which competes for CPU on the same slow 2-core runners where the flake showed up. This is acceptable as-is: the oracle is independent (concurrent first callers must all get a valid private dir), and a deterministic reproduction would need a pre-created-after-check hook the library does not expose. Optionally replace the busy-spin with a shortsleeppoll.tests/fm-extension-binding.test.sh:1276- The requested orphan-readiness recovery and concurrent directory-creation behavior passed. The default extension-binding aggregate and standalone lifecycle-flow run also failed at a separate four-second wait for theresult.silentcrash-recovery runner to finish (tests/fm-extension-binding.test.sh:1276), before orphan recovery ran. A baseline run of that lane passed once, so this appears timing-sensitive. A status-preserving run of the broader process-event suite also failed earlier atreconcile failed after slow publication(tests/fm-procevent.test.sh:219). Fixing these would expand this task to independent timing-sensitive tests; the scope-preserving option is to handle them separately. Expanding may make the full local test paths more reliable, while declining leaves these failures unresolved and could keep CI red. Should this task expand to repair those timing tests, or remain scoped to the reported orphan-readiness race?env -u FM_WAKE_QUEUE FM_EXTENSION_BINDING_SEGMENT=lifecycle-orphan-readiness bash tests/fm-extension-binding.test.shManual live race fixture: six synchronized shell callers invoked the real capture inbox and reservation preparation functions across five fresh state roots; checked return success and mode 0700.env -u FM_WAKE_QUEUE bash tests/fm-extension-binding.test.shenv -u FM_WAKE_QUEUE FM_EXTENSION_BINDING_SEGMENT=lifecycle-flow bash tests/fm-extension-binding.test.shArchived base commit011b8ddfd14981a2d758b69f6470876ecb70c732into a disposable worktree-local directory and ran itslifecycle-flowsegment; removed the copy afterward.env -u FM_WAKE_QUEUE bash tests/fm-procevent.test.shInitialbash tests/fm-procevent.test.sh 2>&1 | tee ...reached the new concurrent-preparation assertion, which passed, but did not produce the suite completion marker; its pipeline did not preserve the test process status.🔧 No changes applied.
2 warnings still open:
tests/fm-procevent.test.sh:4133- The broader process-event suite exited 1 after the concurrent capture-directory case passed. It stopped at the unchanged detached-listener assertion in tests/fm-procevent.test.sh:4133: expected PPID 1, observed PPID 1084. This prevented a suite-wide pass, but did not fail the targeted change scenarios.tests/fm-extension-binding.test.sh:1276- The requested orphan-readiness recovery and concurrent directory-creation behavior passed. The default extension-binding aggregate and standalone lifecycle-flow run also failed at a separate four-second wait for theresult.silentcrash-recovery runner to finish (tests/fm-extension-binding.test.sh:1276), before orphan recovery ran. A baseline run of that lane passed once, so this appears timing-sensitive. A status-preserving run of the broader process-event suite also failed earlier atreconcile failed after slow publication(tests/fm-procevent.test.sh:219). Fixing these would expand this task to independent timing-sensitive tests; the scope-preserving option is to handle them separately. Expanding may make the full local test paths more reliable, while declining leaves these failures unresolved and could keep CI red. Should this task expand to repair those timing tests, or remain scoped to the reported orphan-readiness race?FM_EXTENSION_BINDING_SEGMENT=lifecycle-orphan-readiness bash tests/fm-extension-binding.test.shbash tests/fm-procevent.test.shbash tests/fm-extension-binding.test.shgit status --short✅ **Document** - passed
✅ No issues found.
✅ **Lint** - passed
✅ No issues found.
✅ **Push** - passed
✅ No issues found.