fix: daemonize core-agent and clean up external-process agent#327
Closed
jrothrock wants to merge 4 commits into
Closed
fix: daemonize core-agent and clean up external-process agent#327jrothrock wants to merge 4 commits into
jrothrock wants to merge 4 commits into
Conversation
The core-agent is now launched with --daemonize true so the binary forks itself into a true daemon. No PID is retained by the worker. Fixes two related cluster bugs: 1. Always-spawns bug: start() now returns early when peerRunning() is true instead of calling startProcess() unconditionally. Each worker that starts after the first simply connects to the already- running daemon. 2. Cluster-shutdown bug (issue #117): stopProcess() is now a no-op. Workers can no longer kill the shared core-agent when shutting down or crashing, which previously took down Scout for all other workers in the cluster until a replacement was spawned. This mirrors how the Python agent handles the core-agent lifecycle: launch it, forget the PID, let the daemon manage itself. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… instantly Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…rker-owned stopProcess() is now a no-op; no worker can kill the shared daemon. allowShutdown had no documented behavior and no remaining effect. Stripped from ScoutConfiguration type and all test callsites. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Drop unused TimeoutError import - Remove never-read socketConnected and socketConnectionAttempts fields - Drop unused getPoolStats() private method - Remove stale dangling comment above stopProcess() - Drop unused result variable from socket.write() call Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
6d14ae2 to
6663542
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
--daemonize true,detached: true,proc.unref()) so it outlives any individual workerstopProcess()a no-op — workers must not kill the shared daemonallowShutdownconfig option (lifecycle is no longer worker-owned)external-process.ts(TimeoutError,socketConnected,socketConnectionAttempts,getPoolStats(), stale comment, unusedresultvariable)start()waits for the daemon on first call and resolves instantly on subsequent callsTest plan
npm testsetup()simultaneously🤖 Generated with Claude Code