Skip to content

cache warm: fix daemon self-call deadlock (reconcile with #52 daemon-routing) #60

Description

@rodaddy

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 (discoverServiceSchemasdiscoverServiceSchemasViaDaemon), 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

  1. cache warm goes direct (bypass daemon): smallest change, reuses discoverServiceSchemasDirect. Update the [codex] route schema refresh through daemon #52 test to scope its "daemon-routed" assertion to diff/reads, not warm. Need to confirm with the [codex] route schema refresh through daemon #52 author/intent that warm-direct is acceptable.
  2. 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-brain succeeds on the CT216 daemon (no "Daemon failed to start" timeout).
  • open-brain/docs/downstream-rollout.md refresh 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

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions