fix(compression): recover abandoned locks and suppress no-op retries - #65775
Closed
the3asic wants to merge 3 commits into
Closed
fix(compression): recover abandoned locks and suppress no-op retries#65775the3asic wants to merge 3 commits into
the3asic wants to merge 3 commits into
Conversation
tonydwb
reviewed
Jul 16, 2026
tonydwb
left a comment
There was a problem hiding this comment.
Code Review Summary
Verdict: Approved (read-only token — formal approval requires write access)
Fixes compression recovery for abandoned locks and suppresses no-op retries.
- Addresses a race condition where compression locks could be abandoned
- Suppresses retry attempts that would be no-ops (nothing to compress)
- Well-scoped changes with clear documentation
- No security concerns
Reviewed by Hermes Agent
teknium1
added a commit
that referenced
this pull request
Jul 23, 2026
…add same-pid self-reclaim guard Hardening on top of the salvaged dead-PID lease reclamation from PR #65775 (@the3asic): - Probe via psutil.pid_exists (hard dependency; CONTRIBUTING.md critical rule #1) with the contributor's os.kill(pid, 0) POSIX probe retained only as a scaffold-phase fallback when psutil is missing. - Same-process holders (pid == os.getpid()) are never probed and never self-reclaimed — another thread's live lease is owned by the lease refresher/release path. - Any probe doubt (exceptions, permission errors) conservatively keeps the lease until normal TTL expiry; Windows stays TTL-only. - Tests: psutil-first dead-pid reclaim (probe call pinned), os.kill fallback path, probe-doubt keeps lease, same-pid no self-reclaim, legacy holder + Windows paths assert NO probe via either API.
teknium1
added a commit
that referenced
this pull request
Jul 23, 2026
…add same-pid self-reclaim guard Hardening on top of the salvaged dead-PID lease reclamation from PR #65775 (@the3asic): - Probe via psutil.pid_exists (hard dependency; CONTRIBUTING.md critical rule #1) with the contributor's os.kill(pid, 0) POSIX probe retained only as a scaffold-phase fallback when psutil is missing. - Same-process holders (pid == os.getpid()) are never probed and never self-reclaimed — another thread's live lease is owned by the lease refresher/release path. - Any probe doubt (exceptions, permission errors) conservatively keeps the lease until normal TTL expiry; Windows stays TTL-only. - Tests: psutil-first dead-pid reclaim (probe call pinned), os.kill fallback path, probe-doubt keeps lease, same-pid no self-reclaim, legacy holder + Windows paths assert NO probe via either API.
Contributor
|
The dead-PID lease reclamation half of this draft landed via salvage PR #70247 with your commits cherry-picked and authorship preserved — thanks @the3asic! Hardening on top: psutil.pid_exists as the probe (per CONTRIBUTING's os.kill(pid,0) ban; it's already a hard dep) and a same-pid self-reclaim guard. The |
randlee
pushed a commit
to randlee/hermes-agent
that referenced
this pull request
Aug 11, 2026
…add same-pid self-reclaim guard Hardening on top of the salvaged dead-PID lease reclamation from PR NousResearch#65775 (@the3asic): - Probe via psutil.pid_exists (hard dependency; CONTRIBUTING.md critical rule #1) with the contributor's os.kill(pid, 0) POSIX probe retained only as a scaffold-phase fallback when psutil is missing. - Same-process holders (pid == os.getpid()) are never probed and never self-reclaimed — another thread's live lease is owned by the lease refresher/release path. - Any probe doubt (exceptions, permission errors) conservatively keeps the lease until normal TTL expiry; Windows stays TTL-only. - Tests: psutil-first dead-pid reclaim (probe call pinned), os.kill fallback path, probe-doubt keeps lease, same-pid no self-reclaim, legacy holder + Windows paths assert NO probe via either API.
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.
What changed
pid=holder isproven dead on POSIX, instead of waiting for the full TTL.
os.kill(pid, 0)destructively there._compress_contextthree timeswhen compression returns an unchanged message count.
no-op compression retry suppression.
Root cause
When a gateway process was killed during compression, its SQLite lease remained
valid for 300 seconds. The replacement gateway repeatedly saw the abandoned
lock and retried compaction. A second issue in the pre-API loop ignored the
documented no-op return contract and emitted three identical compact attempts in
the same turn.
Validation
mainruffpassed for all changed files