fix(compression): serialize session rotation with durable leases - #64373
Open
yingliang-zhang wants to merge 2 commits into
Open
fix(compression): serialize session rotation with durable leases#64373yingliang-zhang wants to merge 2 commits into
yingliang-zhang wants to merge 2 commits into
Conversation
teknium1
reviewed
Jul 16, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for isolating the late-acquirer race and adding deterministic concurrent coverage.
Problems
- Blocking —
hermes_state.py:2427: the new marker check treats anyend_reason='compression'row as a completed rotation. Rotation is not atomic on current main:agent/conversation_compression.py:868ends the parent, whilecreate_session()follows atagent/conversation_compression.py:896-902. If the process dies in that interval, the lease eventually expires but this check rejects every recovery attempt despite there being no continuation child.
Suggested changes
- Gate the durable rejection on a verified valid continuation child, using the existing child exclusions in
hermes_state.py:3265-3272, or make completion atomic. - Add a test for a compression-ended parent with no child after lease expiry; it should remain recoverable. Keep the new stale-caller test for the completed-child case.
Automated hermes-sweeper review.
This was referenced Jul 21, 2026
yingliang-zhang
force-pushed
the
fix/compression-rotation-durable-lock
branch
3 times, most recently
from
July 30, 2026 05:55
a3e939f to
13cfae6
Compare
yingliang-zhang
force-pushed
the
fix/compression-rotation-durable-lock
branch
3 times, most recently
from
August 12, 2026 05:51
2e866f0 to
ed0d9f0
Compare
…ation Rebuild on current upstream: keep upstream's _session_was_rotated_by_compression recovery path in conversation_compression.py as the sole already-rotated gate. Remove the PR's redundant already_rotated check from try_acquire_compression_lock (it blocked the recovery path). Update PR tests to match upstream semantics.
yingliang-zhang
force-pushed
the
fix/compression-rotation-durable-lock
branch
from
August 12, 2026 06:22
ed0d9f0 to
962bc6a
Compare
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.
Summary
Problem
Two agent instances can hold the same parent session. After one finishes compression rotation, a late caller could reacquire the now-free lease and rotate the completed parent again, creating a sibling continuation.
Changes
end_reason="compression"Verification
37 passed2 passed1 passedACCEPT, no P0–P2 findingspy_compile: passedruff check: passedgit diff --check: passedResidual behavior
The exact legacy hot-reload compatibility path still proceeds unlocked when the live
SessionDBclass structurally lacks the lock API. This preserves the existing compatibility contract until process restart.