mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-05 06:07:57 +01:00
The /goal pattern. closeRunFromSession closes a run the moment the agent writes
status: ready — the agent grading its own homework (Ralph Wiggum). When a project
declares a definition_of_done (now a first-class profile field, injected into
every dispatch), the close is gated by a DIFFERENT-lineage model:
- dod-gate.ts: verifyDefinitionOfDone(dod, handoff) — gpt-oss-120b (not the
worker's lineage) reads the handoff against the stated bar, returns {met, gap}.
Fail-OPEN (a judge error lets the run close rather than wedge the loop).
- applyDoDGate (pure, unit-tested): a SUCCESS close with an unmet bar is
downgraded to "partial" with the gap written into `next`, so autopilot's
existing continue-loop keeps working instead of stopping. Only gates success;
error/partial are untouched.
- Wired at the control close seam, fire-and-forget + an in-flight guard so the
judge fires at most once per run and never blocks the control response.
This makes "done" an objective, cross-model-verified condition per project —
the lever the loop-engineering literature calls the real one. scripts/test/
dod-gate.ts (7 cases) added to the pre-push suite. tsc=0, eslint=0.
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>