Repository navigation
fix(core): keep a session prune going when another prune runs at the same time - #465
Merged
Merged
Conversation
carryStoppedAt lstats each marker and then opens it. When a faster concurrent prune removed the marker in between, the open threw ENOENT and aborted the slower prune's whole run. A marker that is gone now counts as done.
Council review found the same lstat-then-open race at stopped.json and at stranded coordination records. One helper now opens a file that prune just checked and treats ENOENT as removed by a concurrent prune.
A slower prune could still abort after a faster one removed the whole directory. Under Bun, listing a removed directory fails with ENOENT, and opening one fails as a storage error. The slower prune now treats both as gone and reports nothing, as it already does for files.
A directory open that failed for another reason was ignored when a concurrent prune then removed the entry before the second lstat. The storage error now keeps the ENOENT as its cause, and prune tolerates only that.
Closed
3 tasks done
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.
Closes #453
session pruneno longer aborts when another prune runs at the same time. A slower run used to throw at a step whose target a faster run had already removed, and it lost the list of ids it had pruned. It now treats each such target as done and does not report the id, so exactly one run reports it. Any other error still propagates.The handled steps are the teardown time read from
stopped.json, the marker carry, a permit or lease record read, and the open and listing of the session directory and ofpermits/, including a directory that goes while its open is checked. Under Bun, listing a removed directory through its descriptor fails with ENOENT; Node lists it empty. The tests reproduce the Bun result.Traceability
carryStoppedAtfinishes a prune when another prune runs first at the marker carrymainwith ENOENT~/.pickforge/investigations/453/before.log,r3/after.logfinishes a prune when another prune runs first at %s(teardown time read, directory open, directory listing),finishes a prune when another prune runs first while its directory open is verified,finishes a stranded prune when another prune runs first at %s(a permit read, thepermits/open, thepermits/listing),finishes a retained prune when another prune runs first at the permits/ openpermits/; Bun listing resultmain, 6 on the second revision, and the open-check case on 2439ebc with a plainENOENTfromrealpath~/.pickforge/investigations/453/r3/before-main-source.log,r3/before-r2-source.log,r5/before.log,r5/after.log[], the second returns the id, and the sessions root ends empty~/.pickforge/investigations/453/r5/after.logstill fails on a directory open error other than a concurrent removal~/.pickforge/investigations/453/r4/,r5/after.logfull-suite.sh~/.pickforge/investigations/453/full-r5/pickcheck check --base origin/main --fail-on new,worsened,unmatched; gitleaks on the branch commits~/.pickforge/investigations/453/pickcheck-r5.json,gitleaks-r5.logNo QA pass: the race needs a second prune at one exact step, which only the test hook can place, and the CLI output does not change.
Review
Council of Sol and Fable. The Kimi seat did not run: its provider hit a usage limit during this batch.
retainedStoppedAthad the same race; two nits. Fixed in 59a88d0.rmdirof the retained directory is older than this change: #463.