Skip to content

v5.1.0

  • v5.1.0
  • c99c97e
  • Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
  • Choose a tag to compare

  • v5.1.0
  • c99c97e
  • Choose a tag to compare

  • Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
@lloyal-research lloyal-research tagged this 16 Aug 14:45
* feat(agents): a result now says why its agent stopped

The pool has always known. Every drop site computes a reason and writes it to
the trace as `pool:agentDrop.reason` — `pressure_critical`, `policy_exit`,
`pressure_softcut`, `maxTurns`. `AgentResult` carried only `result`.

So a caller holding a report could not tell one the agent chose to write from
one squeezed out by finishRecovery under a critical kill against a capped
budget. Both are non-empty strings. That distinction is invisible exactly where
it matters most: a `dag` dependent forks from a spine extended with the second
and works from a rushed conclusion with no way to know.

The value was already computed; it just stopped at the trace. It now rides the
Agent and both result mappers — the normal close and the KV-exhaustion partial,
which is the path most likely to produce one.

Scoped deliberately. `pressure_settle_reject` and `settle_stall_break` are
traced but NOT recorded here: they describe a turn being rejected, not an agent
stopping, and folding them in would make one field mean two things.

I30 asserts trace and result agree in BOTH directions. One direction alone is
satisfiable by a bug: "every drop has a reason" passes if the field is set
unconditionally, and its converse passes if it is never set at all.
Mutation-verified — removing the field from the mapper fails one test, setting
it unconditionally fails two.

Found by designing an ability against `dag`, not by reading agent-pool.ts.
575 passed / 2 skipped.

* fix(agents): review — restore the orphaned JSDoc, drop the unreachable branch

Two of four review points were right.

JSDOC. Inserting I30 immediately before `formatResult` left that function's
docblock stranded above the new one, documenting the wrong thing. Moved back.
While there, `RECORDED_EXIT_REASONS` is typed `Set<AgentExitReason>` so adding
a member to the union without teaching the predicate about it fails to compile.

UNREACHABLE BRANCH. The ternary named 'pressure_critical' twice. Entry requires
`policyExit ?? pressure.critical` truthy, so only two cases arrive: the policy
said exit, or it abstained and pressure is critical. `policyExit === false`
never enters — `??` falls through only on null/undefined — so the third branch
could not be reached.

Removing it naively inverted precedence, and the suite caught it: when BOTH
hold, the original attributed 'pressure_critical', and the same variable feeds
the trace, so two existing tests failed. Pressure wins; the policy merely
agreed. Kept, and now stated rather than implied.

The other two are declined, with reasons on the PR: `(e as any)` is this file's
established idiom (I29 does the same) and changing it belongs in its own pass;
and 'maxTurns' is the TRACE's own vocabulary (trace-types.ts:129), so
normalising it on AgentResult would mint a second vocabulary plus a mapping
between them — the exact drift I30 exists to prevent.

575 passed / 2 skipped.
Assets 2
Loading