Repository navigation
Description
The problem
We ran two long pipelines over the last three days. Between them, seven agents entered
repetition loops: the same tool call, or a short cycle of them, repeated until something
outside the system intervened. Five different roles, across all three phases. Not one was
detected by the product. Every one of them was caught by a monitor I was running by hand in a
terminal, and cleared by me typing an answer into the bus.
In the same window, the supervision layer was noisy in the other direction. A convergence-stall
alert fired at [high] priority against a coder whose peer heartbeat was seconds old, while the
health monitor was concurrently logging, every 30 seconds, that the same agent was alive. That
alert was then read (by me) as the cause of a 110-minute work loss it had nothing to do with.
The misdiagnosis cost more than the alert would ever have saved. Separately, two agents were
killed at exactly two hours by a timeout none of them could see coming, and both kills were
counted as crashes against the fail-streak budget.
So the layer whose job is to distinguish a working agent from a wedged one was silent for seven
wedged agents and loud at several healthy ones. Both directions have the same consequence: an
operator stops trusting the signal and goes back to watching by hand, which is what happened.
There is one more thing worth stating plainly, because it shaped everything above. While
building that hand-rolled monitor I rewrote the "is this role stuck?" rule five times. Each
version looked obviously correct and each produced false positives against live data. Producers
are legitimately podless between events; reviewers legitimately wait on upstream producers; a
declared no-op leaves its review edges pending forever; a NACK is a verdict and discharges the
obligation just as an ACK does. Two of those five states are not visible in the status payload at
all. Whatever gets built here will hit all five. A detector that cries wolf gets muted, and a
muted detector misses the real stall.
What has already landed, and must not be rebuilt
The last pass over this area produced work that shipped. Verify each of these in the tree and
treat them as done:
- Terminating-Job adoption on the event-loop respawn path (Don't adopt a terminating Job on the event-loop respawn path (#3597) #3613); confirmed working on its
first real test. - A re-attached worktree's uncommitted work is preserved before reset (Preserve a re-attached worktree's uncommitted work before the R6 reset (#3639) #3644, plus Address review feedback on #3644 #3647, Scale the discarded-tip recovery ask to the snapshot's size #3652,
Match the snapshot-softening rule to the noise source, not a file count #3654, Never let a filename cost the working tree #3656, Do not let git add's raw stderr cost the crashed agent's working tree #3660). - Cancel stops the driver (Stop the driver when a pipeline is cancelled (#3633) #3645, plus Address review feedback on #3645 (cancel stops the driver) #3649, Bail out of the HITL gate when the operator cancels #3655, Guard the pre-wait window at every HITL gate on cancel #3657).
- Phase-gate approvals parse on their first line (Read phase-gate approvals on their first line, not the whole string (#3636) #3648).
- Never-heartbeated roles anchor at Job start (health_monitor: anchor never-heartbeated roles at Job start (#3605) #3612).
- The simplifier's first propose is gated on its upstream producer (Gate the simplifier's first propose on its upstream producer (#3603) #3607).
- Green gate defaults to on (Default the slice green gate to on #3609) and a red escalates to HITL (Escalate a green-gate red to HITL, mirroring the evidence gate #3628).
- Every routed call records its decoding config (feat(litellm): record the decoding config of every routed call (#3599) #3611, litellm: read OpenRouter capabilities live, and make drop_params visible #3625).
- Re-reviews are blocking-only (Make re-reviews blocking-only so the feedback loop converges #3661).
That list is what shipped. It is not a statement about what remains.
Areas worth attention
Four, loosely. How you cut them up, order them, or merge them is your call.
-
Signals that exist and are not consulted. In more than one place the information needed to
tell working from wedged is already computed, in the same process, seconds away from the code
that decides. It is not read. Some detectors are also unreachable because an input they require
is never populated. -
Session boundaries read as failures. An agent that simply ran long, or exited cleanly
without emitting the verdict it owed, or whose pod vanished, is currently indistinguishable
from one that crashed. Some of these consume a retry budget or an arm they should not, and at
least one suppresses the very check that would have noticed. -
Loops that nothing detects. This is the seven. One empirical result from the incident
analysis is worth handing over rather than making you rediscover: across every instance,
counting tool inputs never issued before in the session over a trailing window separates a
loop from work cleanly: a working agent produces new ones and a loop of any length produces
none. Two constraints found the hard way: the pod log cannot support this, because tool inputs
are truncated at about 100 characters and distinct commands sharing a prefix collapse together;
and the cycle shape varies (single-input, 2-, 3-, and 8-cycles were all observed), so anything
keyed on a fixed shape or on dominance misses most of them. What to do with that is yours to
decide. -
Alerts an operator cannot act on. Some fire without the evidence that would make them
readable. Some name a threshold whose detector does not exist. Some outcomes are distinguishable
only by which log string was emitted.
What to propose
Two things, and keep them separate.
The work. Decide what is worth doing across those areas, in what order, and what to leave
out. Nothing above is a requirement; if you find something in the list is already handled, drop
it and say where.
A candidate list. Beyond whatever you propose to build, produce a ranked list of further
improvements to this layer that you think are worth making. Every entry must carry a
file-and-symbol citation and a verdict on whether the thing is present or absent in the tree
today. This list is a deliverable in its own right and does not obligate anyone to implement any
of it. It is input to the gate, and the gate decides. Do not defer chosen work into it.
Ground rules
Verify before you build. Some of what looks missing here may already exist; this description
is written from an operator's experience, not from the code. Check the tree before planning
anything, and say what you checked. If something is already implemented, drop it and say so
rather than building it twice.
Scope is yours to propose. If a judgement call would materially change the shape of the work,
raise it as a decision rather than guessing.
Read the prior write-ups critically, or not at all. #3595 is the incident analysis and #3596
was the first pass over this area; both contain superseded plans and at least one hypothesis that
was later disproved. The repository is the source of truth.
This layer is watching you while you change it. Its blind spots are the ones described above,
so do not assume an absence of alerts means anything is fine.
Activity
refiner: analysis + proposal for #3665 supervision layer second pass
simplifier: analysis-draft-human for #3665 supervision layer second pass
simplifier: v2 analysis-draft-human for #3665
simplifier: plan-draft-human for #3665 supervision layer second pass
risk_analyst: assessment for #3665 — plan is correct but duplicates c…
simplifier: v2 plan-draft-human for #3665
architect: analysis + slice decomposition for #3665 — integrate fix c…
architect: publish architect-output artifact for #3665
architect: publish architect-slices scaffold for #3665
risk_analyst: assessment for #3665 — plan is correct but duplicates c…
architect: revise plan for #3665 — integrate fix commit with correcti…
simplifier: v3 plan-draft-human for #3665
docs: document supervision-layer improvements from #3665
coder: enrich _emit_supervision_alert with structured evidence (#3665 …
tester: add tests for #3665 supervision-layer fixes — alert evidence,…
refiner: analysis draft for issue #3665 supervision second pass
simplifier: analysis-draft-human for issue #3665 supervision second pass
simplifier: BRC memory for issue #3665
task_planner: plan draft for issue #3665 supervision second pass
task_planner: add yaml-tasks appendix to plan draft for issue #3665
simplifier: plan-draft-human for issue #3665 — faithful rendering of …
risk_analyst: risk assessment for issue #3665 plan (v1)
risk_analyst: risk assessment output for issue #3665 plan
risk_analyst: restore BRC memory for issue #3665
architect: brc-memory for issue #3665 plan phase
architect: output artifact for issue #3665 plan assessment
architect: output artifact for issue #3665 plan assessment
risk_analyst: re-assessment for issue #3665 plan v3 — all iteration f…
slice-5: lint fixes + file-size allowlist for kubernetes_monitor