Three defects kept a hive task pending with its worker idle forever:
1. Nothing consumed the queue. `hive-mind task` only wrote a pending row;
workers are records, not processes. New `hive-mind work` claims the
oldest pending hive task, assigns it to an idle hive worker, runs it
through `claude -p --output-format json`, and records the outcome via
task_complete (or task_update status=failed).
2. task_assign/task_complete/task_cancel synced only
`.claude-flow/agents/store.json`, but hive workers live in
`.claude-flow/agents.json` (#1916). Assignment never marked a hive
worker busy and completion never counted it. They now update
whichever store holds the agent. task_update gains `result` and
frees workers on `failed`.
3. `spawn --claude` fell back to passing `~/.claude.json` as
--mcp-config. Where that file has no top-level `mcpServers` (a fresh
desktop), Claude exits with "Invalid MCP configuration: mcpServers:
Invalid input". The worker config is now always generated: servers
are extracted from the source config, a `ruflo` server pinned to the
running CLI is guaranteed, and CLAUDE_FLOW_CWD points it at the
dispatcher's stores.
Also fixes the "Track with: hive-mind task-status" hint, which named a
subcommand that does not exist.
This reverts commit 5a45b76c8. The fast-path broke trajectory-recovery-3199's
own regression test ("reloads a clean cache after another process adds a
step"): with vi.resetModules() simulating separate processes, a first
process's clean-but-now-stale in-memory copy would win over the freshly
persisted cross-process step, since the fast path never re-read disk when
the local cache was merely clean rather than empty. That's the exact
scenario #3467 was written to fix — the "cost" the fast path removed was
the correctness guarantee, not just overhead. Local runs of the
unmodified #3467 code average 20-46ms on graph-trajectory-hooks-smoke's
200ms budget; the one observed 1171ms CI failure is far more likely
explained by that round's runner queue (this same PR's other jobs sat
queued 40+ minutes on ordinary infra load) than a real regression.
#3467 made loadPendingTrajectory() always do two DB reads (completed +
pending) before returning, even when the trajectory is already tracked
cleanly in-process — turning every trajectory-step/post-task call into
a synchronous round-trip instead of a Map lookup. CI's
graph-trajectory-hooks-smoke (ADR-130 P3, <200ms budget) failed once on
a loaded runner at 1171ms; local runs stayed at 20-46ms, so this was
likely a transient load spike, but the always-hit-disk path was real
overhead regardless. Skip both reads when the id is already a clean
(non-dirty) in-memory hit — the case #3467 didn't change (same-process,
not-yet-restarted). The disk-recovery path #3467 added still runs
exactly when it's needed: on a cache miss (e.g. after an MCP restart).
- plugins/ruflo-adr smoke step 20: #3432 correctly split the memory-db
cwd into a more precise DB_ROOT (nearest .git/.swarm ancestor of ROOT),
but the smoke check still only recognized the literal `cwd: ROOT`
string. Accept `cwd: DB_ROOT` too.
- plugins/ruflo-core smoke step 6: #3428 replaced the old "pinned to
v3.6" CLI compatibility line with an accurate description of the new
resolve-installed-before-npx-fallback contract. Updated the smoke
check to verify that contract's env vars are documented instead of a
version pin that no longer exists.
- session-tools.ts: CodeQL flagged Math.random()-derived session IDs as
insecure randomness in a security context, newly reachable through
#3486's activate path. Switched both session ID generators to
randomUUID(), matching the convention already used in mcp-server.ts
and autopilot-state.ts.