GeezerVison is showing github.com — fix(mcpx): honour a cancelled context in EnsureDaemon (#284) by dezren39 · Pull Request #285 · developing-today/code
Conversation
dezren39
commented
Oct 18, 2026
•
edited by coderabbitai
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Fixes #284.
What
EnsureDaemon (pkgs/mcpx/internal/cli/client.go) ignored a cancelled context: a Ping that failed because the context was cancelled was read as "no daemon", so it spawned a daemon the caller no longer wanted, and the readiness poll (which never selected on ctx.Done()) waited out the full autostart.connectTimeout — 20s by default — before failing with daemon did not become ready instead of context.Canceled.
- Check
ctx.Err() at the top of EnsureDaemon and after each failed Ping, before treating the failure as absence.
- The poll loop now selects on
ctx.Done() alongside the poll interval and returns ctx.Err().
Verification
- Reproduced on main
228019a1 before the fix: already-cancelled context → fake daemon spawned, 3.03s waited (the configured timeout), wrong error.
- New regression tests in
internal/cli/ensuredaemon_test.go:
TestEnsureDaemonAlreadyCancelledContext — prompt context.Canceled, no spawn.
TestEnsureDaemonCancelledWhileWaiting — cancel at 200ms against a 30s timeout returns promptly (ablation: pre-fix this took 30.03s and returned the timeout error).
TestEnsureDaemonNeverReadyStillTimesOut — uncancelled behaviour unchanged: spawns, waits the timeout, same error.
- Full
go test ./internal/cli/ passes; go build ./... clean; go vet clean; changed files gofmt-clean (pre-existing consumer.go formatting drift on main left untouched).
Same defect is tracked for the dezren39/nix copy as dezren39/darwin-nix#233; the fix here follows that issue's suggested approach.
Summary by CodeRabbit
- Bug Fixes
- Daemon startup now responds promptly when an operation is cancelled, including while waiting for the daemon to become ready.
- Existing startup timeout behavior remains in place when the daemon does not become ready.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
EnsureDaemon never checked ctx.Err(): a ping that failed because the
caller's context was cancelled was read as 'no daemon', so it spawned
a daemon anyway and the readiness poll waited out the full
autostart.connectTimeout (20s by default) before failing with
'daemon did not become ready'.
Check ctx.Err() up front and after each failed ping, and select on
ctx.Done() in the poll loop. Regression tests cover the
already-cancelled case, cancellation while waiting, and the unchanged
never-ready timeout.
Codex Review Summary
This comment shows the latest Codex review activity on this pull request.
| Review |
Status |
Commit |
Review trigger |
| 📝 Code Review |
⚠️ Failed 2026-10-18T12:59:23.539857Z |
39d5944 |
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.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.
|
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:
49cf4586-59ac-4f09-b185-0894e3d9c032
📥 Commits
-
Reviewing files that changed from the base of the PR and between 9f3aee8 and 39d5944.
📒 Files selected for processing: 2
-
pkgs/mcpx/internal/cli/client.go
pkgs/mcpx/internal/cli/ensuredaemon_test.go
+-----------------------------+
| I wish to make a complaint. |
+-----------------------------+
\
\ /)/)
( '')
/ |
o(___)
✨ 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.
Uh oh!
There was an error while loading. Please reload this page.
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.
|