fix(broker): verify worker process before spawn success - #1428
Draft
khaliqgant wants to merge 1 commit into
Draft
Conversation
Contributor
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
agent-relay node agent spawn could report success while the spawned worker process had already exited (e.g. a wrapper that fails to launch its harness) — Command::spawn only proves the wrapper was created, not that it survived. Add a brief stability window after spawn that non-blockingly checks the child is still alive before reporting success; if it already exited, remove the stale registry entry and return the real error (exit status + log path) instead of letting node agent list briefly advertise a dead process. Verified: - cargo test --package agent-relay-broker worker:: (62/62, 4 consecutive clean runs, plus 5 isolated runs of the specific new tests) - Real integration test: RELAY_INTEGRATION_REAL_CLI=1 node --test tests/integration/broker/dist/cli-spawn.test.js (missing-CLI rejection path, 21.5s, real broker)
khaliqgant
force-pushed
the
fix/node-up-enrollment-precedence-and-spawn-reliability
branch
from
August 4, 2026 20:58
b62607f to
5d691f2
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
node agent listcannot show a stale entryThis is a stacked draft on #1425. That base PR supplies the requested Bug A workspace-resolution fix and its regression coverage: explicit flag/environment selection wins the shared workspace ladder, while conflicting persisted enrollment state is surfaced rather than silently re-homing the node. This commit supplies Bug B.
Reproduction evidence
Before this change, spawning a nonexistent provider printed:
The immediate agent list was empty, while the worker log contained
failed to spawn wrapped command.After this change, the same real broker/CLI path exits non-zero with:
The immediate agent list remains empty. A
catcontrol spawn still reports success, appears in the agent list, and releases normally.Validation
env -u AGENT_RELAY_MCP_COMMAND cargo test -p agent-relay-broker --quiet— 853 passed, 4 ignored; integration crates also passedcargo clippy -p agent-relay-broker --lib --bins -- -D warningscargo fmt --all -- --checknpm run typechecknpm run lint— no errors (existing warnings only)npm run format:checknpm test— 1,733 passed; the two existing relayfile stale-daemon tests failed locally, matching the known base-branch issueStack
fix/workspace-restore-rebind) — Bug Amainafter fix(cli): make workspace activation reversible and broker binding explicit #1425 merges