Skip to content

v2.1.9

Choose a tag to compare

@nokhodian nokhodian released this 17 Jul 13:33

Real fix for the "Routing Learning: degenerate" report — not just documented, resolved

Traced the report of an unfixed "8 decisions across 6 sessions... success flag is degenerate" warning, identical across five released versions (2.1.3–2.1.8), to a real production project (/Volumes/SD1/alansari).

Root cause: routing-feedback.jsonl was written only by Claude Code's SessionEnd hook — one entry per session. That project's .monomind/sessions/current.json showed a session that started 2026-07-15T20:39:43Z and has never ended (no endedAt), tied to a persistent monomind org run daemon. routing-feedback.jsonl's last entry was from 13 minutes before that session started; meanwhile intelligence-outcomes.jsonl (fed independently by SubagentStop) kept growing continuously through the same period. Every doctor check against that project was looking at the exact same untouched pre-fix snapshot — not stale/cached output, genuinely unchanged data, because the one event the metric depended on had zero chances to fire.

The fix code from 2.1.5–2.1.8 was already correctly installed there and working — the actual gap was architectural: a session-level signal is the wrong granularity for anyone running long-lived daemon-backed sessions, since "one entry per session" means zero entries for a session that never closes.

Fix: capture-handler.cjs's SubagentStop handler now also writes a routing-feedback.jsonl entry per subagent stop — one per actual routing decision (this subagent spawn), not one per session — using the same per-subagent success signal already computed for intelligence-outcomes.jsonl. SubagentStop fires independently of session boundaries, so the signal now stays live regardless of how long a session runs. The existing SessionEnd write is unchanged and still covers solo/no-subagent sessions that never trigger SubagentStop at all.

Verified live, not just by code trace: reproduced the exact never-ending-session scenario — 3 subagent stops (success/failure/success) with SessionEnd never invoked — and confirmed 3 correctly-ordered routing-feedback.jsonl entries. Added as 2 permanent regression tests. Full capture-handler suite (11/11) and full CLI suite (773/774, 1 pre-existing unrelated flaky test) pass.

Packages published: monomind@2.1.9, @monoes/monomindcli@2.1.9