Summary
Scheduler keeps injecting P0: Decompose middleware task task-XXX after max-turns failure prompts for task IDs that have no record in the canonical store (memory/state/task-events.jsonl) and are not surfaced by the live middleware. The decompose lane re-fires every cycle on these orphan IDs, polluting Kuro's prompt header and burning tokens on phantom triage.
Evidence (this cycle, 2026-05-07T17:19Z)
Three IDs appeared as P0 in the scheduler header across the last 2 cycles:
task-1778139204128-8c
task-1778139697719-8i (prior cycle)
task-1778140734878-8v (both cycles → re-injected)
task-1778141186699-91 (this cycle, new)
Verifications run:
$ for tid in task-1778141186699-91 task-1778140734878-8v task-1778139204128-8c; do
echo "$tid: $(grep -c "$tid" memory/state/task-events.jsonl)"
done
task-1778141186699-91: 0
task-1778140734878-8v: 0
task-1778139204128-8c: 0
$ grep -rE "1778141186699-91|1778140734878-8v" memory/ # only my own analysis note
memory/topics/p0-stale-signal-lag-pattern-2026-05-07.md:- `task-1778140734878-8v`
$ curl -s http://localhost:3200/health
{"status":"ok","service":"agent-middleware","tasks":39, ...}
$ curl -s http://localhost:3200/api/tasks
404 Not Found
So:
- Middleware is healthy (39 tasks tracked internally).
- The IDs in the P0 prompt are not in
task-events.jsonl.
- There is no public
/api/tasks endpoint to verify against.
- Re-injection across cycles is confirmed (
8v appeared in two consecutive prompt headers).
Root cause hypothesis
signal:max_turns_failure fires before the orphan-check step that the design assumes. If a task gets cleared from the working set but its failure marker lives in a separate (volatile) buffer, the decompose lane has no way to confirm the task still exists and re-fires forever.
Proposed fix
Decompose lane should pre-check task existence in task-events.jsonl (and/or the live middleware task store) before emitting the P0 prompt:
// pseudocode in the scheduler / decompose handler
function shouldFireDecompose(taskId: string): boolean {
const inEvents = grepEventsFor(taskId);
const inLiveStore = middleware.tasks.has(taskId);
if (!inEvents && !inLiveStore) {
log.debug(`drop stale max-turns signal for ${taskId} (no record)`);
return false;
}
return true;
}
Add a metric/log counter scheduler.stale_decompose_dropped so we can confirm the fix without waiting for prompt headers to clean up.
Acceptance
- Next cycle's prompt header does not contain
task-1778141186699-91 or task-1778140734878-8v if they remain absent from task-events.jsonl.
- A single warning log (or metric increment) is emitted for each dropped stale signal so the issue stays observable.
Related
memory/topics/p0-stale-signal-lag-pattern-2026-05-07.md (full investigation note)
Summary
Scheduler keeps injecting
P0: Decompose middleware task task-XXX after max-turns failureprompts for task IDs that have no record in the canonical store (memory/state/task-events.jsonl) and are not surfaced by the live middleware. The decompose lane re-fires every cycle on these orphan IDs, polluting Kuro's prompt header and burning tokens on phantom triage.Evidence (this cycle, 2026-05-07T17:19Z)
Three IDs appeared as P0 in the scheduler header across the last 2 cycles:
task-1778139204128-8ctask-1778139697719-8i(prior cycle)task-1778140734878-8v(both cycles → re-injected)task-1778141186699-91(this cycle, new)Verifications run:
So:
task-events.jsonl./api/tasksendpoint to verify against.8vappeared in two consecutive prompt headers).Root cause hypothesis
signal:max_turns_failurefires before the orphan-check step that the design assumes. If a task gets cleared from the working set but its failure marker lives in a separate (volatile) buffer, the decompose lane has no way to confirm the task still exists and re-fires forever.Proposed fix
Decompose lane should pre-check task existence in
task-events.jsonl(and/or the live middleware task store) before emitting the P0 prompt:Add a metric/log counter
scheduler.stale_decompose_droppedso we can confirm the fix without waiting for prompt headers to clean up.Acceptance
task-1778141186699-91ortask-1778140734878-8vif they remain absent fromtask-events.jsonl.Related
memory/topics/p0-stale-signal-lag-pattern-2026-05-07.md(full investigation note)