GeezerVison is showing github.com — test(mcpx): regression test for Serve()'s handedOff orphan-DELETE wait by dezren39 · Pull Request #322 · developing-today/code
Conversation
dezren39
commented
Oct 19, 2026
•
edited by coderabbitai
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Problem
Server.Serve()'s handedOff branch — the third of the three waitOrphanTerminations call sites — had no regression test (fixes #319). The shutdown and restart waits are covered; dropping this one-line call would have left the suite green while orphan upstream sessions leaked until expiry.
Solution
New TestSuccessorServeWaitsForABlockedOrphanTerminationOnHandoff in registry_handoff_test.go, reusing the newOrphanUpstream blackhole harness from the sibling tests:
- an old daemon holds a session on a remote server; a successor whose config removed that server takes over (orphan DELETE starts, blocked upstream);
- the successor runs its real
Serve() loop;
- a third daemon takes over from the successor, closing its
handedOff channel;
- Serve must not return while the DELETE is blocked, must return once it completes, and the upstream sees exactly one DELETE.
Verification
- New test passes; ablation-verified: removing
s.waitOrphanTerminations() from Serve's handedOff branch fails it ('Serve returned while the orphan DELETE was still blocked').
- Full
internal/daemon + internal/pool suites green locally; gofmt clean.
Cross-repo set
mcpx lives in both repos; the mirrored test lands in dezren39/nix in the same pass, referencing this origin issue: #319
![Autofix with [code]smith](/api/image?u=https%3A%2F%2Fcamo.githubusercontent.com%2Fef26d88456de9cc93cf03b8611c53675c8af4fc8361b0049e62a133b46e853b6%2F68747470733a2f2f70722d636f6d6d656e74732d6173736574732e626c61636b736d6974682e73682f636f6465736d6974682f6175746f6669782d776974682d636f6465736d6974682d6461726b2e737667)
Need help on this PR? Tag @codesmith-bot with what you need.
Summary by CodeRabbit
- Tests
- Added coverage for daemon handoff behavior when an orphan-session deletion is still in progress, including verification that the deletion completes exactly once before serving exits.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
…LETE
Serve()'s handedOff branch was the only one of the three
waitOrphanTerminations call sites with no regression test (#319).
The new test takes over with a removed server (orphan DELETE
blackholed), runs the successor's real Serve() loop, then hands
off again to a third daemon: Serve must not return until the
DELETE completes, and the upstream sees exactly one DELETE.
Ablation-verified: removing the wait in Serve fails the test.
Codex Review Summary
This comment shows the latest Codex review activity on this pull request.
| Review |
Status |
Commit |
Review trigger |
| 📝 Code Review |
✅ Completed 2026-10-19T00:09:08.050945Z |
e94f334 |
PR opened |
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review" or "@codex security review".
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|

Note Currently processing new changes in this PR. This may take a few minutes, please wait...
⚙️ Run configuration
-
- Configuration used: defaults
- Review profile: CHILL
- Plan: Advanced
- Run ID:
9518fa46-dc17-48a0-a7c5-ef6d176da08b
📥 Commits
-
Reviewing files that changed from the base of the PR and between 38eb38f and e94f334.
📒 Files selected for processing: 1
-
pkgs/mcpx/internal/daemon/registry_handoff_test.go
+----------------------------------------------------------------------+
| I see you chose the 'dynamic typing' difficulty setting. On purpose. |
+----------------------------------------------------------------------+
\
\ (\__/)
(•ㅅ•)
/ づ
✨ Finishing Touches
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Comment @coderabbitai help to get the list of available commands.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e94f334bd0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
if err != nil {
|
|
|
t.Fatalf("second takeover: %v", err)
|
|
|
}
|
|
|
_ = h2.Done()
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wait for the handoff before checking Serve
Handover.Done() only closes the takeover socket; the predecessor’s handOver goroutine closes successor.handedOff asynchronously after its io.Copy observes that close. If that goroutine is delayed for more than 300 ms, this test completes the negative assertion before Serve reaches the branch under test, then unblocks the DELETE and can pass even when s.waitOrphanTerminations() has been removed. Wait for <-successor.handedOff after h2.Done() before asserting that served remains blocked.
Useful? React with 👍 / 👎.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Oct 19, 2026
This was referenced Nov 21, 2026
Uh oh!
There was an error while loading. Please reload this page.
Milestone
No milestone
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.
|