-
Notifications
You must be signed in to change notification settings - Fork 0
fix(daemon): fix locking module bugs (GREEN phase) #89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
galligan
wants to merge
1
commit into
p5/daemon/tests
Choose a base branch
from
p5/daemon/impl
base: p5/daemon/tests
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+5
−0
Conversation
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
This was referenced Jan 23, 2026
Contributor
Author
This was referenced Jan 23, 2026
963b2cb to
617ac26
Compare
65c0a0e to
15c0b24
Compare
617ac26 to
800a45d
Compare
This was referenced Jan 23, 2026
15c0b24 to
ade7527
Compare
800a45d to
90ceedc
Compare
This was referenced Jan 23, 2026
Greptile Summary
|
| Filename | Overview |
|---|---|
packages/daemon/src/locking.ts |
Fixed PID validation bug and lock file cleanup bug to improve daemon lifecycle reliability |
Confidence score:5/5
- This PR is safe to merge with minimal risk as it fixes clear bugs without introducing new complexity
- Score reflects targeted bug fixes with proper validation logic and improved resource cleanup handling
- No files require special attention as the changes are straightforward defensive programming improvements
Sequence Diagram
sequenceDiagram
participant User
participant DaemonLocking as "Daemon Locking"
participant FileSystem as "File System"
participant ProcessSystem as "Process System"
User->>DaemonLocking: "acquireDaemonLock(lockPath)"
DaemonLocking->>FileSystem: "Check if lock file exists"
FileSystem-->>DaemonLocking: "File does not exist"
DaemonLocking->>ProcessSystem: "Get current PID"
ProcessSystem-->>DaemonLocking: "Return PID"
DaemonLocking->>FileSystem: "Write PID to lock file"
FileSystem-->>DaemonLocking: "Write successful"
DaemonLocking-->>User: "Return LockHandle"
Note over User: Daemon runs...
User->>DaemonLocking: "releaseDaemonLock(handle)"
DaemonLocking->>FileSystem: "Read lock file content"
FileSystem-->>DaemonLocking: "Return PID content"
DaemonLocking->>DaemonLocking: "Verify PID matches handle"
DaemonLocking->>FileSystem: "Unlink lock file"
FileSystem-->>DaemonLocking: "File removed"
DaemonLocking-->>User: "Lock released"
90ceedc to
9711659
Compare
ade7527 to
c779d8d
Compare
Contributor
Author
|
Restacked and re-submitted after downstack updates. Pre-push tests ran clean; no additional code changes on this branch. |
9711659 to
667ee15
Compare
c779d8d to
3f4f73c
Compare
Contributor
Author
|
Restacked after downstack updates; no additional changes beyond the rebase. Pre-push tests ran clean. |
- isProcessAlive now validates negative PIDs before process.kill() - releaseDaemonLock now properly unlinks file instead of clearing All 23 locking tests pass. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
3f4f73c to
7c38924
Compare
667ee15 to
43735cc
Compare
Contributor
Author
|
Restacked after downstack update (formatRelative test stabilization); no additional changes in this PR. |
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.

All 23 locking tests pass.
Co-Authored-By: Claude Opus 4.5 noreply@anthropic.com
Contributes to #56