Skip to content

Rewrite thread.json before the pending directory is renamed (2.7.1) - #33

Merged
Shavvimal merged 1 commit into
mainfrom
fix/rename-coherent-thread-json
Oct 23, 2026
Merged

Shavvimal merged 1 commit into
mainfrom
fix/rename-coherent-thread-json

Conversation

@Shavvimal

Copy link
Copy Markdown
Owner

Summary

Fixes the ci failure on main at a0c0ada (Python 3.13 only): test_rename_holds_the_thread_lock_before_exposing_the_directory read a renamed run directory whose thread.json still said thread_id: null.

Cause

When a peer reports its thread id, Runner._adopt_thread_id renamed pending-<uuid>/ to <thread-id>/ and only then rewrote thread.json. For an instant the directory existed under its final name with a null id beside a running round. The runner's own readers take the thread lock and never saw it; the test polled the file without the lock and, on a slow worker, hit the window. Present since PR 29; every earlier ci run on main passed.

Fix

  • thread.json is rewritten with the id and the final paths while the directory is still pending-, so it is coherent the moment it appears. A failed rename restores the pending identity before the error propagates.
  • The test poll requires the id and the peer pid together.
  • Version 2.7.1, as the version gate requires for a change under src/cairn/.

Verified

make check green (466 tests). The three rename-sensitive tests ran six times in a row locally without a failure.

… coherent when it appears (2.7.1)

When a peer reports its thread id, the runner renames pending-<uuid>/ to the id and
then rewrote thread.json with the id. For an instant the directory existed under its
final name with thread_id null beside a running round, and a reader without the
thread lock could see it: the 3.13 CI job on main did, in
test_rename_holds_the_thread_lock_before_exposing_the_directory. The file is now
rewritten with the id and the final paths while the directory is still pending; a
failed rename restores the pending identity. The test poll also requires the id, so
the test cannot read inside any remaining window.
@Shavvimal
Shavvimal merged commit 2f315d6 into main Oct 23, 2026
5 checks passed
@Shavvimal
Shavvimal deleted the fix/rename-coherent-thread-json branch October 23, 2026 14:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant