gh-pulse: a lock that names no pid is stale, not pid 0 (0.49.1) - #114
Merged
Merged
Conversation
An empty run.lock read as Number('') = 0, and kill(0, 0) signals our own
process group, so it always looked alive: every daily run since 2026-09-24
refused with 'another gh-pulse run is in progress (pid 0)'. The holder is
now parsed strictly (positive integer or nothing), isAlive refuses pid <= 0,
and the lock is written to a temp file and renamed so a run killed mid-write
cannot leave an empty one behind.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
ThreatCrush Security Scan25 finding(s) HIGH/CRITICAL: 4 | MEDIUM: 12 | LOW: 9
Snippets are redacted; ThreatCrush never prints matched credential material. |
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.
gh-pulse has failed every day since 2026-09-24 with
another gh-pulse run is in progress (pid 0):~/.local/share/gh-pulse/run.lockwas an empty file,Number('')is 0, andprocess.kill(0, 0)signals the caller's own process group, so the lock always looked held.lockHolder()parses the lock strictly: a positive integer, else no holder (empty, 0, negative, garbage all count as stale)isAlive()returns false for pid <= 0 before touchingkillrun.lock.<pid>.tmpand renamed, so a run killed mid-write never leaves an empty lock againTests: three new cases in
test/gh-pulse-client.test.ts(stale texts with an always-alive checker, strict parsing, and the real liveness check against an empty lock). gh-pulse suites 39/39.🤖 Generated with Claude Code