Repository navigation
fix(device-lock): publish lock and ticket records whole (CHE-10242) [squash] - #349
Draft
congvc-bot-x99[bot] wants to merge 4 commits into
Draft
congvc-bot-x99[bot] wants to merge 4 commits into
congvc-bot-x99[bot] wants to merge 4 commits into
Conversation
added 4 commits
November 26, 2026 17:48
… ratchet (CHE-10839)
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.
Status
Draft. Head d1bf3d1. Author: x99-claude-sonnet. Needs a different-lab review (RGS-1) on this exact head. The author does not merge.
Change
Stage 1 of CHE-1142. The device lock and queue tickets were created empty, then written. A live worker paused for more than 5 s between the two calls lost its lock or its ticket to the malformed-record reaper.
_publish_exclusive(path, payload)writes the whole record to<name>.<hex>.tmpin the same folder, thenos.links it into place. It always unlinks the temp file. It returns False onFileExistsError. No fsync._try_acquire_owner_lock_unguardedandreservepublish through it. The re-entrant and stale-check branch is unchanged.reservekeeps its name format and its 8 tries.os.linkraises anOSErrorother thanFileExistsError, that call falls back to create-then-write. One warning is logged per process.cleanup_stale_locksalso deletes*.tmpfiles older than 60 s in the lock folder and in each*.queuefolder. Fresh temp files stay._MALFORMED_LOCK_GRACE_SECONDSand the malformed-record reaping stay, for records from older code and for corrupt files.Not changed: the broker handoff path,
transfer_reservation,requeue_starting, every NACK decision, queue order, the Windows retry helpers.Blast Radius
Every caller of
DeviceExecutionLock.acquireandreservegoes through the changed code.graphify affectedlistsdevice_ownership.py,agent_qa/worker.py,bridge_session_service.py,device_pool.py,server_lifecycle.py,sdk/agent.pyandchat_session_worker.pyamong the importers. The lock file is now created with mode 0o600. A temp name matches none of the*.lock,*.waitscanners. A filesystem without hard links keeps today's behavior and logs one warning. A break shows as a failedDeviceBusyErrorpath or as the warning in the log. Proof level: 2 (unit).Evidence
Red on
main(tests 1, 2, 4, 5 and 6 fail, test 3 passes):Green on this head:
uv run ruff format --check .anduv run ruff check .pass.Flake note: one earlier run of the same command, under host load (98 s), failed
test_host_admission.py::test_nack_after_the_worker_spawned_is_refused_and_keeps_the_run. That file then passed 3 times alone and the full command passed again. The cause is not found. TheCIworkflow result is not yet read.Refs CHE-1142