Repository navigation
feat(cli): ensure the daemon explicitly before attaching in the CLI and MCP - #3766
Conversation
|
Size Report
Startup median (7 runs, lower is better):
|
There was a problem hiding this comment.
All reported issues were addressed across 8 files
You’re at about 92% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
d5cc25a to
0bb9f87
Compare
There was a problem hiding this comment.
All reported issues were addressed across 5 files (changes from recent commits).
You’re at about 92% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
0bb9f87 to
ad9f406
Compare
ad9f406 to
b5575cb
Compare
There was a problem hiding this comment.
All reported issues were addressed across 4 files (changes from recent commits).
You’re at about 93% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.
Reply with feedback, questions, or to request a fix.
View guided diff | Turn on auto-fix | Re-trigger cubic
b5575cb to
25a88e0
Compare
There was a problem hiding this comment.
All reported issues were addressed across 5 files (changes from recent commits).
You’re at about 93% of the monthly reviewed-line limit. You may want to disable incremental reviews to conserve quota. Reviews will continue until that limit is exceeded. If you need help avoiding interruptions, please contact contact@cubic.dev.
Requires human review: Auto-approval blocked because this review re-detected 1 unresolved issue already reported by Cubic.
View guided diff | Turn on auto-fix | Re-trigger cubic
25a88e0 to
4178464
Compare
4178464 to
74b7ceb
Compare
8de53bd to
c710506
Compare
c710506 to
932f6f1
Compare
932f6f1 to
20bc45f
Compare
20bc45f to
e1e2b91
Compare
e1e2b91 to
125b4cc
Compare
|
This PR is ready at 125b4cc. I found no problems that should hold it up. All 9 checks that are not passing were cancelled as superseded runs, so there is no failure to attribute, and they need a completed run at 125b4cc before merge. The diff touches their routes, because the CLI default transport is now the ensured one and daemon-replace-exit-flush.test.ts changed. No conflicts. Not blocking, so take or leave these: daemon-client-ensuring.ts:95 maps a daemon that was force-retired as unresponsive to reason 'incompatible', so cli.ts:88 prints "Replaced idle daemon ... it did not match this client", and the 'unreachable' label is inferred from 'missing' plus a previous daemon, so the notice should name how the previous daemon left and ensureDaemon's onStart could report that cause as a declared value; daemon-lifecycle-errors.ts:77, line 61 and daemon-client-timeout.ts:195 now reach CLI and MCP users with hints that name ensureDaemon(), so the hints should hold on every surface (for example, stop it with agent-device daemon stop --state-dir X); command-tools.ts:251 wiring through the default createClient has no test, so one MCP tool-call test could assert that daemonLifecycle 'attach' reaches the transport and that a second call ensures again; and in daemon-client-ensuring.ts:50 the "Settled promises are not kept" comment is wrong (only rejected ones are dropped), I did not run the tests or check:affected, and I did not measure the latency of the extra per-tool-call ensure in MCP. I took the busy/idle census behavior from the base layer without reading its implementation. Nine inline threads from cubic-dev-ai (all P2) no longer apply at this head, so the author can resolve them: r4299317645 (entry deleted only when it matches the relied one), r4299317658 (rejected ensure is dropped), r4299317674 (cli-help excludes device status and release --stale), r4299317719 (commands.md names the exclusions), r4299317737 (CHANGELOG names the census exclusions), r4299430976 (test binds both listeners before closing), r4299430986 (CHANGELOG no longer says idle for an unresponsive daemon), r4299793590 (import promise is memoized), and r4299837292 (a pre-aborted request skips ensuring; a mid-ensure abort is documented and the caller's guard settles it). |
125b4cc to
e9cab3f
Compare
|
Thanks. Taken in e9cab3f:
|
…nd MCP The CLI and MCP now call ensureDaemon() once their config is resolved and attach to what it leaves. A command replaces a daemon from another version or build only if it holds no work, instead of destroying its sessions; a busy one fails the command with daemon-busy. Remote connections and a one-shot replay on its private daemon pass through unchanged. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
e9cab3f to
e1f0bca
Compare
|
The PR is ready at e1f0bca. The earlier pass at 125b4cc was clean, and the nine Cubic threads are now fixed at this head: the lost-daemon cache cleanup, the dropped rejected promise, the help and docs exceptions, the changelog wording, the test port reuse, the shared import promise, and the already-aborted signal case. I read the code but did not run the tests, so the MCP spy behavior through the dynamic import comes from reading, not from a run. Not blocking: The threads from the other reviewer all apply at head, so you can resolve them: #3766 (comment), #3766 (comment), #3766 (comment), #3766 (comment), #3766 (comment), #3766 (comment), #3766 (comment), #3766 (comment), #3766 (comment). No conflicts are known. CI on e1f0bca has not finished: the 22 checks that have not passed are cancelled or queued runs left over from the rebase, and none has failed. Please rerun them and wait for green checks before merge. |
…ment * origin/main: feat(cli): ensure the daemon explicitly before attaching in the CLI and MCP (#3766) feat(client): daemonLifecycle attach mode and ensureDaemon() (#3765) feat(daemon): quiesce request that retires an idle daemon atomically (#3764) fix(daemon): answer a named missing session on the session, not the device (#3701) test: route test/ and scripts/ off the daemon's testing exports (#3733) refactor(plugins): make the plugin framework provider-independent (#3722) fix(apple): name an Xcode too old for its host macOS as a runner startup failure (#3739) # Conflicts: # packages/daemon/src/server/http/daemon-runtime.ts # packages/daemon/src/sessions/handlers/session-appstate-device-runtime.ts # packages/daemon/test/nightly/concurrency-torture/real-scope-serialization.ts # src/__tests__/daemon-registration-owner.test.ts # src/agent-device-client.ts # src/cli.ts # src/cli/commands/proxy.ts # src/daemon-client/daemon-client-lifecycle.ts # src/daemon-client/daemon-client-metadata.ts # src/daemon-client/daemon-client.ts # test/integration/provider-scenarios/harness.ts
…refactor/daemon-runtime-no-process-globals * origin/refactor/host-environment: refactor(daemon): read configuration from the request host instead of the ambient scope test: merge the duplicate test-kit import in the stale provider admission scenarios feat(cli): ensure the daemon explicitly before attaching in the CLI and MCP (#3766) feat(client): daemonLifecycle attach mode and ensureDaemon() (#3765) feat(daemon): quiesce request that retires an idle daemon atomically (#3764) fix(daemon): answer a named missing session on the session, not the device (#3701) test: route test/ and scripts/ off the daemon's testing exports (#3733) refactor(plugins): make the plugin framework provider-independent (#3722) fix(apple): name an Xcode too old for its host macOS as a runner startup failure (#3739) # Conflicts: # packages/daemon/src/server/http/daemon-runtime.ts
Summary
Layer 3 of 3 for #3754 (umbrella #3747); based on #3765. The CLI and MCP stop managing the daemon implicitly.
withEnsuredDaemonwraps the CLI's default transport and each MCP tool call's client. The first request that needs a local daemon callsensureDaemon()once; every request then attaches. A command that never reaches the daemon starts none.daemon-busyinstead of losing its sessions; one without the quiesce capability fails withdaemon-incompatible. Recorded in the changelog and CLI help, and in the client docs.agent-device proxyis unchanged and stays on the managed path.--daemon-base-urlconnections and a one-shotreplay/teston its private ephemeral daemon. A timeout no longer retires an unresponsive daemon from the CLI or MCP (changelog).11 files incl. docs. Closes #3754.
Validation
pnpm check:affected --run --head e1f0bca89a: passed. Tests cover ensure-once, idle replacement, busy refusal before send, remote and private-replay pass-through, and re-ensure after the daemon vanishes. An independent review of layers 1-3 found 7 issues. Five are fixed. Uploads and lease-less holds being outside the census, and quiesce over HTTP with an auth hook, are documented in ADR 0006. A hung but connectable daemon is no longer retired by a CLI timeout; the changelog says so.🤖 Generated with Claude Code