Repository navigation
cache warm: fix daemon self-call deadlock (reconcile with #52 daemon-routing) #60
Description
Problem
mcp2cli cache warm <service> deadlocks on the daemon for a daemon-routed service:
mcp2cli cache warm open-brain
# -> open-brain: failed (Failed to communicate with daemon: Daemon failed to start within 10000ms)
cache warm routes its refetch THROUGH the daemon (discoverServiceSchemas → discoverServiceSchemasViaDaemon), which self-calls the same running daemon process and times out. This makes the documented refresh step in open-brain/docs/downstream-rollout.md non-functional on CT216.
Why it's split from #58
Split out of #58 / PR #59 by decision: the obvious fix (route cache warm direct, bypassing the daemon via the existing discoverServiceSchemasDirect path) partially reverses PR #52 "[codex] route schema refresh through daemon", which deliberately made these commands daemon-routed (enforced by tests/cli/daemon-routed-discovery.test.ts, which mocks direct transports to throw). The direct path does resolve credentials safely (imports the Vaultwarden resolver), so it's not a security bypass — but reversing a prior intentional decision deserves its own focused PR + review.
Note: #58's invalidation core does NOT depend on this — the drift-hook repopulation already routes around the self-call by reusing the already-open pool connection. This is purely the standalone cache warm command.
Options
cache warmgoes direct (bypass daemon): smallest change, reusesdiscoverServiceSchemasDirect. Update the [codex] route schema refresh through daemon #52 test to scope its "daemon-routed" assertion todiff/reads, notwarm. Need to confirm with the [codex] route schema refresh through daemon #52 author/intent that warm-direct is acceptable.- Keep daemon-routed; fix the self-call: detect the running daemon and reuse its own connection for the warm fetch instead of dialing a fresh daemon. Preserves [codex] route schema refresh through daemon #52 fully; larger daemon-internals change.
Acceptance
mcp2cli cache warm open-brainsucceeds on the CT216 daemon (no "Daemon failed to start" timeout).open-brain/docs/downstream-rollout.mdrefresh step works as documented (coordinate with the OB-side known-issue note).- [codex] route schema refresh through daemon #52's daemon-routing intent is either preserved or explicitly, reviewably amended.
Related
- Schema cache serves stale tool schema after upstream contract bump (no invalidation on version change) #58 / PR fix(cache): invalidate schema cache on contract change (#58) #59 (cache staleness invalidation — landed
cache warm --forceand the coherence core) - [codex] route schema refresh through daemon #52 (route schema refresh through daemon)
🤖 Generated with Claude Code
Activity