Cut fixed per-iteration dispatch overhead in implement-loop; add the missing standard-mode suite gate #29
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Motivation
Measured over local workflow-run telemetry (206 implement-loop runs, 2026-06-17..2026-07-17, 2,883 agent dispatches, ~164.5M non-cache-read tokens): cache_creation is 85.7% of real spend — the cost driver is the number of freshly-primed agent contexts (~40–90k real tokens each), not prompt or output length. The mechanical stages are the biggest size-independent block:
plan-extract14.4M (244 dispatches, each re-reading the same plan for one task),finalize8.0M (pure templating of an already-computed object),preflight7.5M,tree-check3.2M.Separately, an adversarial audit of the pipeline found that standard mode is the only path without an independent end-of-iteration suite gate (mini re-runs the RED test + suite; compiler-driven gates on build + suite; standard's
tree-checkonly counts files).Measures
stats.json/BLOCKED.mdcontents as strings (templates single-sourced in the.js); the return value carries them and the orchestrator writes them byte-identical to the same paths. File contracts unchanged (committedstats.json,BLOCKED.mdconsumed by the tdd decompose path).preflight_okschema field evaluated by the script before anything else; mini mode keeps its dedicated preflight dispatch unchanged.plan-indexadditionally reports a per-task byte estimate; below a conservative total-byte threshold (~20k) oneplan-extract-allcall replaces the per-task fan-out, above it the fan-out stays. Deterministic guard on both paths: delivered task count must match the index count and notask_textmay be empty; a failed extract-all falls back to the fan-out immediately (no single-shot retry). Threshold is on bytes, not task count — truncation (#22: a schema-bound response self-limits to a well-formed prefix) is output-byte-driven. The count-match guard also closes the residual prefix-truncation exposure #22 left in the fan-out's index step.git status --porcelainfootprint. Gates: suite red → BLOCKED. Closes the audit gap above; makes the three execution paths consistent. Known trade-off: a flaky or environment-red suite now blocks a standard iteration — the same exposure mini-verify already has.importantfinding in the set it becomes BLOCKED. Minor-only sets keep the current behaviour.repo_root(falling back to agit rev-parse --show-toplevelreport from the first dispatched stage); the script stampsgit -C <root>into quality / spec / verify prompts. This is the remedy validated in #25 (worktree sessions produced falseinfra_blockedquality reviews and a false no-op BLOCKED from tree-check reading the primary checkout).Rejected variants (design record)
impl.applied_changes == false— inverts the #12 invariant (a self-report must never fail a run that did the work; the initial implementer may legitimately no-op while a repair writes the real change); rejected.git stash createrecovery SHA, is footprint-scoped instead of whole-tree, and is stale on held/no-op exits; snapshot stays.Expected effect
~9–11% of the corpus's real tokens at equal-or-harder gating (three gates get stricter: extract count-match, standard suite gate, severity-aware backstop). Dispatch floor: mini 7→6, standard ~9+4T→~7+4T.