From 5af0ba9dbccff6093804e832b24c8f02d6297597 Mon Sep 17 00:00:00 2001 From: Test Date: Wed, 25 Nov 2026 18:20:56 -0500 Subject: [PATCH 01/69] plan(FEAT-LOOP-2026-0251): refuse a missing deliverable before the verification gates run Co-Authored-By: Claude Opus 5.5 --- .../GATE-01.md | 52 ++++++++ .../PLAN.md | 112 ++++++++++++++++++ .../WU-01-produces-before-verify.md | 59 +++++++++ .../WU-02-presence-and-opt-out.md | 50 ++++++++ .../WU-03-retry-note-paths.md | 42 +++++++ .../WU-04-arm-time-lint-and-docs.md | 53 +++++++++ .../WU-90-gate-1-close.md | 41 +++++++ .specfuse/roadmap.md | 12 ++ 8 files changed, 421 insertions(+) create mode 100644 .specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md create mode 100644 .specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PLAN.md create mode 100644 .specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-01-produces-before-verify.md create mode 100644 .specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-02-presence-and-opt-out.md create mode 100644 .specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-03-retry-note-paths.md create mode 100644 .specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-04-arm-time-lint-and-docs.md create mode 100644 .specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md new file mode 100644 index 00000000..117a398f --- /dev/null +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md @@ -0,0 +1,52 @@ +--- +gate: 1 +status: open +feature_oracle: "python3 -m unittest tests.test_fail_fast_deliverables -v -b" +cost_budget_usd: 14.00 +--- + +# Gate 1 — a missing deliverable is refused before any verification gate runs + +## Definition of done + +**Stated as an outcome.** In temporary feature folders, with a stubbed agent session that +leaves a known diff and a `verify_fn` that counts its calls: + +1. **`produces_not_in_diff` early.** An attempt whose diff leaves a declared `produces:` path + untouched, with no `produces_unchanged:` / `produces_amended:` in its RESULT, ends + `produces_not_in_diff` with `verify_fn` called zero times, `verify_seconds: 0` and no + `gate_result` events. The same unit with the path changed calls `verify_fn` once and passes. +2. **Presence early.** `deliverable_missing` (a declared path absent or empty) and + `no_deliverable_files` (the diff names only the unit file and events) are likewise refused + with `verify_fn` never called. +3. **Opt-out.** With `defaults.fail_fast_deliverables: false`, each of the three cases calls + `verify_fn` before refusing, with the same outcome and failure class as today. +4. **Tree and note.** An early refusal keeps or resets the tree per + `defaults.retain_on_guard_refusal`, as the late refusal does; its retry note states that + verification did not run and lists the paths this attempt changed (or says it changed + none). +5. **Arm-time warning.** `specfuse lint` prints a WARN for a dispatchable unit whose `produces:` + path appears nowhere in its body, by full path or file name, and stays silent when it does. +6. **Nothing else changes.** Every existing test of the three guards passes unchanged, apart + from assertions on the order of `verify` and the guard, which are updated and named in the + close. + +The `feature_oracle` proves 1–5. It is red on the current tree; `FEAT-LOOP-2026-0251/T01` is the +walking skeleton that creates `tests/test_fail_fast_deliverables.py` and turns clause 1 green, +with every other class `unittest.skip` naming its owner (T02–T04). A skip surviving to the close +is a hollow oracle. + +## Arming discipline (see `.specfuse/rules/planning-discipline.md`) + +- **One decision, two call sites.** The early and late checks call the same helper; a + duplicated condition is a defect. +- **Positive controls.** Clause 1 pairs a refused attempt with a passing one; clause 3 pairs + the opt-out with the default; clause 5 pairs a mentioned path with an unmentioned one. +- **Counted, not inferred.** "Verification did not run" is asserted by a call counter on + `verify_fn`, never by timing. +- **Expected self-halt.** `loop.py` and `lint_plan.py` are judge surfaces; acknowledge the stop + with your own reason and `/unblock-wu`. + +## Reflection notes + + diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PLAN.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PLAN.md new file mode 100644 index 00000000..a4c9322d --- /dev/null +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PLAN.md @@ -0,0 +1,112 @@ +--- +feature_id: FEAT-LOOP-2026-0251 +title: Refuse a missing deliverable before the verification gates run +slug: fail-fast-deliverables +branch: feat/FEAT-LOOP-2026-0251-fail-fast-deliverables +roadmap_goal: An attempt whose declared deliverable is missing or untouched is refused before any verification gate runs, its retry note names the files it did change, and `specfuse lint` warns before arming when a `produces:` path appears nowhere in its unit's text. +autonomy_default: auto +status: planned +planned_cost_usd: 11.00 +--- + +# Plan: Refuse a missing deliverable before the verification gates run + +Three driver refusals judge only the attempt's diff against the unit's `produces:` list: +`produces_not_in_diff`, `deliverable_missing` and `no_deliverable_files` (`loop.py`, the +deliverable-presence and produces-in-diff guards after `execute_unit_attempt()` returns). +Today they run only after `verify()` has passed, so each refusal pays for a full verification +run first. An operator report measured 19 of 48 non-passing attempts (of 184) ending in one of +these three, and 6 of 26 escalations were `deterministic_refusal_repeat`. + +This feature moves those three decisions ahead of `verify()`, adds the attempt's own changed +paths to their retry note, and adds an arm-time warning for a `produces:` path its unit never +mentions. It does not change what is refused, only when. + +## Decisions (2026-11-25) + +The operator said "take your recommendations" and then accepted this list. Each item is a +recommendation applied on that instruction. + +1. **All three asks of the report, item 3 narrowed.** The retry note already names the missing + path and shows the `produces_unchanged:` / `produces_amended:` fence + (`PRODUCES_REPAIR_EXAMPLE`, #1415). The missing piece is the list of paths the attempt did + change; only that is added. +2. **Autonomy `auto`.** A fresh judge session writes the terminal verdict from evidence only. + `loop.py` and `lint_plan.py` are judge surfaces, so the terminal judge-editing stop fires + before the close: acknowledge it with your own reason and `/unblock-wu`. +3. **One gate**, four substantive units and a terminal `close` (`docs/methodology.md` §6). +4. **Fail-fast covers exactly the three diff-only refusals.** The smoke-import guard, the + closing-deliverable guards and `files_changed_mismatch` stay where they are. +5. **Same tree handling.** An early refusal keeps or resets the tree by the same + `defaults.retain_on_guard_refusal` rule the late one uses, so no finished work is + discarded; its note says verification did not run, never that it passed. +6. **Opt-out for gate-written deliverables.** A deliverable that only a verification gate + writes (a code generator, say) passes the late check today and would be refused by an early + one on every attempt. `defaults.fail_fast_deliverables` in `verification.yml`, read the way + `retain_on_guard_refusal` is, defaults to `true`; `false` restores today's order exactly. +7. **The arm-time lint is a WARN, measured before it ships.** T04 reports how many of this + repository's `done` units it fires on; above 10% it is narrowed before reporting complete + (the #771 lesson: a warning that fires on most features trains operators to ignore it). + +**Out of scope:** moving the smoke-import or closing-deliverable guards; changing +`detect_deterministic_refusal_repeat`; live progress or halt notification; parallel gates or a +result cache. + +## Existing-mechanism search (mandatory — see `.specfuse/rules/planning-discipline.md` §1) + +- **Grep command run:** `grep -n "produces_not_in_diff\|deliverable_missing\|no_deliverable_files\|deterministic_refusal_repeat" specfuse/loop/loop.py` + and `grep -n "produces" specfuse/loop/lint_plan.py` +- **Verdict:** reuse and extend. The three guards exist and run after `verify()`; this feature + reorders them, it does not add a refusal. The retry note exists (`_RETRY_CLASS_HINT`, + `PRODUCES_REPAIR_EXAMPLE`, `format_deliverable_missing_note`). Arm-time `produces:` lints + exist for an already-delivered path (`check_produces_satisfiability`), a directory entry + (`check_produces_shape`) and a Do-not-touch conflict (`check_produces_boundary`); none checks + that the unit's text mentions the path. +- **If reusing:** the produces-in-diff and presence decisions are lifted into callable helpers + so the early and late call sites share one implementation; `prep` sets (FEAT-2026-0057/T04) + are the precedent for a fail-fast step that skips work. + +## Escalation-predicate satisfiability (mandatory for any severity flip — §2) + +n/a — no check changes severity; the new lint is a WARN. + +## Task graph + +```yaml +gates: + - gate: 1 + file: GATE-01.md + work_units: + - id: FEAT-LOOP-2026-0251/T01 + file: WU-01-produces-before-verify.md + depends_on: [] + - id: FEAT-LOOP-2026-0251/T02 + file: WU-02-presence-and-opt-out.md + depends_on: [FEAT-LOOP-2026-0251/T01] + - id: FEAT-LOOP-2026-0251/T03 + file: WU-03-retry-note-paths.md + depends_on: [FEAT-LOOP-2026-0251/T01] + - id: FEAT-LOOP-2026-0251/T04 + file: WU-04-arm-time-lint-and-docs.md + depends_on: [FEAT-LOOP-2026-0251/T02, FEAT-LOOP-2026-0251/T03] + # --- closing sequence: single terminal close (single-gate feature) --- + - id: FEAT-LOOP-2026-0251/G1-CLOSE + file: WU-90-gate-1-close.md + depends_on: [FEAT-LOOP-2026-0251/T01, FEAT-LOOP-2026-0251/T02, FEAT-LOOP-2026-0251/T03, FEAT-LOOP-2026-0251/T04] +``` + +## Post-merge checklist + +- On the next real feature run that hits one of the three refusals, confirm its + `attempt_outcome` carries `verify_seconds: 0` and no `gate_result` events (FEAT-LOOP-2026-0250 + timings), i.e. the refusal really cost no gate run. +- In a project whose gates generate tracked files, confirm `fail_fast_deliverables: false` + restores the old order. + +## Notes + +- LEARNINGS `[FEAT-LOOP-2026-0250/T04]`: a unit that edits `docs/*.md` refreshes its packaged + copy under `specfuse/loop/data/docs/` in the same unit (`scripts/sync-scaffold.sh`). +- LEARNINGS `[FEAT-LOOP-2026-0250/T01]`: a test that validates events through `validate_event` + pins the packaged schemas and clears the validator caches. +- `produces:` lists only `.py` files under `tests/` (#3539). diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-01-produces-before-verify.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-01-produces-before-verify.md new file mode 100644 index 00000000..9808d177 --- /dev/null +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-01-produces-before-verify.md @@ -0,0 +1,59 @@ +--- +id: FEAT-LOOP-2026-0251/T01 +type: implementation +status: pending +attempts: 0 +oracle_env: macos_local +planned_cost_usd: 2.00 +produces: + - specfuse/loop/loop.py + - tests/test_fail_fast_deliverables.py +produces_driver_helper: + - execute_unit_attempt +model: sonnet +effort: medium +--- + +# T01 — walking skeleton: refuse `produces_not_in_diff` before `verify()` + +**Objective.** Make the gate's `feature_oracle` runnable and turn Definition-of-done clause 1 +green. This is the tracer bullet: stubs are allowed here only. + +**Context.** `FEAT-LOOP-2026-0251/T01`; decisions 4 and 5 in `PLAN.md`. + +- Today the produces-in-diff decision (`prod_ok` / `_prod_remaining`, with its + `produces_unchanged:` and `produces_amended:` handling) runs in `run()` after + `execute_unit_attempt()` returns a passing verify. Lift that decision into one helper and + call it after the agent session and before `verify_fn` in `execute_unit_attempt()`. A + refusal there returns without calling `verify_fn`, and the attempt ends + `produces_not_in_diff` with the same failure class, signature and summary as today. +- The late call site keeps working through the same helper (it still guards the + `fail_fast_deliverables: false` path T02 adds), so the condition exists once. +- The early refusal's tree handling goes through `_resolve_guard_refusal_tree`, as the late one + does. Where its note would say verification passed, it must say verification did not run. + +Create `tests/test_fail_fast_deliverables.py`, one class per Definition-of-done clause in +`GATE-01.md`: `TestProducesNotInDiffEarly`, `TestPresenceEarly`, `TestOptOut`, +`TestTreeAndNote`, `TestArmTimeWarning`. Implement clause 1; skip the rest naming T02, T03, T04. + +**Acceptance criteria.** + +1. `tests.test_fail_fast_deliverables.TestProducesNotInDiffEarly` fails on HEAD and passes + after. With a stubbed session leaving a declared `produces:` path untouched and no + justification, the attempt ends `produces_not_in_diff`, `verify_fn`'s call counter is 0, the + attempt's `verify_seconds` is 0 and no `gate_result` event is emitted. The same unit with the + path changed calls `verify_fn` once and passes. +2. The early refusal's `failure_class`, `failure_signature` and `summary` equal what the late + refusal records for the same input (asserted in the class). +3. `python3 -m unittest tests.test_dispatch_skeleton tests.test_gate_timings -b` passes; any + existing test that asserted verify runs before this guard is updated and listed in the + RESULT's notes. + +**Do not touch.** The `deliverable_missing` and `no_deliverable_files` sites and +`verification.yml.example` (T02). Retry-note wording beyond "verification did not run" (T03). +`lint_plan.py` and docs (T04). + +**Verification.** The narrow tier for `implementation`, plus AC3's command. + +**Escalation triggers.** If the diff the late guard reads (the squash) cannot be reproduced +before `verify()` without committing, block with the evidence rather than committing early. diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-02-presence-and-opt-out.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-02-presence-and-opt-out.md new file mode 100644 index 00000000..255b8fe3 --- /dev/null +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-02-presence-and-opt-out.md @@ -0,0 +1,50 @@ +--- +id: FEAT-LOOP-2026-0251/T02 +type: implementation +status: pending +attempts: 0 +oracle_env: macos_local +planned_cost_usd: 1.50 +produces: + - specfuse/loop/loop.py + - .specfuse/verification.yml.example + - specfuse/loop/data/verification.yml.example + - tests/test_fail_fast_deliverables.py +produces_driver_helper: + - execute_unit_attempt +model: sonnet +effort: medium +--- + +# T02 — presence refusals early, and the `fail_fast_deliverables` opt-out + +**Objective.** Turn Definition-of-done clauses 2 and 3 green. + +**Context.** `FEAT-LOOP-2026-0251/T02`; decisions 4 and 6 in `PLAN.md`. + +- Route `deliverable_missing` and `no_deliverable_files` through the same pre-`verify_fn` step + T01 added, each through one helper shared with its late call site. +- Add `resolve_fail_fast_deliverables(verification_cfg)` beside + `resolve_retain_on_guard_refusal`, reading `defaults.fail_fast_deliverables`, default `True`. + `False` skips the early step, so all three refusals run after `verify_fn` exactly as before + this feature. +- Document the key in `.specfuse/verification.yml.example` next to `retain_on_guard_refusal`, + then run `scripts/sync-scaffold.sh` so the packaged copy matches. + +**Acceptance criteria.** + +1. `tests.test_fail_fast_deliverables.TestPresenceEarly` fails on HEAD and passes after: an + absent or empty declared path ends `deliverable_missing`, and a diff naming only the unit + file and events ends `no_deliverable_files`, each with `verify_fn` called 0 times. +2. `TestOptOut` fails on HEAD and passes after: with `fail_fast_deliverables: false`, each of + the three cases calls `verify_fn` once before refusing, with the same outcome and failure + class as the default path. +3. `diff .specfuse/verification.yml.example specfuse/loop/data/verification.yml.example` is + empty. + +**Do not touch.** Retry-note path lists (T03). `lint_plan.py` and docs (T04). + +**Verification.** The narrow tier for `implementation`. + +**Escalation triggers.** If `no_deliverable_files` depends on state only the squash commit +creates, block with the evidence. diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-03-retry-note-paths.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-03-retry-note-paths.md new file mode 100644 index 00000000..38e739a1 --- /dev/null +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-03-retry-note-paths.md @@ -0,0 +1,42 @@ +--- +id: FEAT-LOOP-2026-0251/T03 +type: implementation +status: pending +attempts: 0 +oracle_env: macos_local +planned_cost_usd: 1.00 +produces: + - specfuse/loop/loop.py + - tests/test_fail_fast_deliverables.py +model: sonnet +effort: medium +--- + +# T03 — the retry note lists the paths the attempt did change + +**Objective.** Turn Definition-of-done clause 4 green. + +**Context.** `FEAT-LOOP-2026-0251/T03`; decisions 1 and 5 in `PLAN.md`. The note already names +the missing path and shows `PRODUCES_REPAIR_EXAMPLE`; keep both. + +- For all three refusals, early or late, the retry note gains a line listing the paths this + attempt changed, from the same diff the guard judged, or "this attempt changed no files". + Cap the list (for example, the first 20 paths and a count of the rest) so a large diff + cannot flood the note. +- The early refusal's note says verification did not run, under both tree outcomes + (`retain_on_guard_refusal` true and false). + +**Acceptance criteria.** + +1. `tests.test_fail_fast_deliverables.TestTreeAndNote` fails on HEAD and passes after. It + asserts, for an early `produces_not_in_diff` refusal: the note names the missing path, lists + each changed path, and says verification did not run; with `retain_on_guard_refusal: true` + the tree is kept and with `false` it is reset; an attempt that changed nothing says so. +2. The cap holds: a diff of 30 paths lists 20 and the count of the remaining 10. + +**Do not touch.** The order of the early and late checks (T01, T02). `lint_plan.py` and docs +(T04). + +**Verification.** The narrow tier for `implementation`. + +**Escalation triggers.** None expected. diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-04-arm-time-lint-and-docs.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-04-arm-time-lint-and-docs.md new file mode 100644 index 00000000..ee9850cd --- /dev/null +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-04-arm-time-lint-and-docs.md @@ -0,0 +1,53 @@ +--- +id: FEAT-LOOP-2026-0251/T04 +type: implementation +status: pending +attempts: 0 +oracle_env: macos_local +planned_cost_usd: 1.50 +produces: + - specfuse/loop/lint_plan.py + - docs/methodology.md + - specfuse/loop/data/docs/methodology.md + - tests/test_fail_fast_deliverables.py +model: sonnet +effort: medium +--- + +# T04 — arm-time warning for an unmentioned `produces:` path, and docs + +**Objective.** Turn Definition-of-done clause 5 green and document the new order. + +**Context.** `FEAT-LOOP-2026-0251/T04`; decisions 6 and 7 in `PLAN.md`. Sits beside +`check_produces_satisfiability`, `check_produces_shape` and `check_produces_boundary` in +`lint_plan.py`. + +- Add a WARN check: for each dispatchable unit (not `done`, not `abandoned`), every `produces:` + path must appear in the unit's body by full path or by file name. The message names the unit, + the path, and the post-attempt refusal it pre-empts (`produces_not_in_diff`). +- Measure it on this repository before reporting: count the `done` units across + `.specfuse/features/` whose `produces:` would fire if they were dispatchable, and put the + count and the total in the RESULT's notes. If it exceeds 10% of `done` units with `produces:`, + narrow the match (for example, accept the path's parent directory) and re-measure. +- `docs/methodology.md`: in the outcome table and the guard paragraph that mentions + `retain_on_guard_refusal`, say the three refusals now run before verification unless + `defaults.fail_fast_deliverables` is `false`, and that the retry note lists the changed + paths. Then run `scripts/sync-scaffold.sh`. + +**Acceptance criteria.** + +1. `tests.test_fail_fast_deliverables.TestArmTimeWarning` fails on HEAD and passes after: a + `pending` unit whose `produces:` path its body never names gets the WARN; the same unit + naming the file name gets none; a `done` unit gets none. +2. `specfuse lint` exits 0 on every feature folder under `.specfuse/features/` (WARN only). +3. The RESULT's notes give the measured count and total from the Context bullet. +4. `diff docs/methodology.md specfuse/loop/data/docs/methodology.md` is empty. +5. `grep -c "unittest.skip" tests/test_fail_fast_deliverables.py` prints `0`. + +**Do not touch.** The driver module and its guard sites (T01–T03). + +**Verification.** The narrow tier for `implementation`, plus +`python3 -m unittest tests.test_lint_plan -b`. + +**Escalation triggers.** If no narrowing brings the measured rate to 10% or below, block with +the measurements instead of shipping a noisy warning. diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md new file mode 100644 index 00000000..8b453622 --- /dev/null +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md @@ -0,0 +1,41 @@ +--- +id: FEAT-LOOP-2026-0251/G1-CLOSE +type: close +status: pending +attempts: 0 +oracle_env: macos_local +planned_cost_usd: 5.00 +auto_close_disabled: true +model: sonnet +effort: high +--- + +# G1-CLOSE — terminal close + +**Context.** The feature's only gate: the three diff-only deliverable refusals run before +verification (with an opt-out), their retry note lists the changed paths, and `specfuse lint` +warns on a `produces:` path its unit never mentions. + +**Acceptance criteria.** + +1. `RETROSPECTIVE.md` records, per Definition-of-done clause in `GATE-01.md`, what was proven + and by which test, and that no `unittest.skip` survives in + `tests/test_fail_fast_deliverables.py`. It lists every pre-existing test whose assertion on + the order of verify and guard was changed (clause 6), with why. +2. Each consumer-visible change (the new order, `defaults.fail_fast_deliverables`, the retry + note's path list, the lint WARN) is written with + `python3 -m specfuse.loop.changelog_fragments add`, tracing to `FEAT-LOOP-2026-0251`. +3. A `## Cost analysis` reconciles every unit against `planned_cost_usd` and `events.jsonl`, and + reports T04's measured warning rate. +4. "What the loop did NOT verify" names, at minimum: a real project whose gates write a declared + deliverable (the opt-out is tested only with stubs), and real refused attempts on the new + build (every attempt in this feature ran on a build pinned before the change). +5. `specfuse lint --closing` exits 0 before this unit reports `complete`. + +**Do not touch.** Source files under `specfuse/` and `scripts/`. Permitted closing surfaces: +`RETROSPECTIVE.md`, `LEARNINGS-pending.md`, `changelog.d/`, `.specfuse/roadmap.md`. + +**Verification.** `specfuse lint --closing`, plus the gate set in `.specfuse/verification.yml`. + +**Escalation triggers.** A surviving skip, or an early refusal whose outcome or failure class +differs from the late one for the same input: record `not_met` with a follow-up. diff --git a/.specfuse/roadmap.md b/.specfuse/roadmap.md index d647aa84..0c5c355d 100644 --- a/.specfuse/roadmap.md +++ b/.specfuse/roadmap.md @@ -129,6 +129,7 @@ installation a target project copies via `init.sh`. | FEAT-LOOP-2026-0248 | Make `ids migrate --all` safe on a real repository | done | — | [→ archive](roadmap-archive.md#feat-loop-2026-0248) | | FEAT-LOOP-2026-0249 | Changelog fragments: stop concurrent PRs conflicting on CHANGELOG.md | done | — | [→ archive](roadmap-archive.md#feat-loop-2026-0249) | | FEAT-LOOP-2026-0250 | Record verification gate results and durations | done | `.specfuse/features/FEAT-LOOP-2026-0250-gate-timings/` | [→ archive](roadmap-archive.md#feat-loop-2026-0250) | +| FEAT-LOOP-2026-0251 | Refuse a missing deliverable before the verification gates run | planned | `.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/` | [→ detail](#feat-loop-2026-0251) | Status: `planned` → `active` → `done` (or `abandoned`). `deferred` = parked by choice pending an external decision/dependency; resumable (a human flips it @@ -1059,6 +1060,17 @@ So the question is no longer "how do we distil lessons" — that is built and lo **Status: planned.** + +## FEAT-LOOP-2026-0251 — Refuse a missing deliverable before the verification gates run + +**Why.** Three driver refusals (`produces_not_in_diff`, `deliverable_missing`, `no_deliverable_files`) judge only the attempt's diff against `produces:`, yet run only after the full verification run has passed. An operator report measured 19 of 48 non-passing attempts (of 184) ending in one of them, and 6 of 26 escalations as `deterministic_refusal_repeat`. + +**Goal.** Those three refusals run before any verification gate (opt-out `defaults.fail_fast_deliverables: false`), their retry note lists the paths the attempt did change, and `specfuse lint` warns before arming when a `produces:` path appears nowhere in its unit's text. One gate, four units and a terminal close. + +**Out of scope.** Moving the smoke-import or closing-deliverable guards, changing repeat-refusal detection, live progress or halt notification, parallel gates or a result cache. + +**Status: planned.** + ## Notes - Correlation IDs are allocated here, sequentially per year: `FEAT-YYYY-NNNN`. From a94cf1edf61af56e2b75161561eafe1e062a32c4 Mon Sep 17 00:00:00 2001 From: Test Date: Wed, 25 Nov 2026 18:20:56 -0500 Subject: [PATCH 02/69] chore(roadmap): FEAT-LOOP-2026-0251 planned -> active Co-Authored-By: Claude Opus 5.5 --- .../FEAT-LOOP-2026-0251-fail-fast-deliverables/PLAN.md | 2 +- .specfuse/roadmap.md | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PLAN.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PLAN.md index a4c9322d..26a9f7b4 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PLAN.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PLAN.md @@ -5,7 +5,7 @@ slug: fail-fast-deliverables branch: feat/FEAT-LOOP-2026-0251-fail-fast-deliverables roadmap_goal: An attempt whose declared deliverable is missing or untouched is refused before any verification gate runs, its retry note names the files it did change, and `specfuse lint` warns before arming when a `produces:` path appears nowhere in its unit's text. autonomy_default: auto -status: planned +status: active planned_cost_usd: 11.00 --- diff --git a/.specfuse/roadmap.md b/.specfuse/roadmap.md index 0c5c355d..46c4eda1 100644 --- a/.specfuse/roadmap.md +++ b/.specfuse/roadmap.md @@ -129,7 +129,7 @@ installation a target project copies via `init.sh`. | FEAT-LOOP-2026-0248 | Make `ids migrate --all` safe on a real repository | done | — | [→ archive](roadmap-archive.md#feat-loop-2026-0248) | | FEAT-LOOP-2026-0249 | Changelog fragments: stop concurrent PRs conflicting on CHANGELOG.md | done | — | [→ archive](roadmap-archive.md#feat-loop-2026-0249) | | FEAT-LOOP-2026-0250 | Record verification gate results and durations | done | `.specfuse/features/FEAT-LOOP-2026-0250-gate-timings/` | [→ archive](roadmap-archive.md#feat-loop-2026-0250) | -| FEAT-LOOP-2026-0251 | Refuse a missing deliverable before the verification gates run | planned | `.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/` | [→ detail](#feat-loop-2026-0251) | +| FEAT-LOOP-2026-0251 | Refuse a missing deliverable before the verification gates run | active | `.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/` | [→ detail](#feat-loop-2026-0251) | Status: `planned` → `active` → `done` (or `abandoned`). `deferred` = parked by choice pending an external decision/dependency; resumable (a human flips it @@ -1069,7 +1069,7 @@ So the question is no longer "how do we distil lessons" — that is built and lo **Out of scope.** Moving the smoke-import or closing-deliverable guards, changing repeat-refusal detection, live progress or halt notification, parallel gates or a result cache. -**Status: planned.** +**Status: active.** ## Notes From 738052e52d61e10dab79f627e5b7e24b6f8c2adb Mon Sep 17 00:00:00 2001 From: Test Date: Wed, 25 Nov 2026 18:21:07 -0500 Subject: [PATCH 03/69] chore(loop): FEAT-LOOP-2026-0251 build pin recorded Feature: FEAT-LOOP-2026-0251 --- .../FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl | 1 + 1 file changed, 1 insertion(+) create mode 100644 .specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl new file mode 100644 index 00000000..8bf5883e --- /dev/null +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -0,0 +1 @@ +{"timestamp": "2026-11-25T23:21:07.164784+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "driver_build_pinned", "source": "driver", "source_version": "0.33.2", "payload": {"tree": "bd7e508193941835916c63053cc2ec0293e35acc", "path": "/private/var/folders/zc/rgq11x850d78dx_kf1fd4vx80000gn/T/specfuse-pins/bd7e508193941835916c63053cc2ec0293e35acc/specfuse/loop"}} From abe743d2c170273cd3734e296d682228271d9537 Mon Sep 17 00:00:00 2001 From: Test Date: Wed, 25 Nov 2026 18:21:07 -0500 Subject: [PATCH 04/69] chore(loop): FEAT-LOOP-2026-0251 plan baseline snapshot Feature: FEAT-LOOP-2026-0251 --- .../PLAN.baseline.json | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PLAN.baseline.json diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PLAN.baseline.json b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PLAN.baseline.json new file mode 100644 index 00000000..eb7f1c0a --- /dev/null +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PLAN.baseline.json @@ -0,0 +1,39 @@ +{ + "gates": [ + { + "gate": 1, + "work_units": [ + { + "goal": "T01 \u2014 walking skeleton: refuse `produces_not_in_diff` before `verify()`", + "id": "FEAT-LOOP-2026-0251/T01", + "planned_cost_usd": 2.0, + "type": "implementation" + }, + { + "goal": "T02 \u2014 presence refusals early, and the `fail_fast_deliverables` opt-out", + "id": "FEAT-LOOP-2026-0251/T02", + "planned_cost_usd": 1.5, + "type": "implementation" + }, + { + "goal": "T03 \u2014 the retry note lists the paths the attempt did change", + "id": "FEAT-LOOP-2026-0251/T03", + "planned_cost_usd": 1.0, + "type": "implementation" + }, + { + "goal": "T04 \u2014 arm-time warning for an unmentioned `produces:` path, and docs", + "id": "FEAT-LOOP-2026-0251/T04", + "planned_cost_usd": 1.5, + "type": "implementation" + }, + { + "goal": "G1-CLOSE \u2014 terminal close", + "id": "FEAT-LOOP-2026-0251/G1-CLOSE", + "planned_cost_usd": 5.0, + "type": "close" + } + ] + } + ] +} From fbf55167a5ee367f150f69be9a34cdcc785bfbab Mon Sep 17 00:00:00 2001 From: Test Date: Wed, 25 Nov 2026 18:27:12 -0500 Subject: [PATCH 05/69] =?UTF-8?q?feat:=20T01=20=E2=80=94=20walking=20skele?= =?UTF-8?q?ton:=20refuse=20`produces=5Fnot=5Fin=5Fdiff`=20before=20`verify?= =?UTF-8?q?()`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Feature: FEAT-LOOP-2026-0251/T01 --- .../PROGRESS.md | 2 + .../WU-01-produces-before-verify.md | 11 +- specfuse/loop/loop.py | 317 +++++++++++++----- tests/test_fail_fast_deliverables.py | 219 ++++++++++++ tests/test_files_changed_auto_repair.py | 6 +- 5 files changed, 459 insertions(+), 96 deletions(-) create mode 100644 .specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md create mode 100644 tests/test_fail_fast_deliverables.py diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md new file mode 100644 index 00000000..66770075 --- /dev/null +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md @@ -0,0 +1,2 @@ +- **FEAT-LOOP-2026-0251/T01**: execute_unit_attempt now refuses an untouched, unjustified produces path before verify_fn, using the same decision and refusal helpers as the late post-squash site; added the gate oracle test file with clause 1 implemented. + - note: T02: early_produces_refusal returns None whenever assert_declared_deliverables or assert_implementation_touched_files would refuse, so those keep their own outcomes until you move them early; it reads the pending diff through pending_squash_names (scratch index), and the produces amendment is applied only at the late site, after verify. diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-01-produces-before-verify.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-01-produces-before-verify.md index 9808d177..d30644d8 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-01-produces-before-verify.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-01-produces-before-verify.md @@ -1,8 +1,8 @@ --- id: FEAT-LOOP-2026-0251/T01 type: implementation -status: pending -attempts: 0 +status: done +attempts: 1 oracle_env: macos_local planned_cost_usd: 2.00 produces: @@ -12,6 +12,13 @@ produces_driver_helper: - execute_unit_attempt model: sonnet effort: medium +gate_set: code +driver_version: 0.33.2 +started_at: 2026-11-25T23:21:07.458266+00:00 +duration_seconds: 365.44 +cost_usd: 0.875979 +input_tokens: 26 +output_tokens: 19488 --- # T01 — walking skeleton: refuse `produces_not_in_diff` before `verify()` diff --git a/specfuse/loop/loop.py b/specfuse/loop/loop.py index 17264a22..9cb919f8 100644 --- a/specfuse/loop/loop.py +++ b/specfuse/loop/loop.py @@ -54,6 +54,7 @@ import signal import subprocess import sys +import tempfile import threading import time import types @@ -2860,7 +2861,8 @@ def extract_failure_excerpt(stdout: str, max_chars: int = 500) -> str: def synthesize_retry_directive(failure_class: "str | None", *, - retained: bool = False) -> str: + retained: bool = False, + verification_ran: bool = True) -> str: """Return a forward-looking retry instruction for *failure_class* (#175). Prepended to the failure note fed into the next attempt. The note itself @@ -2876,9 +2878,12 @@ def synthesize_retry_directive(failure_class: "str | None", *, # convergent unit mid-iteration: the tree is retained because # verify() already PASSED on it, and the one thing to avoid is # re-authoring work that is already correct. + verified = ( + "and verification already PASSED on them" if verification_ran + else "but verification did not run on them") lead = ("A bookkeeping guard refused this attempt's pass. The " "previous attempt's edits are STILL PRESENT in the " - "working tree, and verification already PASSED on them " + f"working tree, {verified} " "— re-authoring them is the one thing not to do. Apply " "only the mechanical fix below, then re-emit the RESULT " "block in full. ") @@ -2900,12 +2905,15 @@ def synthesize_retry_directive(failure_class: "str | None", *, hint = _RETRY_CLASS_HINT.get( failure_class or "", "Satisfy every declared gate before declaring done.") + if not verification_ran and not retained: + lead = "The attempt was refused early: verification did not run. " + lead return lead + hint def compose_guard_repair_note( failure_class: "str | None", complaint: str, retained_diff: "str | None", retained: bool, + verification_ran: bool = True, ) -> str: """Build the retry note for a bookkeeping-guard refusal (FEAT-2026-0103). @@ -2916,7 +2924,7 @@ def compose_guard_repair_note( not the instruction itself. """ note = complaint + "\n\n" + synthesize_retry_directive( - failure_class, retained=retained) + failure_class, retained=retained, verification_ran=verification_ran) if retained and retained_diff: note += ( "\n\nRetained diff (your tree is still here):\n\n" @@ -5022,6 +5030,7 @@ def retain_tree_after_refusal( def _resolve_guard_refusal_tree( cfg: dict, head_before: str, events_path: Path, untracked_before, note: str, failure_class: "str | None" = None, + verification_ran: bool = True, ) -> "tuple[str, bool]": """Shared retain-or-reset decision for the four bookkeeping-guard sites. @@ -5033,10 +5042,12 @@ def _resolve_guard_refusal_tree( if resolve_retain_on_guard_refusal(cfg): diff = retain_tree_after_refusal(head_before, events_path, untracked_before=untracked_before) - return compose_guard_repair_note(failure_class, note, diff, True), True + return compose_guard_repair_note( + failure_class, note, diff, True, verification_ran), True reset_preserving_events(head_before, events_path, untracked_before=untracked_before) - return compose_guard_repair_note(failure_class, note, None, False), False + return compose_guard_repair_note( + failure_class, note, None, False, verification_ran), False def apply_diff(diff_text: str) -> bool: @@ -8478,6 +8489,7 @@ def execute_unit_attempt( head_before: str | None = None, prerun_cfg: dict | None = None, gate_file: "Path | None" = None, + untracked_before: "set[str] | frozenset[str]" = frozenset(), ) -> tuple[str, object, dict | None]: """Pre-dispatch + dispatch + parse + (if not blocked) verify cycle. @@ -8493,6 +8505,10 @@ def execute_unit_attempt( "zero_token" — usage reports input_tokens=0 (agent never ran); payload is None "blocked" — agent explicitly emitted status: blocked + "produces_not_in_diff" — a declared `produces:` path is untouched + and unjustified; verify() was NOT called; + payload is {"remaining", "touched"} + (FEAT-LOOP-2026-0251/T01) "passed" — verify() passed AND the files_changed guard found nothing to flag, or found only paths outside `produces:` that @@ -8511,8 +8527,9 @@ def execute_unit_attempt( Backward-compatible dispatch_fn contract: stubs may return either a plain `str` (treated as text-only, usage=None) or `(str, dict|None)`. - `head_before` is the pre-attempt HEAD SHA the files_changed guard - diffs against. None disables the guard — preserved for unit tests that + `head_before` is the pre-attempt HEAD SHA the files_changed guard and the + early produces check diff against; `untracked_before` is the snapshot + `squash_commit` takes. None disables both — preserved for unit tests that exercise this function in isolation without a git working tree. `prerun_cfg` is a `verification.yml`-shaped dict injectable for testing; @@ -8579,6 +8596,15 @@ def execute_unit_attempt( # deciding whether to insert a fix unit instead of escalating. wu.result_block = parse_result_block(stdout or "") return "blocked", reason, usage + # Fail fast (FEAT-LOOP-2026-0251/T01): a refusal that judges only the + # attempt's diff must not first pay for a verification run. + if head_before is not None: + early_block = parse_result_block(stdout or "") + refusal = early_produces_refusal( + wu, head_before, untracked_before, early_block, cfg) + if refusal is not None: + wu.result_block = early_block + return "produces_not_in_diff", refusal, usage _verify_t0 = time.monotonic() try: if _accepts_gate_file(verify_fn): @@ -11525,6 +11551,161 @@ def resolve_produces_amendable(verification_cfg: dict) -> bool: return bool(project.get("produces_amendable", True)) +def decide_produces_in_diff( + wu: WorkUnit, touched: list[str], result_block: "dict | None", cfg: dict, +) -> "tuple[list[str], list[dict], list[dict]]": + """The produces-in-diff decision, shared by the early (pre-verify) and + late (post-squash) call sites (FEAT-LOOP-2026-0251/T01). + + Returns ``(remaining, justified, amended)``. A non-empty *remaining* is a + refusal naming exactly those entries. *amended* is the + ``produces_amended:`` drop the caller may apply with + `apply_produces_amendment`. Pure: nothing is written here, because an + amendment applied before verification passed would outlive the reset of a + failed attempt in `wu.produces`. + """ + remaining, justified = resolve_produces_refusal(wu, touched, result_block) + if not remaining: + return remaining, justified, [] + # Produces-amendment escape hatch (FEAT-2026-0114/T01): a still-unmatched + # entry the RESULT drops under `produces_amended:` with a non-blank reason + # is accepted ONLY when every remaining unmatched entry is covered — a + # partial amendment still refuses so the still-unjustified path's name + # reaches the retry note unchanged. + amendments = produces_amendments(result_block) + dropped = [ + {"path": entry, "reason": amendments[entry.removeprefix("./")]} + for entry in remaining if entry.removeprefix("./") in amendments + ] + if not dropped or len(dropped) != len(remaining): + return remaining, justified, [] + drop_keys = {d["path"].removeprefix("./") for d in dropped} + kept = [p for p in wu.produces + if str(p).removeprefix("./") not in drop_keys] + would_be_empty = wu.type == "implementation" and not kept + if would_be_empty or not resolve_produces_amendable(cfg): + return remaining, justified, [] + return [], justified, dropped + + +def format_produces_refusal(remaining: list[str]) -> "tuple[str, str, str]": + """``(summary, note, failure_signature)`` of a `produces_not_in_diff` + refusal naming *remaining*.""" + summary = ("declared produces path(s) not in this WU's squash diff: " + + ", ".join(remaining)) + note = ( + summary + + "\n\nTwo escape hatches: `produces_unchanged:` " + "— the deliverable already holds at HEAD; " + "`produces_amended:` — the plan named a path " + "this solution did not need." + + "\n\nEach listed path is a deliverable this WU " + "declared in `produces:` but did not change. " + "Either make the declared change this attempt, " + "or — if the deliverable already holds at HEAD — " + "say so in the RESULT block under " + "`produces_unchanged:` with the command and " + "output that show it (result-contract.md, " + "closing obligation 1). Do not declare done " + "while a deliverable is untouched and " + "unjustified." + + "\n\n" + + PRODUCES_REPAIR_EXAMPLE.format(path=remaining[0]) + ) + signature = ", ".join(sorted( + Path(p).name for p in remaining + ))[:100] or "produces_unchanged" + return summary, note, signature + + +def pending_squash_names( + head_before: str, + untracked_before: "set[str] | frozenset[str]" = frozenset(), +) -> "list[str] | None": + """The paths `squash_commit` would put in this attempt's diff, computed + without committing and without touching the real index. + + Mirrors `squash_commit` (`add -A`, then unstage the operator's + pre-existing untracked files) on a throwaway copy of the index, and + filters as `git_diff_names` does. None when git cannot answer. + """ + def run_git(*args: str) -> str: + return subprocess.run( + ["git", *args], capture_output=True, text=True, check=True, + env=env, + ).stdout.strip() + + env = dict(os.environ) + try: + index = Path(run_git("rev-parse", "--git-path", "index")).resolve() + with tempfile.TemporaryDirectory() as tmp: + scratch = Path(tmp) / "index" + if index.exists(): + # copy2 keeps the mtime git's racy-index check relies on. + shutil.copy2(index, scratch) + env["GIT_INDEX_FILE"] = str(scratch) + run_git("add", "-A") + stale = sorted(p for p in untracked_before if Path(p).exists()) + if stale: + run_git("reset", "-q", head_before, "--", *stale) + names = run_git("diff", "--cached", "--name-only", + head_before).splitlines() + except (subprocess.CalledProcessError, OSError) as exc: + print(f" early produces check skipped — {exc}") + return None + return [f for f in names if f and Path(f).name != PROGRESS_FILENAME] + + +def early_produces_refusal( + wu: WorkUnit, head_before: str, + untracked_before: "set[str] | frozenset[str]", + result_block: "dict | None", cfg: dict, +) -> "dict | None": + """The `produces_not_in_diff` refusal decidable before verification, as + ``{"remaining", "touched"}``; None when verification should run. + + Stays silent when the presence or empty-files guard would refuse: those + run first after the squash and keep their own outcome. + """ + if not wu.produces or not assert_declared_deliverables(wu)[0]: + return None + touched = pending_squash_names(head_before, untracked_before) + if touched is None or not assert_implementation_touched_files(wu, touched)[0]: + return None + remaining = decide_produces_in_diff(wu, touched, result_block, cfg)[0] + if not remaining: + return None + return {"remaining": remaining, "touched": touched} + + +def refuse_produces_not_in_diff( + wu: WorkUnit, attempt: int, usage: dict, remaining: list[str], + touched: list[str], *, cfg: dict, head_before: str, events_path: Path, + untracked_before, verification_ran: bool, +) -> "tuple[str, str, dict]": + """Settle the tree and build the record of a `produces_not_in_diff` + refusal for either call site. Returns ``(summary, note, event)``.""" + summary, note, signature = format_produces_refusal(remaining) + if not verification_ran: + note += ("\n\nRefused before the verification gates: verification " + "did not run.") + excerpt = extract_failure_excerpt(note) + note, retained = _resolve_guard_refusal_tree( + cfg, head_before, events_path, untracked_before, note, + failure_class="produces_not_in_diff", + verification_ran=verification_ran, + ) + event = emit_attempt_outcome( + wu, attempt, "produces_not_in_diff", usage, + failure_class="produces_not_in_diff", + failure_signature=signature, + failure_excerpt=excerpt, + files_touched=touched, + extras={"summary": summary, "tree_retained": retained}, + ) + return summary, note, event + + def apply_produces_amendment(wu: WorkUnit, dropped: list[dict]) -> None: """Rewrite *wu*'s `produces:` on disk, dropping *dropped* paths, and record why under `produces_dropped:` (FEAT-2026-0114/T01). @@ -12606,6 +12787,7 @@ def run( wu, feature_dir, failure_note, cost_tracking=cost_tracking, head_before=head_before, prerun_cfg=cfg, gate_file=gate.file, + untracked_before=untracked_before, ) wu_events.extend(build_attempt_gate_events(wu, attempt)) duration = round(time.monotonic() - t0, 3) @@ -12832,6 +13014,28 @@ def run( blocked = True break + if outcome == "produces_not_in_diff": + # Refused before verify() (FEAT-LOOP-2026-0251/T01). + _prod_summary, _prod_note, _prod_event = ( + refuse_produces_not_in_diff( + wu, attempt, attempts_usage[-1], + payload["remaining"], payload["touched"], + cfg=cfg, head_before=head_before, + events_path=events_path, + untracked_before=untracked_before, + verification_ran=False, + )) + wu_events.append(_prod_event) + # `+=` for the reason given at the late site. + refusal_history += [(_prod_summary, _refusal_touched)] + attempt_notes.append((attempt, _prod_note)) + failure_note = _prod_note + print( + f" PRODUCES NOT IN DIFF attempt " + f"{attempt}/{wu_max_attempts} — {_prod_summary}" + ) + continue + if outcome == "passed": # Flip status to DONE BEFORE the squash so the flip is # included in the commit content — survives the next WU's @@ -13079,96 +13283,25 @@ def run( # read (#3268). Only the still-unjustified entries # refuse; the accepted ones are recorded on the # passed event. - _prod_remaining, _produces_justified = resolve_produces_refusal( - wu, touched, wu.result_block, - ) + _prod_remaining, _produces_justified, _produces_amended = ( + decide_produces_in_diff( + wu, touched, wu.result_block, cfg)) for _pj in _produces_justified: print(f" produces: {_pj['path']} unchanged, " f"justified — {_pj['justification'][:120]}") - # Produces-amendment escape hatch (FEAT-2026-0114/T01): - # a still-unmatched entry the RESULT drops under - # `produces_amended:` with a non-blank reason is - # applied ONLY when every remaining unmatched entry - # is covered — a partial amendment still refuses so - # the still-unjustified path's name reaches the - # retry note unchanged. - _produces_amended: list = [] + if _produces_amended: + apply_produces_amendment(wu, _produces_amended) if _prod_remaining: - _amendments = produces_amendments(wu.result_block) - _amend_dropped = [] - _amend_remaining = [] - for _entry in _prod_remaining: - _key = _entry.removeprefix("./") - if _key in _amendments: - _amend_dropped.append( - {"path": _entry, - "reason": _amendments[_key]}) - else: - _amend_remaining.append(_entry) - if _amend_dropped and not _amend_remaining: - _drop_keys = { - d["path"].removeprefix("./") - for d in _amend_dropped - } - _kept_after_drop = [ - p for p in wu.produces - if str(p).removeprefix("./") - not in _drop_keys - ] - _would_be_empty = ( - wu.type == "implementation" - and not _kept_after_drop - ) - if not _would_be_empty and resolve_produces_amendable(cfg): - apply_produces_amendment(wu, _amend_dropped) - _produces_amended = _amend_dropped - _prod_remaining = [] - prod_ok = not _prod_remaining - prod_summary = "" if prod_ok else ( - "declared produces path(s) not in this WU's squash diff: " - + ", ".join(_prod_remaining) - ) - if not prod_ok: - _prod_note = ( - prod_summary - + "\n\nTwo escape hatches: `produces_unchanged:` " - "— the deliverable already holds at HEAD; " - "`produces_amended:` — the plan named a path " - "this solution did not need." - + "\n\nEach listed path is a deliverable this WU " - "declared in `produces:` but did not change. " - "Either make the declared change this attempt, " - "or — if the deliverable already holds at HEAD — " - "say so in the RESULT block under " - "`produces_unchanged:` with the command and " - "output that show it (result-contract.md, " - "closing obligation 1). Do not declare done " - "while a deliverable is untouched and " - "unjustified." - + "\n\n" - + PRODUCES_REPAIR_EXAMPLE.format( - path=_prod_remaining[0]) - ) - _prod_sig = ", ".join(sorted( - Path(p).name for p in _prod_remaining - ))[:100] or "produces_unchanged" - _prod_excerpt = extract_failure_excerpt(_prod_note) - _prod_note, _prod_retained = ( - _resolve_guard_refusal_tree( - cfg, head_before, events_path, - untracked_before, _prod_note, - failure_class="produces_not_in_diff", + prod_summary, _prod_note, _prod_event = ( + refuse_produces_not_in_diff( + wu, attempt, attempts_usage[-1], + _prod_remaining, touched, + cfg=cfg, head_before=head_before, + events_path=events_path, + untracked_before=untracked_before, + verification_ran=True, )) - wu_events.append(emit_attempt_outcome( - wu, attempt, "produces_not_in_diff", - attempts_usage[-1], - failure_class="produces_not_in_diff", - failure_signature=_prod_sig, - failure_excerpt=_prod_excerpt, - files_touched=touched, - extras={"summary": prod_summary, - "tree_retained": _prod_retained}, - )) + wu_events.append(_prod_event) # `+=`, not the `.` `append(` call other guard # sites use: that exact call shape is what # test_every_guard_refusal_records_into_the_refusal_ledger diff --git a/tests/test_fail_fast_deliverables.py b/tests/test_fail_fast_deliverables.py new file mode 100644 index 00000000..e0205392 --- /dev/null +++ b/tests/test_fail_fast_deliverables.py @@ -0,0 +1,219 @@ +# +# Copyright 2026 Specfuse contributors +# Licensed under the Apache License, Version 2.0. See LICENSE. +# +"""FEAT-LOOP-2026-0251 gate 1 oracle — a missing deliverable is refused before +the verification gates run. One class per Definition-of-done clause in +GATE-01.md. T01 implements clause 1; the rest are skipped naming their owning +unit. +""" + +from __future__ import annotations + +import json +import os +import subprocess +import unittest +from pathlib import Path + +from tests._loop_loader import load_loop +from tests._workspace import integration_workspace + +loop = load_loop() + +FEATURE_ID = "FEAT-2026-9251" +T01 = f"{FEATURE_ID}/T01" + +_BODY = ( + "\n\n**Context.** test\n\n**Acceptance criteria.** test\n\n" + "**Do not touch.** test\n\n**Verification.** test\n\n" + "**Escalation triggers.** test\n" +) +_COMPLETE = "```result\nstatus: complete\n```\n" + + +def _git(*args: str) -> str: + return subprocess.run(["git", *args], check=True, capture_output=True, + text=True).stdout.strip() + + +def _write_feature(root: Path) -> Path: + fdir = root / f".specfuse/features/{FEATURE_ID}-fail-fast" + fdir.mkdir(parents=True) + close_id = f"{FEATURE_ID}/G1-CLOSE" + (fdir / "PLAN.md").write_text( + f"---\nfeature_id: {FEATURE_ID}\ntitle: Fixture\nslug: fail-fast\n" + "branch: feat/fail-fast\nroadmap_goal: test\nstatus: active\n---\n\n" + "# Plan\n\n```yaml\ngates:\n - gate: 1\n file: GATE-01.md\n" + " work_units:\n" + f" - id: {T01}\n file: WU-T01.md\n depends_on: []\n" + f" - id: {close_id}\n file: WU-close.md\n" + f" depends_on: [{T01}]\n```\n" + ) + (fdir / "GATE-01.md").write_text("---\ngate: 1\nstatus: open\n---\n\n# G\n") + (fdir / "WU-T01.md").write_text( + f"---\nid: {T01}\ntype: implementation\nmodel: sonnet\n" + "status: pending\nattempts: 0\nproduces:\n - src/rule.py\n---\n\n" + f"# T01{_BODY}") + (fdir / "WU-close.md").write_text( + f"---\nid: {close_id}\ntype: close\nmodel: opus\n" + f"status: pending\nattempts: 0\n---\n\n# Close{_BODY}") + Path(root, "src").mkdir(exist_ok=True) + Path(root, "src/rule.py").write_text("SEVERITY = 'WARNING'\n") + _git("add", ".") + _git("commit", "-q", "-m", "scaffold") + return fdir + + +class _Case(unittest.TestCase): + + def setUp(self): + self._cwd = os.getcwd() + self._patches = [] + + def tearDown(self): + os.chdir(self._cwd) + for name, original in reversed(self._patches): + setattr(loop, name, original) + + def _patch(self, name, replacement): + self._patches.append((name, getattr(loop, name))) + setattr(loop, name, replacement) + + def _workspace(self): + ws = integration_workspace() + root = ws.__enter__() + self.addCleanup(ws.__exit__, None, None, None) + os.chdir(root) + return root, _write_feature(root) + + +class TestProducesNotInDiffEarly(_Case): + """Clause 1 — refused before `verify_fn`, same record as the late path.""" + + def _attempt(self, touch: str, stdout: str = _COMPLETE): + _, fdir = self._workspace() + wu = loop.load_wu(fdir, {"id": T01, "file": "WU-T01.md", + "depends_on": []}) + head = _git("rev-parse", "HEAD") + calls = [] + + def dispatch_fn(w, note): + Path(touch).parent.mkdir(exist_ok=True) + Path(touch).write_text("changed\n") + return stdout + + def verify_fn(w, fd): + calls.append(w.wu_id) + return True, "(stub)" + + outcome, payload, usage = loop.execute_unit_attempt( + wu, fdir, None, dispatch_fn=dispatch_fn, verify_fn=verify_fn, + cost_tracking=False, head_before=head, prerun_cfg={}, + untracked_before=loop.untracked_paths()) + return wu, outcome, payload, usage, calls + + def test_untouched_path_is_refused_without_verifying(self): + wu, outcome, payload, usage, calls = self._attempt("docs/notes.md") + self.assertEqual(outcome, "produces_not_in_diff") + self.assertEqual(payload["remaining"], ["src/rule.py"]) + self.assertIn("docs/notes.md", payload["touched"]) + self.assertEqual(calls, []) + self.assertEqual(usage["verify_seconds"], 0) + self.assertEqual(loop.build_attempt_gate_events(wu, 1), []) + + def test_changed_path_verifies_once_and_passes(self): + _, outcome, _, _, calls = self._attempt("src/rule.py") + self.assertEqual(outcome, "passed") + self.assertEqual(calls, [T01]) + + def test_justified_path_still_verifies(self): + _, outcome, _, _, calls = self._attempt( + "docs/notes.md", + "```result\nstatus: complete\nproduces_unchanged:\n" + " - path: src/rule.py\n justification: already holds\n```\n") + self.assertEqual(outcome, "passed") + self.assertEqual(calls, [T01]) + + def test_index_is_left_alone(self): + self._attempt("docs/notes.md") + self.assertEqual(_git("diff", "--cached", "--name-only"), "") + + def _run_driver(self, early: bool): + """`loop.run()` over an attempt that never touches `src/rule.py`. + `early=False` silences the pre-verify check, leaving the late site.""" + _, fdir = self._workspace() + verified = [] + + def dispatch(wu, note, ct=True): + if wu.wu_id == T01: + Path("docs").mkdir(exist_ok=True) + Path("docs/notes.md").write_text("notes\n") + return _COMPLETE + + def verify(wu, fd, cfg=None): + verified.append(wu.wu_id) + return True, "(stub)" + + self._patch("dispatch", dispatch) + self._patch("verify", verify) + if not early: + self._patch("early_produces_refusal", lambda *a, **k: None) + self.assertEqual(loop.run(None, dry_run=False), 1) + events = [json.loads(line) for line in + (fdir / "events.jsonl").read_text().splitlines() if line] + refusals = [ + e["payload"] for e in events + if e["event_type"] == "attempt_outcome" + and e["payload"]["outcome"] == "produces_not_in_diff"] + self.assertTrue(refusals) + self.assertEqual( + [e for e in events if e["event_type"] == "gate_result" + and e["correlation_id"] == T01 + and e["payload"]["phase"] == "attempt"], []) + return refusals[0], verified + + def test_early_record_equals_late_record(self): + early, early_verified = self._run_driver(early=True) + late, late_verified = self._run_driver(early=False) + self.assertEqual(early_verified, []) + self.assertIn(T01, late_verified) + self.assertEqual(early["verify_seconds"], 0) + for key in ("failure_class", "failure_signature", "summary"): + self.assertEqual(early[key], late[key], key) + + +@unittest.skip("FEAT-LOOP-2026-0251/T02") +class TestPresenceEarly(unittest.TestCase): + """Clause 2 — `deliverable_missing` / `no_deliverable_files` early.""" + + def test_pending(self): + self.fail("T02") + + +@unittest.skip("FEAT-LOOP-2026-0251/T02") +class TestOptOut(unittest.TestCase): + """Clause 3 — `defaults.fail_fast_deliverables: false`.""" + + def test_pending(self): + self.fail("T02") + + +@unittest.skip("FEAT-LOOP-2026-0251/T03") +class TestTreeAndNote(unittest.TestCase): + """Clause 4 — tree handling and retry note.""" + + def test_pending(self): + self.fail("T03") + + +@unittest.skip("FEAT-LOOP-2026-0251/T04") +class TestArmTimeWarning(unittest.TestCase): + """Clause 5 — arm-time WARN for an unmentioned `produces:` path.""" + + def test_pending(self): + self.fail("T04") + + +if __name__ == "__main__": + unittest.main() diff --git a/tests/test_files_changed_auto_repair.py b/tests/test_files_changed_auto_repair.py index 576a94ce..20141884 100644 --- a/tests/test_files_changed_auto_repair.py +++ b/tests/test_files_changed_auto_repair.py @@ -152,8 +152,10 @@ def test_untouched_deliverable_still_refuses(self): " - kept.py\n - extra.py\n```\n" ) outcome, payload, _usage = self._run(wu, stdout) - self.assertEqual(outcome, "files_changed_mismatch") - self.assertEqual(payload, ["extra.py"]) + # FEAT-LOOP-2026-0251/T01: the untouched deliverable is now refused + # before verify(), so it never reaches the post-verify guard. + self.assertEqual(outcome, "produces_not_in_diff") + self.assertEqual(payload["remaining"], ["extra.py"]) self.assertIsNone(wu.auto_repaired_files_changed) def test_nothing_to_repair_is_a_plain_pass(self): From 706b14a20fd03607ba1b9c78f22975c497503321 Mon Sep 17 00:00:00 2001 From: Test Date: Wed, 25 Nov 2026 18:32:32 -0500 Subject: [PATCH 06/69] =?UTF-8?q?feat:=20T02=20=E2=80=94=20presence=20refu?= =?UTF-8?q?sals=20early,=20and=20the=20`fail=5Ffast=5Fdeliverables`=20opt-?= =?UTF-8?q?out?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Feature: FEAT-LOOP-2026-0251/T02 --- .../PROGRESS.md | 1 + .../WU-02-presence-and-opt-out.md | 11 +- .../events.jsonl | 13 ++ .specfuse/verification.yml.example | 9 + specfuse/loop/data/verification.yml.example | 9 + specfuse/loop/loop.py | 192 +++++++++++++----- tests/test_arm_wiring.py | 6 +- tests/test_deterministic_refusal_repeat.py | 2 +- tests/test_fail_fast_deliverables.py | 130 +++++++++++- tests/test_guard_repair_e2e.py | 3 + tests/test_loop_files_changed_guard.py | 2 +- tests/test_replan_end_to_end.py | 4 +- tests/test_replan_event_emission.py | 4 +- tests/test_replan_note_collision.py | 4 +- tests/test_replan_trigger.py | 3 + 15 files changed, 320 insertions(+), 73 deletions(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md index 66770075..fa38a571 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md @@ -1,2 +1,3 @@ - **FEAT-LOOP-2026-0251/T01**: execute_unit_attempt now refuses an untouched, unjustified produces path before verify_fn, using the same decision and refusal helpers as the late post-squash site; added the gate oracle test file with clause 1 implemented. - note: T02: early_produces_refusal returns None whenever assert_declared_deliverables or assert_implementation_touched_files would refuse, so those keep their own outcomes until you move them early; it reads the pending diff through pending_squash_names (scratch index), and the produces amendment is applied only at the late site, after verify. +- **FEAT-LOOP-2026-0251/T02**: deliverable_missing and no_deliverable_files now refuse before verify() via helpers shared with late sites; added defaults.fail_fast_deliverables opt-out (default true), documented and synced. Narrow tier green; broad gates not run. diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-02-presence-and-opt-out.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-02-presence-and-opt-out.md index 255b8fe3..57c2a2bd 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-02-presence-and-opt-out.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-02-presence-and-opt-out.md @@ -1,8 +1,8 @@ --- id: FEAT-LOOP-2026-0251/T02 type: implementation -status: pending -attempts: 0 +status: done +attempts: 1 oracle_env: macos_local planned_cost_usd: 1.50 produces: @@ -14,6 +14,13 @@ produces_driver_helper: - execute_unit_attempt model: sonnet effort: medium +gate_set: code +driver_version: 0.33.2 +started_at: 2026-11-25T23:27:13.111963+00:00 +duration_seconds: 319.321 +cost_usd: 0.771194 +input_tokens: 40 +output_tokens: 19169 --- # T02 — presence refusals early, and the `fail_fast_deliverables` opt-out diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index 8bf5883e..a301dcef 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -1 +1,14 @@ {"timestamp": "2026-11-25T23:21:07.164784+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "driver_build_pinned", "source": "driver", "source_version": "0.33.2", "payload": {"tree": "bd7e508193941835916c63053cc2ec0293e35acc", "path": "/private/var/folders/zc/rgq11x850d78dx_kf1fd4vx80000gn/T/specfuse-pins/bd7e508193941835916c63053cc2ec0293e35acc/specfuse/loop"}} +{"timestamp": "2026-11-25T23:21:07.458481+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T01", "event_type": "task_started", "source": "driver", "source_version": "0.33.2", "payload": {"type": "implementation", "model": "sonnet", "re_arm_count": 0}} +{"timestamp": "2026-11-25T23:27:12.901760+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T01", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "tests", "ok": true, "skipped": false, "duration_seconds": 2.015, "phase": "attempt"}} +{"timestamp": "2026-11-25T23:27:12.901785+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T01", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "lint", "ok": true, "skipped": false, "duration_seconds": 0.017, "phase": "attempt"}} +{"timestamp": "2026-11-25T23:27:12.901788+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T01", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "changelog-fragments", "ok": true, "skipped": false, "duration_seconds": 0.05, "phase": "attempt"}} +{"timestamp": "2026-11-25T23:27:12.901789+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T01", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "agent-policy-example-lint", "ok": true, "skipped": false, "duration_seconds": 0.109, "phase": "attempt"}} +{"timestamp": "2026-11-25T23:27:12.901792+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T01", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "event-type-gate", "ok": true, "skipped": false, "duration_seconds": 0.159, "phase": "attempt"}} +{"timestamp": "2026-11-25T23:27:12.901793+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T01", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "roadmap-link-gate", "ok": true, "skipped": false, "duration_seconds": 0.055, "phase": "attempt"}} +{"timestamp": "2026-11-25T23:27:12.901795+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T01", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "arm-sweep-gate", "ok": true, "skipped": false, "duration_seconds": 0.388, "phase": "attempt"}} +{"timestamp": "2026-11-25T23:27:12.901796+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T01", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "monitoring-example-lint", "ok": true, "skipped": false, "duration_seconds": 0.046, "phase": "attempt"}} +{"timestamp": "2026-11-25T23:27:12.901798+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T01", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "feature_oracle", "ok": true, "skipped": false, "duration_seconds": 1.895, "phase": "attempt"}} +{"timestamp": "2026-11-25T23:27:13.019786+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T01", "event_type": "attempt_outcome", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "outcome": "passed", "duration_seconds": 365.44, "agent_seconds": 360.6176762500545, "verify_seconds": 4.786691167042591, "cost_usd": 0.8759794, "input_tokens": 26, "output_tokens": 19488, "cache_read_input_tokens": 1166154, "cache_creation_input_tokens": 141108, "model": "sonnet", "effort": "medium", "failure_class": null, "failure_signature": null, "failure_excerpt": null, "files_touched": [".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-01-produces-before-verify.md", "specfuse/loop/loop.py", "tests/test_fail_fast_deliverables.py", "tests/test_files_changed_auto_repair.py"], "agent_status": "complete", "agent_blocked_reason": null, "re_arm_count": 0, "failing_tests": []}} +{"timestamp": "2026-11-25T23:27:13.019947+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T01", "event_type": "task_completed", "source": "driver", "source_version": "0.33.2", "payload": {"attempts": 1, "attempts_usage": [{"attempt": 1, "duration_seconds": 365.44, "cost_usd": 0.8759794, "input_tokens": 26, "output_tokens": 19488, "cache_read_input_tokens": 1166154, "cache_creation_input_tokens": 141108, "agent_seconds": 360.6176762500545, "verify_seconds": 4.786691167042591}], "type": "implementation", "re_arm_count": 0, "cost_usd": 0.875979, "cumulative_cost_usd": 0.875979, "attempts_lifetime": 1, "planned_cost_usd": 2.0}} +{"timestamp": "2026-11-25T23:27:13.026375+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "driver_staleness_detected", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "wu_id": "FEAT-LOOP-2026-0251/T01", "driver_paths": ["specfuse/loop/loop.py"], "halted": false, "reason": "driver_restart_required", "pinned_tree": "bd7e508193941835916c63053cc2ec0293e35acc", "next_pin_tree": "95e978bf461a377cb81a6a5d648852cbc50d6b45"}} diff --git a/.specfuse/verification.yml.example b/.specfuse/verification.yml.example index 0b270086..5d005cf8 100644 --- a/.specfuse/verification.yml.example +++ b/.specfuse/verification.yml.example @@ -118,6 +118,14 @@ # # attempt repairs the retained tree in place # # instead of re-authoring from scratch. Set to # # false to restore the pre-0.18 discard behaviour. +# fail_fast_deliverables: true # whether `deliverable_missing`, +# # `no_deliverable_files` and +# # `produces_not_in_diff` are refused BEFORE +# # the verification gates run. Defaults to true. +# # Set false when a verification gate itself +# # writes a declared deliverable (a code +# # generator, say): all three then run only +# # after verification (FEAT-LOOP-2026-0251). # dispatch_skills: false # whether a dispatched session loads the # # project's skills index. Defaults to false: # # a work unit invokes no skill, and the index @@ -152,6 +160,7 @@ # defaults: # max_attempts: 3 # retain_on_guard_refusal: true +# fail_fast_deliverables: true # dispatch_skills: false # post_merge_issue: false # produces_amendable: false diff --git a/specfuse/loop/data/verification.yml.example b/specfuse/loop/data/verification.yml.example index 0b270086..5d005cf8 100644 --- a/specfuse/loop/data/verification.yml.example +++ b/specfuse/loop/data/verification.yml.example @@ -118,6 +118,14 @@ # # attempt repairs the retained tree in place # # instead of re-authoring from scratch. Set to # # false to restore the pre-0.18 discard behaviour. +# fail_fast_deliverables: true # whether `deliverable_missing`, +# # `no_deliverable_files` and +# # `produces_not_in_diff` are refused BEFORE +# # the verification gates run. Defaults to true. +# # Set false when a verification gate itself +# # writes a declared deliverable (a code +# # generator, say): all three then run only +# # after verification (FEAT-LOOP-2026-0251). # dispatch_skills: false # whether a dispatched session loads the # # project's skills index. Defaults to false: # # a work unit invokes no skill, and the index @@ -152,6 +160,7 @@ # defaults: # max_attempts: 3 # retain_on_guard_refusal: true +# fail_fast_deliverables: true # dispatch_skills: false # post_merge_issue: false # produces_amendable: false diff --git a/specfuse/loop/loop.py b/specfuse/loop/loop.py index 9cb919f8..39ef6684 100644 --- a/specfuse/loop/loop.py +++ b/specfuse/loop/loop.py @@ -648,6 +648,19 @@ def resolve_retain_on_guard_refusal(verification_cfg: dict) -> bool: return bool(project.get("retain_on_guard_refusal", True)) +def resolve_fail_fast_deliverables(verification_cfg: dict) -> bool: + """Whether the diff-only deliverable refusals run before verification + (FEAT-LOOP-2026-0251/T02). + + Reads `defaults.fail_fast_deliverables` from verification.yml. Defaults to + True. False is for a project whose gates write a declared deliverable: + `deliverable_missing`, `no_deliverable_files` and `produces_not_in_diff` + then run only after verification. + """ + project = (verification_cfg or {}).get("defaults") or {} + return bool(project.get("fail_fast_deliverables", True)) + + def resolve_dispatch_skills(verification_cfg: dict) -> bool: """Whether a dispatched session gets the project's skills index (#3423). @@ -8598,13 +8611,13 @@ def execute_unit_attempt( return "blocked", reason, usage # Fail fast (FEAT-LOOP-2026-0251/T01): a refusal that judges only the # attempt's diff must not first pay for a verification run. - if head_before is not None: + if head_before is not None and resolve_fail_fast_deliverables(cfg): early_block = parse_result_block(stdout or "") refusal = early_produces_refusal( wu, head_before, untracked_before, early_block, cfg) if refusal is not None: wu.result_block = early_block - return "produces_not_in_diff", refusal, usage + return refusal["outcome"], refusal, usage _verify_t0 = time.monotonic() try: if _accepts_gate_file(verify_fn): @@ -11661,21 +11674,89 @@ def early_produces_refusal( untracked_before: "set[str] | frozenset[str]", result_block: "dict | None", cfg: dict, ) -> "dict | None": - """The `produces_not_in_diff` refusal decidable before verification, as - ``{"remaining", "touched"}``; None when verification should run. + """The deliverable refusal decidable before verification; None when + verification should run. - Stays silent when the presence or empty-files guard would refuse: those - run first after the squash and keep their own outcome. + Checks in the post-squash guards' order, so the same one wins: + ``{"outcome": "deliverable_missing", "summary"}``, + ``{"outcome": "no_deliverable_files", "summary"}``, or + ``{"outcome": "produces_not_in_diff", "remaining", "touched"}``. + The last two stay silent when git cannot name the pending diff. """ - if not wu.produces or not assert_declared_deliverables(wu)[0]: - return None + present, summary = assert_declared_deliverables(wu) + if not present: + return {"outcome": "deliverable_missing", "summary": summary} touched = pending_squash_names(head_before, untracked_before) - if touched is None or not assert_implementation_touched_files(wu, touched)[0]: + if touched is None: + return None + touched_ok, summary = assert_implementation_touched_files(wu, touched) + if not touched_ok: + return {"outcome": "no_deliverable_files", "summary": summary} + if not wu.produces: return None remaining = decide_produces_in_diff(wu, touched, result_block, cfg)[0] if not remaining: return None - return {"remaining": remaining, "touched": touched} + return {"outcome": "produces_not_in_diff", "remaining": remaining, + "touched": touched} + + +_NOT_VERIFIED_NOTE = ( + "\n\nRefused before the verification gates: verification did not run.") + + +def refuse_deliverable_missing( + wu: WorkUnit, attempt: int, usage: dict, summary: str, + touched: list[str], *, cfg: dict, head_before: str, events_path: Path, + untracked_before, verification_ran: bool, +) -> "tuple[str, dict]": + """Settle the tree and build the record of a `deliverable_missing` + refusal for either call site. Returns ``(note, event)``.""" + # Composed BEFORE the reset. The reset rolls the attempt back, so + # afterwards every declared path reads ABSENT and the note would lose the + # one distinction it exists to record — which of the declared + # deliverables the attempt did land (#1412). + note = format_deliverable_missing_note(wu, summary, touched, attempt) + if not verification_ran: + note += _NOT_VERIFIED_NOTE + note, retained = _resolve_guard_refusal_tree( + cfg, head_before, events_path, untracked_before, note, + failure_class="guard_refusal", verification_ran=verification_ran, + ) + event = emit_attempt_outcome( + wu, attempt, "deliverable_missing", usage, + failure_class="guard_refusal", + failure_signature="assert_declared_deliverables", + failure_excerpt=extract_failure_excerpt(summary), + files_touched=touched, + extras={"summary": summary, + "missing": summary.split(": ", 1)[-1], + "tree_retained": retained}, + ) + return note, event + + +def refuse_no_deliverable_files( + wu: WorkUnit, attempt: int, usage: dict, summary: str, + touched: list[str], *, cfg: dict, head_before: str, events_path: Path, + untracked_before, verification_ran: bool, +) -> "tuple[str, dict]": + """Settle the tree and build the record of a `no_deliverable_files` + refusal for either call site. Returns ``(note, event)``.""" + note = summary if verification_ran else summary + _NOT_VERIFIED_NOTE + note, retained = _resolve_guard_refusal_tree( + cfg, head_before, events_path, untracked_before, note, + failure_class="guard_refusal", verification_ran=verification_ran, + ) + event = emit_attempt_outcome( + wu, attempt, "no_deliverable_files", usage, + failure_class="guard_refusal", + failure_signature="assert_implementation_touched_files", + failure_excerpt=extract_failure_excerpt(summary), + files_touched=touched, + extras={"summary": summary, "tree_retained": retained}, + ) + return note, event def refuse_produces_not_in_diff( @@ -11687,8 +11768,7 @@ def refuse_produces_not_in_diff( refusal for either call site. Returns ``(summary, note, event)``.""" summary, note, signature = format_produces_refusal(remaining) if not verification_ran: - note += ("\n\nRefused before the verification gates: verification " - "did not run.") + note += _NOT_VERIFIED_NOTE excerpt = extract_failure_excerpt(note) note, retained = _resolve_guard_refusal_tree( cfg, head_before, events_path, untracked_before, note, @@ -13036,6 +13116,36 @@ def run( ) continue + if outcome in ("no_deliverable_files", + "deliverable_missing"): + # Refused before verify() (FEAT-LOOP-2026-0251/T02). + _refuse = ( + refuse_deliverable_missing + if outcome == "deliverable_missing" + else refuse_no_deliverable_files) + _early_note, _early_event = _refuse( + wu, attempt, attempts_usage[-1], + payload["summary"], _refusal_touched, + cfg=cfg, head_before=head_before, + events_path=events_path, + untracked_before=untracked_before, + verification_ran=False, + ) + wu_events.append(_early_event) + # `+=` for the reason given at the late + # `produces_not_in_diff` site: the `.append(` count + # tracks one late site per guard. + refusal_history += [ + (payload["summary"], _refusal_touched)] + attempt_notes.append((attempt, _early_note)) + failure_note = _early_note + print( + f" {outcome.replace('_', ' ').upper()} attempt " + f"{attempt}/{wu_max_attempts} — " + f"{payload['summary']}" + ) + continue + if outcome == "passed": # Flip status to DONE BEFORE the squash so the flip is # included in the commit content — survives the next WU's @@ -13192,32 +13302,16 @@ def run( # every current WU is unchanged. deliv_ok, deliv_summary = assert_declared_deliverables(wu) if not deliv_ok: - # Composed BEFORE the reset. The reset rolls the - # squash back, so afterwards every declared path - # reads ABSENT and the note would lose the one - # distinction it exists to record — which of the - # declared deliverables the attempt did land (#1412). - _deliv_note = format_deliverable_missing_note( - wu, deliv_summary, _refusal_touched, attempt, - ) - _deliv_note, _deliv_retained = ( - _resolve_guard_refusal_tree( - cfg, head_before, events_path, - untracked_before, _deliv_note, - failure_class="guard_refusal", + _deliv_note, _deliv_event = ( + refuse_deliverable_missing( + wu, attempt, attempts_usage[-1], + deliv_summary, _refusal_touched, + cfg=cfg, head_before=head_before, + events_path=events_path, + untracked_before=untracked_before, + verification_ran=True, )) - missing = deliv_summary.split(": ", 1)[-1] - wu_events.append(emit_attempt_outcome( - wu, attempt, "deliverable_missing", - attempts_usage[-1], - failure_class="guard_refusal", - failure_signature="assert_declared_deliverables", - failure_excerpt=extract_failure_excerpt(deliv_summary), - files_touched=_refusal_touched, - extras={"summary": deliv_summary, - "missing": missing, - "tree_retained": _deliv_retained}, - )) + wu_events.append(_deliv_event) refusal_history.append( (deliv_summary, _refusal_touched)) attempt_notes.append((attempt, _deliv_note)) @@ -13245,22 +13339,16 @@ def run( wu, touched, ) if not impl_ok: - _impl_note, _impl_retained = ( - _resolve_guard_refusal_tree( - cfg, head_before, events_path, - untracked_before, impl_summary, - failure_class="guard_refusal", + _impl_note, _impl_event = ( + refuse_no_deliverable_files( + wu, attempt, attempts_usage[-1], + impl_summary, _refusal_touched, + cfg=cfg, head_before=head_before, + events_path=events_path, + untracked_before=untracked_before, + verification_ran=True, )) - wu_events.append(emit_attempt_outcome( - wu, attempt, "no_deliverable_files", - attempts_usage[-1], - failure_class="guard_refusal", - failure_signature="assert_implementation_touched_files", - failure_excerpt=extract_failure_excerpt(impl_summary), - files_touched=_refusal_touched, - extras={"summary": impl_summary, - "tree_retained": _impl_retained}, - )) + wu_events.append(_impl_event) refusal_history.append( (impl_summary, _refusal_touched)) attempt_notes.append((attempt, _impl_note)) diff --git a/tests/test_arm_wiring.py b/tests/test_arm_wiring.py index 7784e81d..13d810d3 100644 --- a/tests/test_arm_wiring.py +++ b/tests/test_arm_wiring.py @@ -27,7 +27,7 @@ from specfuse.loop.plan_baseline import load_plan_graph, write_baseline_if_absent from tests._loop_loader import load_loop -from tests._workspace import integration_workspace +from tests._workspace import integration_workspace, with_deliverable loop = load_loop() @@ -391,7 +391,7 @@ def test_resumed_gate_halt_message_blames_the_branch_not_main(self): def fake_dispatch(wu, failure_note, cost_tracking=True): return "```result\nstatus: complete\n```\n" - self._patch("dispatch", fake_dispatch) + self._patch("dispatch", with_deliverable(fake_dispatch)) self._patch("verify", lambda wu, fd, cfg=None: (False, "FAIL")) self._patch( "probe_baseline", @@ -430,7 +430,7 @@ def test_preexisting_gate_failure_does_not_arm_even_if_would_arm_true(self): def fake_dispatch(wu, failure_note, cost_tracking=True): return "```result\nstatus: complete\n```\n" - self._patch("dispatch", fake_dispatch) + self._patch("dispatch", with_deliverable(fake_dispatch)) self._patch("verify", lambda wu, fd, cfg=None: (False, "FAIL")) self._patch( "probe_baseline", diff --git a/tests/test_deterministic_refusal_repeat.py b/tests/test_deterministic_refusal_repeat.py index 9d4b5616..52b144da 100644 --- a/tests/test_deterministic_refusal_repeat.py +++ b/tests/test_deterministic_refusal_repeat.py @@ -100,7 +100,7 @@ def test_deliverable_missing_retry_carries_the_present_absent_split(self): # that is what the next attempt is handed. import inspect src = inspect.getsource(loop_module.run) - branch = src[src.index('"deliverable_missing",'):] + branch = src[src.index("if not deliv_ok:"):] branch = branch[:branch.index("continue")] self.assertIn("failure_note = _deliv_note", branch) self.assertNotIn("failure_note = deliv_summary", branch) diff --git a/tests/test_fail_fast_deliverables.py b/tests/test_fail_fast_deliverables.py index e0205392..4d4a0d01 100644 --- a/tests/test_fail_fast_deliverables.py +++ b/tests/test_fail_fast_deliverables.py @@ -183,20 +183,134 @@ def test_early_record_equals_late_record(self): self.assertEqual(early[key], late[key], key) -@unittest.skip("FEAT-LOOP-2026-0251/T02") -class TestPresenceEarly(unittest.TestCase): +def _delete_rule(fdir: Path) -> None: + Path("src/rule.py").unlink(missing_ok=True) + + +def _empty_rule(fdir: Path) -> None: + Path("src/rule.py").write_text("") + + +def _bookkeeping_only(fdir: Path) -> None: + for name in ("WU-T01.md", "events.jsonl"): + with (fdir / name).open("a") as handle: + handle.write("\n") + + +def _notes_only(fdir: Path) -> None: + Path("docs").mkdir(exist_ok=True) + Path("docs/notes.md").write_text("notes\n") + + +class TestPresenceEarly(_Case): """Clause 2 — `deliverable_missing` / `no_deliverable_files` early.""" - def test_pending(self): - self.fail("T02") + def _assert_early(self, act, expected: str): + _, fdir = self._workspace() + wu = loop.load_wu(fdir, {"id": T01, "file": "WU-T01.md", + "depends_on": []}) + head = _git("rev-parse", "HEAD") + calls = [] + def dispatch_fn(w, note): + act(fdir) + return _COMPLETE + + def verify_fn(w, fd): + calls.append(w.wu_id) + return True, "(stub)" + + outcome, payload, usage = loop.execute_unit_attempt( + wu, fdir, None, dispatch_fn=dispatch_fn, verify_fn=verify_fn, + cost_tracking=False, head_before=head, prerun_cfg={}, + untracked_before=loop.untracked_paths()) + self.assertEqual(outcome, expected) + self.assertTrue(payload["summary"]) + self.assertEqual(calls, []) + self.assertEqual(usage["verify_seconds"], 0) -@unittest.skip("FEAT-LOOP-2026-0251/T02") -class TestOptOut(unittest.TestCase): + def test_absent_path_is_refused_without_verifying(self): + self._assert_early(_delete_rule, "deliverable_missing") + + def test_empty_path_is_refused_without_verifying(self): + self._assert_early(_empty_rule, "deliverable_missing") + + def test_bookkeeping_only_diff_is_refused_without_verifying(self): + self._assert_early(_bookkeeping_only, "no_deliverable_files") + + +class TestOptOut(_Case): """Clause 3 — `defaults.fail_fast_deliverables: false`.""" - def test_pending(self): - self.fail("T02") + _REFUSALS = ("deliverable_missing", "no_deliverable_files", + "produces_not_in_diff") + + def test_key_defaults_to_true(self): + self.assertTrue(loop.resolve_fail_fast_deliverables({})) + self.assertFalse(loop.resolve_fail_fast_deliverables( + {"defaults": {"fail_fast_deliverables": False}})) + + def _first_refusal(self, act, fail_fast: bool): + """`loop.run()`; returns the first refusal record and how many times + the unit was verified before the second dispatch.""" + _, fdir = self._workspace() + seen = [] + load = loop.load_verification + + def load_cfg(*args, **kwargs): + cfg = dict(load(*args, **kwargs)) + if not fail_fast: + cfg["defaults"] = {"fail_fast_deliverables": False} + return cfg + + def dispatch(wu, note, ct=True): + if wu.wu_id == T01: + seen.append("dispatch") + act(fdir) + return _COMPLETE + + def verify(wu, fd, cfg=None): + if wu.wu_id == T01: + seen.append("verify") + return True, "(stub)" + + self._patch("load_verification", load_cfg) + self._patch("dispatch", dispatch) + self._patch("verify", verify) + self.assertEqual(loop.run(None, dry_run=False), 1) + for name, original in reversed(self._patches): + setattr(loop, name, original) + self._patches.clear() + refusals = [ + e["payload"] for e in map( + json.loads, + filter(None, (fdir / "events.jsonl").read_text().splitlines())) + if e["event_type"] == "attempt_outcome" + and e["payload"]["outcome"] in self._REFUSALS] + self.assertTrue(refusals) + first_attempt = seen[1:] + if "dispatch" in first_attempt: + first_attempt = first_attempt[:first_attempt.index("dispatch")] + return refusals[0], first_attempt.count("verify") + + def _assert_opt_out(self, act, expected: str): + default, default_verified = self._first_refusal(act, fail_fast=True) + late, late_verified = self._first_refusal(act, fail_fast=False) + self.assertEqual(default_verified, 0) + self.assertEqual(late_verified, 1) + self.assertEqual(late["outcome"], expected) + for key in ("outcome", "failure_class", "failure_signature", + "summary"): + self.assertEqual(default[key], late[key], key) + + def test_deliverable_missing_verifies_first(self): + self._assert_opt_out(_delete_rule, "deliverable_missing") + + def test_no_deliverable_files_verifies_first(self): + self._assert_opt_out(_bookkeeping_only, "no_deliverable_files") + + def test_produces_not_in_diff_verifies_first(self): + self._assert_opt_out(_notes_only, "produces_not_in_diff") @unittest.skip("FEAT-LOOP-2026-0251/T03") diff --git a/tests/test_guard_repair_e2e.py b/tests/test_guard_repair_e2e.py index b5f2f298..b624f1f4 100644 --- a/tests/test_guard_repair_e2e.py +++ b/tests/test_guard_repair_e2e.py @@ -170,6 +170,9 @@ def fake_dispatch(wu, failure_note, cost_tracking=True): self._patch("dispatch", fake_dispatch) self._patch("verify", lambda wu, fd, cfg=None: (True, "(stub)")) + # The absent `src/extra.py` would otherwise be refused early as + # `deliverable_missing`, before the guard under test here. + self._patch("early_produces_refusal", lambda *a, **k: None) loop.run(None, dry_run=False) diff --git a/tests/test_loop_files_changed_guard.py b/tests/test_loop_files_changed_guard.py index 5c974d73..8e21187a 100644 --- a/tests/test_loop_files_changed_guard.py +++ b/tests/test_loop_files_changed_guard.py @@ -308,7 +308,7 @@ def fake_verify(wu, feature_dir, cfg=None): # trigger 3 case (sentinel path the agent never touched). return True, "(stub verify pass)" - self._patch("dispatch", fake_dispatch) + self._patch("dispatch", with_deliverable(fake_dispatch)) self._patch("verify", fake_verify) rc = loop.run(None, dry_run=False) diff --git a/tests/test_replan_end_to_end.py b/tests/test_replan_end_to_end.py index c7a30c96..3b12458c 100644 --- a/tests/test_replan_end_to_end.py +++ b/tests/test_replan_end_to_end.py @@ -39,7 +39,7 @@ from pathlib import Path from tests._loop_loader import load_loop -from tests._workspace import integration_workspace +from tests._workspace import integration_workspace, with_deliverable loop = load_loop() @@ -156,7 +156,7 @@ def fake_verify(wu, feature_dir, gate_file=None): with integration_workspace() as root: os.chdir(root) feature_dir = _scaffold(root) - self._patch("dispatch", fake_dispatch) + self._patch("dispatch", with_deliverable(fake_dispatch)) self._patch("verify", fake_verify) rc = loop.run(None, dry_run=False) diff --git a/tests/test_replan_event_emission.py b/tests/test_replan_event_emission.py index a8c648e7..75877975 100644 --- a/tests/test_replan_event_emission.py +++ b/tests/test_replan_event_emission.py @@ -32,7 +32,7 @@ from specfuse.loop import gate_eval, validate_event from tests._loop_loader import load_loop -from tests._workspace import integration_workspace +from tests._workspace import integration_workspace, with_deliverable loop = load_loop() @@ -141,7 +141,7 @@ def fake_verify(wu, feature_dir, gate_file=None): with integration_workspace() as root: os.chdir(root) feature_dir = _scaffold(root) - self._patch("dispatch", fake_dispatch) + self._patch("dispatch", with_deliverable(fake_dispatch)) self._patch("verify", fake_verify) rc = loop.run(None, dry_run=False) diff --git a/tests/test_replan_note_collision.py b/tests/test_replan_note_collision.py index ce3a9b3c..1d0e0bb8 100644 --- a/tests/test_replan_note_collision.py +++ b/tests/test_replan_note_collision.py @@ -27,7 +27,7 @@ from pathlib import Path from tests._loop_loader import load_loop -from tests._workspace import integration_workspace +from tests._workspace import integration_workspace, with_deliverable loop = load_loop() @@ -110,7 +110,7 @@ def fake_verify(wu, feature_dir, gate_file=None): with integration_workspace() as root: os.chdir(root) feature_dir = _scaffold(root) - self._patch("dispatch", fake_dispatch) + self._patch("dispatch", with_deliverable(fake_dispatch)) self._patch("verify", fake_verify) rc = loop.run(None, dry_run=False) diff --git a/tests/test_replan_trigger.py b/tests/test_replan_trigger.py index 91ce3d36..62ab07f4 100644 --- a/tests/test_replan_trigger.py +++ b/tests/test_replan_trigger.py @@ -183,6 +183,9 @@ def fake_dispatch(wu, failure_note, cost_tracking=True): f"unit loop is spinning instead of terminating (a " f"re-plan must spend the remaining attempt slot, not " f"buy a new budget)") + # A deliverable, so each attempt reaches verify() rather than the + # early `no_deliverable_files` refusal. + Path("deliverable.txt").write_text(f"{dispatch_count['n']}\n") return "```result\nstatus: complete\n```\n" def fake_verify(wu, feature_dir, gate_file=None): From f87d14acebf3797f4d9ccdeed20785dc4b0d10ce Mon Sep 17 00:00:00 2001 From: Test Date: Wed, 25 Nov 2026 18:34:48 -0500 Subject: [PATCH 07/69] =?UTF-8?q?feat:=20T03=20=E2=80=94=20the=20retry=20n?= =?UTF-8?q?ote=20lists=20the=20paths=20the=20attempt=20did=20change?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Feature: FEAT-LOOP-2026-0251/T03 --- .../PROGRESS.md | 2 + .../WU-03-retry-note-paths.md | 11 ++- .../events.jsonl | 13 +++ specfuse/loop/loop.py | 82 ++++++++++++---- tests/test_fail_fast_deliverables.py | 95 ++++++++++++++++++- 5 files changed, 177 insertions(+), 26 deletions(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md index fa38a571..02747f2f 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md @@ -1,3 +1,5 @@ - **FEAT-LOOP-2026-0251/T01**: execute_unit_attempt now refuses an untouched, unjustified produces path before verify_fn, using the same decision and refusal helpers as the late post-squash site; added the gate oracle test file with clause 1 implemented. - note: T02: early_produces_refusal returns None whenever assert_declared_deliverables or assert_implementation_touched_files would refuse, so those keep their own outcomes until you move them early; it reads the pending diff through pending_squash_names (scratch index), and the produces amendment is applied only at the late site, after verify. - **FEAT-LOOP-2026-0251/T02**: deliverable_missing and no_deliverable_files now refuse before verify() via helpers shared with late sites; added defaults.fail_fast_deliverables opt-out (default true), documented and synced. Narrow tier green; broad gates not run. +- **FEAT-LOOP-2026-0251/T03**: Retry notes for all three deliverable refusals (early and late) now list the paths the attempt changed, from the diff the guard judged, capped at 20 plus a count of the rest, or say this attempt changed no files. + - note: The list leaves out driver bookkeeping (the unit's WU file, events.jsonl, PROGRESS note); otherwise an attempt that changed nothing could never say so. Early presence refusals now carry `touched` (the pending diff). Event `files_touched` and the refusal history are unchanged. `loop.run()` tests fail in the sandbox on `~/.claude/session-env`, so I ran them with HOME pointed under $TMPDIR. diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-03-retry-note-paths.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-03-retry-note-paths.md index 38e739a1..31fdd04e 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-03-retry-note-paths.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-03-retry-note-paths.md @@ -1,8 +1,8 @@ --- id: FEAT-LOOP-2026-0251/T03 type: implementation -status: pending -attempts: 0 +status: done +attempts: 1 oracle_env: macos_local planned_cost_usd: 1.00 produces: @@ -10,6 +10,13 @@ produces: - tests/test_fail_fast_deliverables.py model: sonnet effort: medium +gate_set: code +driver_version: 0.33.2 +started_at: 2026-11-25T23:32:32.585980+00:00 +duration_seconds: 135.836 +cost_usd: 0.55332 +input_tokens: 32 +output_tokens: 10935 --- # T03 — the retry note lists the paths the attempt did change diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index a301dcef..94ce35bd 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -12,3 +12,16 @@ {"timestamp": "2026-11-25T23:27:13.019786+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T01", "event_type": "attempt_outcome", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "outcome": "passed", "duration_seconds": 365.44, "agent_seconds": 360.6176762500545, "verify_seconds": 4.786691167042591, "cost_usd": 0.8759794, "input_tokens": 26, "output_tokens": 19488, "cache_read_input_tokens": 1166154, "cache_creation_input_tokens": 141108, "model": "sonnet", "effort": "medium", "failure_class": null, "failure_signature": null, "failure_excerpt": null, "files_touched": [".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-01-produces-before-verify.md", "specfuse/loop/loop.py", "tests/test_fail_fast_deliverables.py", "tests/test_files_changed_auto_repair.py"], "agent_status": "complete", "agent_blocked_reason": null, "re_arm_count": 0, "failing_tests": []}} {"timestamp": "2026-11-25T23:27:13.019947+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T01", "event_type": "task_completed", "source": "driver", "source_version": "0.33.2", "payload": {"attempts": 1, "attempts_usage": [{"attempt": 1, "duration_seconds": 365.44, "cost_usd": 0.8759794, "input_tokens": 26, "output_tokens": 19488, "cache_read_input_tokens": 1166154, "cache_creation_input_tokens": 141108, "agent_seconds": 360.6176762500545, "verify_seconds": 4.786691167042591}], "type": "implementation", "re_arm_count": 0, "cost_usd": 0.875979, "cumulative_cost_usd": 0.875979, "attempts_lifetime": 1, "planned_cost_usd": 2.0}} {"timestamp": "2026-11-25T23:27:13.026375+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "driver_staleness_detected", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "wu_id": "FEAT-LOOP-2026-0251/T01", "driver_paths": ["specfuse/loop/loop.py"], "halted": false, "reason": "driver_restart_required", "pinned_tree": "bd7e508193941835916c63053cc2ec0293e35acc", "next_pin_tree": "95e978bf461a377cb81a6a5d648852cbc50d6b45"}} +{"timestamp": "2026-11-25T23:27:13.112169+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T02", "event_type": "task_started", "source": "driver", "source_version": "0.33.2", "payload": {"type": "implementation", "model": "sonnet", "re_arm_count": 0}} +{"timestamp": "2026-11-25T23:32:32.402772+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T02", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "tests", "ok": true, "skipped": false, "duration_seconds": 5.409, "phase": "attempt"}} +{"timestamp": "2026-11-25T23:32:32.402788+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T02", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "lint", "ok": true, "skipped": false, "duration_seconds": 0.016, "phase": "attempt"}} +{"timestamp": "2026-11-25T23:32:32.402790+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T02", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "changelog-fragments", "ok": true, "skipped": false, "duration_seconds": 0.048, "phase": "attempt"}} +{"timestamp": "2026-11-25T23:32:32.402791+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T02", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "agent-policy-example-lint", "ok": true, "skipped": false, "duration_seconds": 0.106, "phase": "attempt"}} +{"timestamp": "2026-11-25T23:32:32.402794+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T02", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "event-type-gate", "ok": true, "skipped": false, "duration_seconds": 0.143, "phase": "attempt"}} +{"timestamp": "2026-11-25T23:32:32.402796+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T02", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "roadmap-link-gate", "ok": true, "skipped": false, "duration_seconds": 0.051, "phase": "attempt"}} +{"timestamp": "2026-11-25T23:32:32.402797+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T02", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "arm-sweep-gate", "ok": true, "skipped": false, "duration_seconds": 0.386, "phase": "attempt"}} +{"timestamp": "2026-11-25T23:32:32.402799+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T02", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "monitoring-example-lint", "ok": true, "skipped": false, "duration_seconds": 0.045, "phase": "attempt"}} +{"timestamp": "2026-11-25T23:32:32.402801+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T02", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "feature_oracle", "ok": true, "skipped": false, "duration_seconds": 5.388, "phase": "attempt"}} +{"timestamp": "2026-11-25T23:32:32.525060+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T02", "event_type": "attempt_outcome", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "outcome": "passed", "duration_seconds": 319.321, "agent_seconds": 307.57132304203697, "verify_seconds": 11.663945541949943, "cost_usd": 0.7711942999999999, "input_tokens": 40, "output_tokens": 19169, "cache_read_input_tokens": 1599923, "cache_creation_input_tokens": 104858, "model": "sonnet", "effort": "medium", "failure_class": null, "failure_signature": null, "failure_excerpt": null, "files_touched": [".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-02-presence-and-opt-out.md", ".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl", ".specfuse/verification.yml.example", "specfuse/loop/data/verification.yml.example", "specfuse/loop/loop.py", "tests/test_arm_wiring.py", "tests/test_deterministic_refusal_repeat.py", "tests/test_fail_fast_deliverables.py", "tests/test_guard_repair_e2e.py", "tests/test_loop_files_changed_guard.py", "tests/test_replan_end_to_end.py", "tests/test_replan_event_emission.py", "tests/test_replan_note_collision.py", "tests/test_replan_trigger.py"], "agent_status": "complete", "agent_blocked_reason": null, "re_arm_count": 0, "failing_tests": []}} +{"timestamp": "2026-11-25T23:32:32.525227+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T02", "event_type": "task_completed", "source": "driver", "source_version": "0.33.2", "payload": {"attempts": 1, "attempts_usage": [{"attempt": 1, "duration_seconds": 319.321, "cost_usd": 0.7711942999999999, "input_tokens": 40, "output_tokens": 19169, "cache_read_input_tokens": 1599923, "cache_creation_input_tokens": 104858, "agent_seconds": 307.57132304203697, "verify_seconds": 11.663945541949943}], "type": "implementation", "re_arm_count": 0, "cost_usd": 0.771194, "cumulative_cost_usd": 0.771194, "attempts_lifetime": 1, "planned_cost_usd": 1.5}} +{"timestamp": "2026-11-25T23:32:32.532219+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "driver_staleness_detected", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "wu_id": "FEAT-LOOP-2026-0251/T02", "driver_paths": ["specfuse/loop/loop.py"], "halted": false, "reason": "driver_restart_required", "pinned_tree": "bd7e508193941835916c63053cc2ec0293e35acc", "next_pin_tree": "d1b228b61649ec8083cf4d9f8dacabeb2334aa0f"}} diff --git a/specfuse/loop/loop.py b/specfuse/loop/loop.py index 39ef6684..274cee1c 100644 --- a/specfuse/loop/loop.py +++ b/specfuse/loop/loop.py @@ -5211,8 +5211,34 @@ def persist_attempt_notes( return paths +#: Most changed paths a guard-refusal retry note lists before counting the rest. +CHANGED_PATHS_NOTE_CAP = 20 + + +def format_changed_paths(wu: "WorkUnit", changed: list) -> str: + """The retry-note listing of what a refused attempt changed + (FEAT-LOOP-2026-0251/T03). + + *changed* is the diff the guard judged. The driver's own bookkeeping (the + unit's file, `events.jsonl`, the progress note) is left out, as + `assert_implementation_touched_files` leaves it out: the driver writes it + on every attempt, so listing it would hide that the agent changed nothing. + """ + paths = [ + t for t in changed + if Path(t).name not in (wu.file.name, "events.jsonl", PROGRESS_FILENAME) + ] + if not paths: + return "(none — this attempt changed no files)" + lines = [f"- `{p}`" for p in paths[:CHANGED_PATHS_NOTE_CAP]] + rest = len(paths) - CHANGED_PATHS_NOTE_CAP + if rest > 0: + lines.append(f"- … and {rest} more") + return "\n".join(lines) + + def format_deliverable_missing_note( - wu: "WorkUnit", summary: str, touched: list, attempt: int, + wu: "WorkUnit", summary: str, touched: "list | None", attempt: int, ) -> str: """Compose the attempt note for a deliverable-presence refusal (#1412). @@ -5227,10 +5253,10 @@ def format_deliverable_missing_note( Renders what IS knowable at the refusal: every declared ``produces:`` entry marked present or absent as measured on disk, and the paths the - attempt's squash actually touched (``git diff`` against ``head_before``, - measured before the reset). An empty touched list is stated explicitly — - "the agent wrote nothing" is evidence, and the reported run's third - attempt was exactly that. + attempt changed (`format_changed_paths` over the diff the guard judged, + measured before the reset). An empty list is stated explicitly — "the + agent wrote nothing" is evidence, and the reported run's third attempt + was exactly that. *touched* is None when git could not name the diff. The issue also asked for ``git status --porcelain``. At this point the attempt's work is already squashed, so the working tree is clean and the @@ -5272,10 +5298,9 @@ def format_deliverable_missing_note( state = f"PRESENT — {p.stat().st_size} bytes" lines.append(f"- `{path}` — {state}") lines += ["", "## Files this attempt touched", ""] - if touched: - lines += [f"- `{t}`" for t in touched] - else: - lines.append("(none — the attempt's squash changed no tracked file)") + lines.append( + "(unknown — git could not name this attempt's diff)" + if touched is None else format_changed_paths(wu, touched)) lines.append("") return "\n".join(lines) @@ -11678,20 +11703,23 @@ def early_produces_refusal( verification should run. Checks in the post-squash guards' order, so the same one wins: - ``{"outcome": "deliverable_missing", "summary"}``, - ``{"outcome": "no_deliverable_files", "summary"}``, or - ``{"outcome": "produces_not_in_diff", "remaining", "touched"}``. + ``{"outcome": "deliverable_missing", "summary", "touched"}``, + ``{"outcome": "no_deliverable_files", "summary", "touched"}``, or + ``{"outcome": "produces_not_in_diff", "remaining", "touched"}``; + ``touched`` is the pending diff (None if git cannot name it). The last two stay silent when git cannot name the pending diff. """ present, summary = assert_declared_deliverables(wu) - if not present: - return {"outcome": "deliverable_missing", "summary": summary} touched = pending_squash_names(head_before, untracked_before) + if not present: + return {"outcome": "deliverable_missing", "summary": summary, + "touched": touched} if touched is None: return None touched_ok, summary = assert_implementation_touched_files(wu, touched) if not touched_ok: - return {"outcome": "no_deliverable_files", "summary": summary} + return {"outcome": "no_deliverable_files", "summary": summary, + "touched": touched} if not wu.produces: return None remaining = decide_produces_in_diff(wu, touched, result_block, cfg)[0] @@ -11708,15 +11736,18 @@ def early_produces_refusal( def refuse_deliverable_missing( wu: WorkUnit, attempt: int, usage: dict, summary: str, touched: list[str], *, cfg: dict, head_before: str, events_path: Path, - untracked_before, verification_ran: bool, + untracked_before, verification_ran: bool, changed: "list[str] | None", ) -> "tuple[str, dict]": """Settle the tree and build the record of a `deliverable_missing` - refusal for either call site. Returns ``(note, event)``.""" + refusal for either call site. Returns ``(note, event)``. + + *changed* is the diff the note lists; *touched* is the event's + `files_touched`.""" # Composed BEFORE the reset. The reset rolls the attempt back, so # afterwards every declared path reads ABSENT and the note would lose the # one distinction it exists to record — which of the declared # deliverables the attempt did land (#1412). - note = format_deliverable_missing_note(wu, summary, touched, attempt) + note = format_deliverable_missing_note(wu, summary, changed, attempt) if not verification_ran: note += _NOT_VERIFIED_NOTE note, retained = _resolve_guard_refusal_tree( @@ -11739,11 +11770,16 @@ def refuse_deliverable_missing( def refuse_no_deliverable_files( wu: WorkUnit, attempt: int, usage: dict, summary: str, touched: list[str], *, cfg: dict, head_before: str, events_path: Path, - untracked_before, verification_ran: bool, + untracked_before, verification_ran: bool, changed: "list[str] | None", ) -> "tuple[str, dict]": """Settle the tree and build the record of a `no_deliverable_files` refusal for either call site. Returns ``(note, event)``.""" - note = summary if verification_ran else summary + _NOT_VERIFIED_NOTE + note = summary + if changed is not None: + note += ("\n\nPaths this attempt changed:\n" + + format_changed_paths(wu, changed)) + if not verification_ran: + note += _NOT_VERIFIED_NOTE note, retained = _resolve_guard_refusal_tree( cfg, head_before, events_path, untracked_before, note, failure_class="guard_refusal", verification_ran=verification_ran, @@ -11770,6 +11806,8 @@ def refuse_produces_not_in_diff( if not verification_ran: note += _NOT_VERIFIED_NOTE excerpt = extract_failure_excerpt(note) + note += ("\n\nPaths this attempt changed:\n" + + format_changed_paths(wu, touched)) note, retained = _resolve_guard_refusal_tree( cfg, head_before, events_path, untracked_before, note, failure_class="produces_not_in_diff", @@ -13130,6 +13168,7 @@ def run( events_path=events_path, untracked_before=untracked_before, verification_ran=False, + changed=payload["touched"], ) wu_events.append(_early_event) # `+=` for the reason given at the late @@ -13310,6 +13349,8 @@ def run( events_path=events_path, untracked_before=untracked_before, verification_ran=True, + changed=(git_diff_names(head_before, sha) + if sha else []), )) wu_events.append(_deliv_event) refusal_history.append( @@ -13347,6 +13388,7 @@ def run( events_path=events_path, untracked_before=untracked_before, verification_ran=True, + changed=touched, )) wu_events.append(_impl_event) refusal_history.append( diff --git a/tests/test_fail_fast_deliverables.py b/tests/test_fail_fast_deliverables.py index 4d4a0d01..9a02c289 100644 --- a/tests/test_fail_fast_deliverables.py +++ b/tests/test_fail_fast_deliverables.py @@ -313,12 +313,99 @@ def test_produces_not_in_diff_verifies_first(self): self._assert_opt_out(_notes_only, "produces_not_in_diff") -@unittest.skip("FEAT-LOOP-2026-0251/T03") -class TestTreeAndNote(unittest.TestCase): +class TestTreeAndNote(_Case): """Clause 4 — tree handling and retry note.""" - def test_pending(self): - self.fail("T03") + def _retry_note(self, act, retain: bool = True, + fail_fast: bool = True): + """`loop.run()`; returns the note handed to the second T01 attempt and + whether the first attempt's work was still on disk at that point.""" + self._workspace() + notes, kept = [], [] + load = loop.load_verification + + def load_cfg(*args, **kwargs): + cfg = dict(load(*args, **kwargs)) + cfg["defaults"] = {"retain_on_guard_refusal": retain, + "fail_fast_deliverables": fail_fast} + return cfg + + def dispatch(wu, note, ct=True): + if wu.wu_id == T01: + notes.append(note) + if len(notes) == 1: + act() + elif len(notes) == 2: + kept.append(Path("docs/notes.md").exists()) + return _COMPLETE + + self._patch("load_verification", load_cfg) + self._patch("dispatch", dispatch) + self._patch("verify", lambda wu, fd, cfg=None: (True, "(stub)")) + self.assertEqual(loop.run(None, dry_run=False), 1) + for name, original in reversed(self._patches): + setattr(loop, name, original) + self._patches.clear() + self.assertGreaterEqual(len(notes), 2) + return notes[1], kept[0] + + @staticmethod + def _two_files(): + Path("docs").mkdir(exist_ok=True) + Path("docs/notes.md").write_text("notes\n") + Path("docs/other.md").write_text("other\n") + + def _assert_note(self, note): + self.assertIn("src/rule.py", note) + self.assertIn("- `docs/notes.md`", note) + self.assertIn("- `docs/other.md`", note) + self.assertIn("verification did not run", note) + self.assertNotIn("verification already PASSED", note) + + def test_retained_tree_and_note(self): + note, kept = self._retry_note(self._two_files, retain=True) + self._assert_note(note) + self.assertTrue(kept) + + def test_reset_tree_and_note(self): + note, kept = self._retry_note(self._two_files, retain=False) + self._assert_note(note) + self.assertFalse(kept) + + def test_attempt_that_changed_nothing_says_so(self): + note, _ = self._retry_note(lambda: None) + self.assertIn("this attempt changed no files", note) + + def test_presence_refusals_list_changed_paths_early_and_late(self): + def delete_rule_and_write(): + self._two_files() + Path("src/rule.py").unlink() + + for fail_fast in (True, False): + with self.subTest("deliverable_missing", fail_fast=fail_fast): + note, _ = self._retry_note(delete_rule_and_write, + fail_fast=fail_fast) + self.assertIn("- `docs/notes.md`", note) + self.assertIn("- `docs/other.md`", note) + with self.subTest("no_deliverable_files", fail_fast=fail_fast): + note, _ = self._retry_note(lambda: None, fail_fast=fail_fast) + self.assertIn("this attempt changed no files", note) + + def test_late_produces_refusal_lists_changed_paths(self): + note, _ = self._retry_note(self._two_files, fail_fast=False) + self.assertIn("- `docs/notes.md`", note) + self.assertIn("- `docs/other.md`", note) + self.assertNotIn("verification did not run", note) + + def test_list_is_capped_at_twenty(self): + def thirty(): + Path("docs").mkdir(exist_ok=True) + for i in range(30): + Path(f"docs/f{i:02}.md").write_text("x\n") + + note, _ = self._retry_note(thirty, retain=False) + self.assertEqual(note.count("- `docs/f"), 20) + self.assertIn("and 10 more", note) @unittest.skip("FEAT-LOOP-2026-0251/T04") From 31d37b582a4f1a49e28b315ac76f184fefe448d7 Mon Sep 17 00:00:00 2001 From: Test Date: Wed, 25 Nov 2026 18:38:36 -0500 Subject: [PATCH 08/69] =?UTF-8?q?feat:=20T04=20=E2=80=94=20arm-time=20warn?= =?UTF-8?q?ing=20for=20an=20unmentioned=20`produces:`=20path,=20and=20docs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Feature: FEAT-LOOP-2026-0251/T04 --- .../PROGRESS.md | 1 + .../WU-04-arm-time-lint-and-docs.md | 11 +++- .../events.jsonl | 13 ++++ docs/methodology.md | 16 ++++- specfuse/loop/data/docs/methodology.md | 16 ++++- specfuse/loop/lint_plan.py | 46 +++++++++++++++ tests/test_fail_fast_deliverables.py | 59 ++++++++++++++++--- 7 files changed, 147 insertions(+), 15 deletions(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md index 02747f2f..9bbebb28 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md @@ -3,3 +3,4 @@ - **FEAT-LOOP-2026-0251/T02**: deliverable_missing and no_deliverable_files now refuse before verify() via helpers shared with late sites; added defaults.fail_fast_deliverables opt-out (default true), documented and synced. Narrow tier green; broad gates not run. - **FEAT-LOOP-2026-0251/T03**: Retry notes for all three deliverable refusals (early and late) now list the paths the attempt changed, from the diff the guard judged, capped at 20 plus a count of the rest, or say this attempt changed no files. - note: The list leaves out driver bookkeeping (the unit's WU file, events.jsonl, PROGRESS note); otherwise an attempt that changed nothing could never say so. Early presence refusals now carry `touched` (the pending diff). Event `files_touched` and the refusal history are unchanged. `loop.run()` tests fail in the sandbox on `~/.claude/session-env`, so I ran them with HOME pointed under $TMPDIR. +- **FEAT-LOOP-2026-0251/T04**: Added the WARN check `check_produces_mentioned` to `specfuse lint`, replaced the skipped `TestArmTimeWarning` with real tests, and documented the early refusal order in docs/methodology.md. diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-04-arm-time-lint-and-docs.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-04-arm-time-lint-and-docs.md index ee9850cd..5eb11874 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-04-arm-time-lint-and-docs.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-04-arm-time-lint-and-docs.md @@ -1,8 +1,8 @@ --- id: FEAT-LOOP-2026-0251/T04 type: implementation -status: pending -attempts: 0 +status: done +attempts: 1 oracle_env: macos_local planned_cost_usd: 1.50 produces: @@ -12,6 +12,13 @@ produces: - tests/test_fail_fast_deliverables.py model: sonnet effort: medium +gate_set: code +driver_version: 0.33.2 +started_at: 2026-11-25T23:34:48.608747+00:00 +duration_seconds: 228.013 +cost_usd: 0.474428 +input_tokens: 34 +output_tokens: 12969 --- # T04 — arm-time warning for an unmentioned `produces:` path, and docs diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index 94ce35bd..61c2efef 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -25,3 +25,16 @@ {"timestamp": "2026-11-25T23:32:32.525060+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T02", "event_type": "attempt_outcome", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "outcome": "passed", "duration_seconds": 319.321, "agent_seconds": 307.57132304203697, "verify_seconds": 11.663945541949943, "cost_usd": 0.7711942999999999, "input_tokens": 40, "output_tokens": 19169, "cache_read_input_tokens": 1599923, "cache_creation_input_tokens": 104858, "model": "sonnet", "effort": "medium", "failure_class": null, "failure_signature": null, "failure_excerpt": null, "files_touched": [".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-02-presence-and-opt-out.md", ".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl", ".specfuse/verification.yml.example", "specfuse/loop/data/verification.yml.example", "specfuse/loop/loop.py", "tests/test_arm_wiring.py", "tests/test_deterministic_refusal_repeat.py", "tests/test_fail_fast_deliverables.py", "tests/test_guard_repair_e2e.py", "tests/test_loop_files_changed_guard.py", "tests/test_replan_end_to_end.py", "tests/test_replan_event_emission.py", "tests/test_replan_note_collision.py", "tests/test_replan_trigger.py"], "agent_status": "complete", "agent_blocked_reason": null, "re_arm_count": 0, "failing_tests": []}} {"timestamp": "2026-11-25T23:32:32.525227+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T02", "event_type": "task_completed", "source": "driver", "source_version": "0.33.2", "payload": {"attempts": 1, "attempts_usage": [{"attempt": 1, "duration_seconds": 319.321, "cost_usd": 0.7711942999999999, "input_tokens": 40, "output_tokens": 19169, "cache_read_input_tokens": 1599923, "cache_creation_input_tokens": 104858, "agent_seconds": 307.57132304203697, "verify_seconds": 11.663945541949943}], "type": "implementation", "re_arm_count": 0, "cost_usd": 0.771194, "cumulative_cost_usd": 0.771194, "attempts_lifetime": 1, "planned_cost_usd": 1.5}} {"timestamp": "2026-11-25T23:32:32.532219+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "driver_staleness_detected", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "wu_id": "FEAT-LOOP-2026-0251/T02", "driver_paths": ["specfuse/loop/loop.py"], "halted": false, "reason": "driver_restart_required", "pinned_tree": "bd7e508193941835916c63053cc2ec0293e35acc", "next_pin_tree": "d1b228b61649ec8083cf4d9f8dacabeb2334aa0f"}} +{"timestamp": "2026-11-25T23:32:32.586154+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T03", "event_type": "task_started", "source": "driver", "source_version": "0.33.2", "payload": {"type": "implementation", "model": "sonnet", "re_arm_count": 0}} +{"timestamp": "2026-11-25T23:34:48.422437+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T03", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "tests", "ok": true, "skipped": false, "duration_seconds": 10.542, "phase": "attempt"}} +{"timestamp": "2026-11-25T23:34:48.422452+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T03", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "lint", "ok": true, "skipped": false, "duration_seconds": 0.017, "phase": "attempt"}} +{"timestamp": "2026-11-25T23:34:48.422455+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T03", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "changelog-fragments", "ok": true, "skipped": false, "duration_seconds": 0.049, "phase": "attempt"}} +{"timestamp": "2026-11-25T23:34:48.422458+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T03", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "agent-policy-example-lint", "ok": true, "skipped": false, "duration_seconds": 0.105, "phase": "attempt"}} +{"timestamp": "2026-11-25T23:34:48.422460+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T03", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "event-type-gate", "ok": true, "skipped": false, "duration_seconds": 0.146, "phase": "attempt"}} +{"timestamp": "2026-11-25T23:34:48.422462+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T03", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "roadmap-link-gate", "ok": true, "skipped": false, "duration_seconds": 0.05, "phase": "attempt"}} +{"timestamp": "2026-11-25T23:34:48.422464+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T03", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "arm-sweep-gate", "ok": true, "skipped": false, "duration_seconds": 0.384, "phase": "attempt"}} +{"timestamp": "2026-11-25T23:34:48.422465+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T03", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "monitoring-example-lint", "ok": true, "skipped": false, "duration_seconds": 0.05, "phase": "attempt"}} +{"timestamp": "2026-11-25T23:34:48.422467+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T03", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "feature_oracle", "ok": true, "skipped": false, "duration_seconds": 10.271, "phase": "attempt"}} +{"timestamp": "2026-11-25T23:34:48.546625+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T03", "event_type": "attempt_outcome", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "outcome": "passed", "duration_seconds": 135.836, "agent_seconds": 114.14820829196833, "verify_seconds": 21.66602841706481, "cost_usd": 0.5533203999999999, "input_tokens": 32, "output_tokens": 10935, "cache_read_input_tokens": 1133504, "cache_creation_input_tokens": 82639, "model": "sonnet", "effort": "medium", "failure_class": null, "failure_signature": null, "failure_excerpt": null, "files_touched": [".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-03-retry-note-paths.md", ".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl", "specfuse/loop/loop.py", "tests/test_fail_fast_deliverables.py"], "agent_status": "complete", "agent_blocked_reason": null, "re_arm_count": 0, "failing_tests": []}} +{"timestamp": "2026-11-25T23:34:48.546793+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T03", "event_type": "task_completed", "source": "driver", "source_version": "0.33.2", "payload": {"attempts": 1, "attempts_usage": [{"attempt": 1, "duration_seconds": 135.836, "cost_usd": 0.5533203999999999, "input_tokens": 32, "output_tokens": 10935, "cache_read_input_tokens": 1133504, "cache_creation_input_tokens": 82639, "agent_seconds": 114.14820829196833, "verify_seconds": 21.66602841706481}], "type": "implementation", "re_arm_count": 0, "cost_usd": 0.55332, "cumulative_cost_usd": 0.55332, "attempts_lifetime": 1, "planned_cost_usd": 1.0}} +{"timestamp": "2026-11-25T23:34:48.553880+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "driver_staleness_detected", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "wu_id": "FEAT-LOOP-2026-0251/T03", "driver_paths": ["specfuse/loop/loop.py"], "halted": false, "reason": "driver_restart_required", "pinned_tree": "bd7e508193941835916c63053cc2ec0293e35acc", "next_pin_tree": "eabc9c7d809a47e5af3be10b4bc1068ef01cca52"}} diff --git a/docs/methodology.md b/docs/methodology.md index c00eaa3f..9ba38245 100644 --- a/docs/methodology.md +++ b/docs/methodology.md @@ -454,9 +454,9 @@ bound to the emitter by `tests/test_attempt_outcome_contract.py`: | `zero_token_skip` | the session produced no tokens; nothing ran | | `files_changed_mismatch` | RESULT declared paths that show no diff | | `closing_deliverable_missing` | a closing-WU guard refused (see `close-discipline.md` §4) | -| `deliverable_missing` | a declared `produces:` path is absent | -| `no_deliverable_files` | the squash names only the WU file / events | -| `produces_not_in_diff` | `produces:` path exists but is not in the squash, and the RESULT's `produces_unchanged:` did not justify it | +| `deliverable_missing` | a declared `produces:` path is absent; refused before verification unless `defaults.fail_fast_deliverables: false` | +| `no_deliverable_files` | the squash names only the WU file / events; refused before verification unless `defaults.fail_fast_deliverables: false` | +| `produces_not_in_diff` | `produces:` path exists but is not in the squash, and the RESULT's `produces_unchanged:` did not justify it; refused before verification unless `defaults.fail_fast_deliverables: false` | | `squash_commit_failed` | `git commit` for the squash was rejected | | `smoke_import_failed` | a declared smoke-import line failed post-squash | | `learnings_not_staged` | a closing WU under `autonomy_default: auto` touched `.specfuse/LEARNINGS.md` directly instead of staging to `LEARNINGS-pending.md` (FEAT-2026-0053/T09) | @@ -507,6 +507,16 @@ consumer that queries only those concludes the record is empty when it is not. A cross-repo audit reported three separate "missing diagnostic" findings that were all query errors against this contract, none of which existed (#270). +**Presence refusals run before verification (FEAT-LOOP-2026-0251).** +`produces_not_in_diff`, `deliverable_missing` and `no_deliverable_files` judge +only the attempt's diff against `produces:`, so the driver decides them before +any verification gate runs, and a refused attempt pays for no gate. Setting +`defaults.fail_fast_deliverables: false` in `verification.yml` restores the old +order, in which they run only after verification passes. What is refused does +not change, only when. The retry note for these refusals also lists the paths +the attempt did change. `specfuse lint` warns before arming when a unit's body +never mentions a `produces:` path (full path, file name or parent directory). + **Retain-and-repair (FEAT-2026-0103).** `files_changed_mismatch`, `produces_not_in_diff`, `deliverable_missing`, and `no_deliverable_files` — the guard-refusal outcomes — record `tree_retained: true` in `extras` by diff --git a/specfuse/loop/data/docs/methodology.md b/specfuse/loop/data/docs/methodology.md index c00eaa3f..9ba38245 100644 --- a/specfuse/loop/data/docs/methodology.md +++ b/specfuse/loop/data/docs/methodology.md @@ -454,9 +454,9 @@ bound to the emitter by `tests/test_attempt_outcome_contract.py`: | `zero_token_skip` | the session produced no tokens; nothing ran | | `files_changed_mismatch` | RESULT declared paths that show no diff | | `closing_deliverable_missing` | a closing-WU guard refused (see `close-discipline.md` §4) | -| `deliverable_missing` | a declared `produces:` path is absent | -| `no_deliverable_files` | the squash names only the WU file / events | -| `produces_not_in_diff` | `produces:` path exists but is not in the squash, and the RESULT's `produces_unchanged:` did not justify it | +| `deliverable_missing` | a declared `produces:` path is absent; refused before verification unless `defaults.fail_fast_deliverables: false` | +| `no_deliverable_files` | the squash names only the WU file / events; refused before verification unless `defaults.fail_fast_deliverables: false` | +| `produces_not_in_diff` | `produces:` path exists but is not in the squash, and the RESULT's `produces_unchanged:` did not justify it; refused before verification unless `defaults.fail_fast_deliverables: false` | | `squash_commit_failed` | `git commit` for the squash was rejected | | `smoke_import_failed` | a declared smoke-import line failed post-squash | | `learnings_not_staged` | a closing WU under `autonomy_default: auto` touched `.specfuse/LEARNINGS.md` directly instead of staging to `LEARNINGS-pending.md` (FEAT-2026-0053/T09) | @@ -507,6 +507,16 @@ consumer that queries only those concludes the record is empty when it is not. A cross-repo audit reported three separate "missing diagnostic" findings that were all query errors against this contract, none of which existed (#270). +**Presence refusals run before verification (FEAT-LOOP-2026-0251).** +`produces_not_in_diff`, `deliverable_missing` and `no_deliverable_files` judge +only the attempt's diff against `produces:`, so the driver decides them before +any verification gate runs, and a refused attempt pays for no gate. Setting +`defaults.fail_fast_deliverables: false` in `verification.yml` restores the old +order, in which they run only after verification passes. What is refused does +not change, only when. The retry note for these refusals also lists the paths +the attempt did change. `specfuse lint` warns before arming when a unit's body +never mentions a `produces:` path (full path, file name or parent directory). + **Retain-and-repair (FEAT-2026-0103).** `files_changed_mismatch`, `produces_not_in_diff`, `deliverable_missing`, and `no_deliverable_files` — the guard-refusal outcomes — record `tree_retained: true` in `extras` by diff --git a/specfuse/loop/lint_plan.py b/specfuse/loop/lint_plan.py index e0f15c35..806b3cc5 100644 --- a/specfuse/loop/lint_plan.py +++ b/specfuse/loop/lint_plan.py @@ -29,6 +29,7 @@ from __future__ import annotations import fnmatch +import os import re from pathlib import Path @@ -1040,6 +1041,50 @@ def check_produces_satisfiability(feature_dir: Path, gates: list) -> None: ) +def check_produces_mentioned(feature_dir: Path, gates: list) -> None: + """WARN when a dispatchable WU's body never mentions a `produces:` path. + + A session told nothing about a declared path tends not to touch it, and + the driver then refuses the attempt (`produces_not_in_diff`). A mention is + the full path, the file name, or the parent directory. The parent + directory is accepted because matching only path or file name fired on + 81 of 401 `done` units here (20.2%); with it, 35 (8.7%). Dispatchable + means any status but `done` / `abandoned`. WARN-only. See + FEAT-LOOP-2026-0251/T04. + """ + for gate in gates: + for entry in gate.get("work_units") or []: + wid, wfile = entry.get("id"), entry.get("file") + if not wid or not wfile: + continue + wpath = feature_dir / wfile + if not wpath.exists(): + continue + wfm, body = read_frontmatter(wpath) + if wfm.get("status") in ("done", "abandoned"): + continue + produces_raw = wfm.get("produces") + if not produces_raw: + continue + raw_entries = ( + produces_raw if isinstance(produces_raw, list) else [produces_raw] + ) + for p in raw_entries: + p_s = str(p).strip() + if not p_s: + continue + needles = (p_s, os.path.basename(p_s), os.path.dirname(p_s)) + if any(n and n in body for n in needles): + continue + print( + f"WARN: {wfile}: {wid} declares produces path {p_s!r}, but " + f"its body names neither the path, its file name nor its " + f"directory. An attempt that leaves it untouched is refused " + f"after the session with produces_not_in_diff. Name the " + f"path in the body, or drop it from produces:." + ) + + # Ceremony-proportionality threshold (docs/methodology.md §6): one fact, one # home. Referenced, not redefined, in the draft-feature skill. GATE_PROPORTIONALITY_THRESHOLD = 12 # was 8 until #3426 @@ -2276,6 +2321,7 @@ def _lint_impl(feature_dir: Path) -> list[str]: # as detecting-a-condition-is-not-handling-it. errs.extend(check_convergent_wu_wiring(feature_dir, fm, gates)) check_produces_satisfiability(feature_dir, gates) + check_produces_mentioned(feature_dir, gates) lint_gate_proportionality(feature_dir, gates) errs.extend(check_produces_shape(feature_dir, gates)) errs.extend(check_judge_edit_acknowledged(feature_dir, gates)) diff --git a/tests/test_fail_fast_deliverables.py b/tests/test_fail_fast_deliverables.py index 9a02c289..f8810d27 100644 --- a/tests/test_fail_fast_deliverables.py +++ b/tests/test_fail_fast_deliverables.py @@ -4,18 +4,21 @@ # """FEAT-LOOP-2026-0251 gate 1 oracle — a missing deliverable is refused before the verification gates run. One class per Definition-of-done clause in -GATE-01.md. T01 implements clause 1; the rest are skipped naming their owning -unit. +GATE-01.md. """ from __future__ import annotations +import contextlib +import io import json import os import subprocess +import tempfile import unittest from pathlib import Path +from specfuse.loop import lint_plan from tests._loop_loader import load_loop from tests._workspace import integration_workspace @@ -408,13 +411,55 @@ def thirty(): self.assertIn("and 10 more", note) -@unittest.skip("FEAT-LOOP-2026-0251/T04") -class TestArmTimeWarning(unittest.TestCase): +class TestArmTimeWarning(_Case): """Clause 5 — arm-time WARN for an unmentioned `produces:` path.""" - def test_pending(self): - self.fail("T04") - + PATH = "docs/guides/widget-notes.md" + + def _lint(self, status: str, body: str) -> str: + with tempfile.TemporaryDirectory() as tmp: + fdir = Path(tmp) + (fdir / "WU-T01.md").write_text( + f"---\nid: {T01}\nstatus: {status}\nproduces:\n" + f" - {self.PATH}\n---\n\n{body}\n" + ) + gates = [{"gate": 1, "work_units": [ + {"id": T01, "file": "WU-T01.md"}]}] + out = io.StringIO() + with contextlib.redirect_stdout(out): + lint_plan.check_produces_mentioned(fdir, gates) + return out.getvalue() + + def test_pending_unmentioned_warns(self): + out = self._lint("pending", "Write the notes.") + self.assertIn("WARN:", out) + self.assertIn(T01, out) + self.assertIn(self.PATH, out) + self.assertIn("produces_not_in_diff", out) + + def test_file_name_mention_is_silent(self): + self.assertEqual(self._lint("pending", "Write widget-notes.md."), "") + + def test_full_path_mention_is_silent(self): + self.assertEqual(self._lint("pending", f"Write {self.PATH}."), "") + + def test_parent_directory_mention_is_silent(self): + self.assertEqual(self._lint("pending", "Add under docs/guides."), "") + + def test_done_and_abandoned_are_silent(self): + for status in ("done", "abandoned"): + with self.subTest(status=status): + self.assertEqual(self._lint(status, "Write the notes."), "") + + def test_lint_runs_the_check(self): + _, fdir = self._workspace() + wu = fdir / "WU-T01.md" + wu.write_text(wu.read_text().replace( + "src/rule.py", "zzz/unnamed-thing.md")) + out = io.StringIO() + with contextlib.redirect_stdout(out): + lint_plan.lint(fdir) + self.assertIn("zzz/unnamed-thing.md", out.getvalue()) if __name__ == "__main__": unittest.main() From c66a4d04813a30a068ad7a6de908ede44b6fbca5 Mon Sep 17 00:00:00 2001 From: Test Date: Wed, 25 Nov 2026 18:44:20 -0500 Subject: [PATCH 09/69] =?UTF-8?q?chore(loop):=20gate=201=20broad=20run=20f?= =?UTF-8?q?ailed=20=E2=80=94=20awaiting=5Freview?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Feature: FEAT-LOOP-2026-0251 --- .../GATE-01-CRITERIA.md | 77 +++++++++++++++++++ .../GATE-01.md | 13 +++- .../events.jsonl | 34 ++++++++ 3 files changed, 123 insertions(+), 1 deletion(-) create mode 100644 .specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01-CRITERIA.md diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01-CRITERIA.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01-CRITERIA.md new file mode 100644 index 00000000..21ece184 --- /dev/null +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01-CRITERIA.md @@ -0,0 +1,77 @@ +### T01#1 + +- **criterion:** `tests.test_fail_fast_deliverables.TestProducesNotInDiffEarly` fails on HEAD and passes +- **state:** `unverified` +- **covers:** specfuse/loop/loop.py, tests/test_fail_fast_deliverables.py + +### T01#2 + +- **criterion:** The early refusal's `failure_class`, `failure_signature` and `summary` equal what the late +- **state:** `unverified` +- **covers:** specfuse/loop/loop.py, tests/test_fail_fast_deliverables.py + +### T01#3 + +- **criterion:** `python3 -m unittest tests.test_dispatch_skeleton tests.test_gate_timings -b` passes; any +- **state:** `unverified` +- **covers:** specfuse/loop/loop.py, tests/test_fail_fast_deliverables.py + +### T02#1 + +- **criterion:** `tests.test_fail_fast_deliverables.TestPresenceEarly` fails on HEAD and passes after: an +- **state:** `unverified` +- **covers:** specfuse/loop/loop.py, .specfuse/verification.yml.example, specfuse/loop/data/verification.yml.example, tests/test_fail_fast_deliverables.py + +### T02#2 + +- **criterion:** `TestOptOut` fails on HEAD and passes after: with `fail_fast_deliverables: false`, each of +- **state:** `unverified` +- **covers:** specfuse/loop/loop.py, .specfuse/verification.yml.example, specfuse/loop/data/verification.yml.example, tests/test_fail_fast_deliverables.py + +### T02#3 + +- **criterion:** `diff .specfuse/verification.yml.example specfuse/loop/data/verification.yml.example` is +- **state:** `unverified` +- **covers:** specfuse/loop/loop.py, .specfuse/verification.yml.example, specfuse/loop/data/verification.yml.example, tests/test_fail_fast_deliverables.py + +### T03#1 + +- **criterion:** `tests.test_fail_fast_deliverables.TestTreeAndNote` fails on HEAD and passes after. It +- **state:** `unverified` +- **covers:** specfuse/loop/loop.py, tests/test_fail_fast_deliverables.py + +### T03#2 + +- **criterion:** The cap holds: a diff of 30 paths lists 20 and the count of the remaining 10. +- **state:** `unverified` +- **covers:** specfuse/loop/loop.py, tests/test_fail_fast_deliverables.py + +### T04#1 + +- **criterion:** `tests.test_fail_fast_deliverables.TestArmTimeWarning` fails on HEAD and passes after: a +- **state:** `unverified` +- **covers:** specfuse/loop/lint_plan.py, docs/methodology.md, specfuse/loop/data/docs/methodology.md, tests/test_fail_fast_deliverables.py + +### T04#2 + +- **criterion:** `specfuse lint` exits 0 on every feature folder under `.specfuse/features/` (WARN only). +- **state:** `unverified` +- **covers:** specfuse/loop/lint_plan.py, docs/methodology.md, specfuse/loop/data/docs/methodology.md, tests/test_fail_fast_deliverables.py + +### T04#3 + +- **criterion:** The RESULT's notes give the measured count and total from the Context bullet. +- **state:** `unverified` +- **covers:** specfuse/loop/lint_plan.py, docs/methodology.md, specfuse/loop/data/docs/methodology.md, tests/test_fail_fast_deliverables.py + +### T04#4 + +- **criterion:** `diff docs/methodology.md specfuse/loop/data/docs/methodology.md` is empty. +- **state:** `unverified` +- **covers:** specfuse/loop/lint_plan.py, docs/methodology.md, specfuse/loop/data/docs/methodology.md, tests/test_fail_fast_deliverables.py + +### T04#5 + +- **criterion:** `grep -c "unittest.skip" tests/test_fail_fast_deliverables.py` prints `0`. +- **state:** `unverified` +- **covers:** specfuse/loop/lint_plan.py, docs/methodology.md, specfuse/loop/data/docs/methodology.md, tests/test_fail_fast_deliverables.py diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md index 117a398f..87691d31 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md @@ -1,8 +1,19 @@ --- gate: 1 -status: open +status: awaiting_review feature_oracle: "python3 -m unittest tests.test_fail_fast_deliverables -v -b" cost_budget_usd: 14.00 +broad_run: + tree: 07bbf72d1e7af3c1a03af605f40e5563dc3a18db:0ec7c6da6e74f0b56753f09657b654a6d289b91b:12064a6191eeb830a9826d911a8543fbaba3da75:27968248a450a842ccd187b7dce0fb0ded934866:287efde8f90320baffac08f5f3287b9456a65cb9:2e29b2f7e073a0cbe290f01d3b397e1cdd10c81c:35c75a1cedaa1c6f5d86de48a37ee0ed7f5a40c7:42796ea0e0a6c03811b0e4bc9dbd3b5ee62dd2e4:4acc6dfc5e8cece358c167d876515eba4a39a500:834d9d9c16094a386cd9b5a6f9ced9a3a9b4e7fb:a094f79b3e937804a653ff632027c895c6aa1c4b:bbd1aea514612d76722a18c7aece7c767cf1a076:c23b62e87f1ae3890c6f9e3d8c7ca7ec9225ed81:caffe2d63ceacde448842a91bc7a12c206a67523:d74b7d113b844e84f0009098f576fd28477f072d:e1aa20b9c08a5ebe036da74f16e28c751f18f6fa:e3b0de29b81a6c8e0abeacb3898519b98014b9ef:f7cc7e015d02e9c4c7c56b31e4f2f910d044d732:fa2f4f88657587b6e3b560977858810846b1d366 + ran_at: 2026-11-25T23:44:20.143959+00:00 + ok: false + failing: + - gate: tests + failure_class: tests + failure_signature: "(failures=2," + - gate: coverage + failure_class: other + failure_signature: "no_gate_marker" --- # Gate 1 — a missing deliverable is refused before any verification gate runs diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index 61c2efef..b2c9f378 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -38,3 +38,37 @@ {"timestamp": "2026-11-25T23:34:48.546625+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T03", "event_type": "attempt_outcome", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "outcome": "passed", "duration_seconds": 135.836, "agent_seconds": 114.14820829196833, "verify_seconds": 21.66602841706481, "cost_usd": 0.5533203999999999, "input_tokens": 32, "output_tokens": 10935, "cache_read_input_tokens": 1133504, "cache_creation_input_tokens": 82639, "model": "sonnet", "effort": "medium", "failure_class": null, "failure_signature": null, "failure_excerpt": null, "files_touched": [".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-03-retry-note-paths.md", ".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl", "specfuse/loop/loop.py", "tests/test_fail_fast_deliverables.py"], "agent_status": "complete", "agent_blocked_reason": null, "re_arm_count": 0, "failing_tests": []}} {"timestamp": "2026-11-25T23:34:48.546793+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T03", "event_type": "task_completed", "source": "driver", "source_version": "0.33.2", "payload": {"attempts": 1, "attempts_usage": [{"attempt": 1, "duration_seconds": 135.836, "cost_usd": 0.5533203999999999, "input_tokens": 32, "output_tokens": 10935, "cache_read_input_tokens": 1133504, "cache_creation_input_tokens": 82639, "agent_seconds": 114.14820829196833, "verify_seconds": 21.66602841706481}], "type": "implementation", "re_arm_count": 0, "cost_usd": 0.55332, "cumulative_cost_usd": 0.55332, "attempts_lifetime": 1, "planned_cost_usd": 1.0}} {"timestamp": "2026-11-25T23:34:48.553880+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "driver_staleness_detected", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "wu_id": "FEAT-LOOP-2026-0251/T03", "driver_paths": ["specfuse/loop/loop.py"], "halted": false, "reason": "driver_restart_required", "pinned_tree": "bd7e508193941835916c63053cc2ec0293e35acc", "next_pin_tree": "eabc9c7d809a47e5af3be10b4bc1068ef01cca52"}} +{"timestamp": "2026-11-25T23:34:48.608940+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T04", "event_type": "task_started", "source": "driver", "source_version": "0.33.2", "payload": {"type": "implementation", "model": "sonnet", "re_arm_count": 0}} +{"timestamp": "2026-11-25T23:38:36.621867+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T04", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "tests", "ok": true, "skipped": false, "duration_seconds": 10.235, "phase": "attempt"}} +{"timestamp": "2026-11-25T23:38:36.621884+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T04", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "lint", "ok": true, "skipped": false, "duration_seconds": 0.016, "phase": "attempt"}} +{"timestamp": "2026-11-25T23:38:36.621887+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T04", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "changelog-fragments", "ok": true, "skipped": false, "duration_seconds": 0.049, "phase": "attempt"}} +{"timestamp": "2026-11-25T23:38:36.621890+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T04", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "agent-policy-example-lint", "ok": true, "skipped": false, "duration_seconds": 0.109, "phase": "attempt"}} +{"timestamp": "2026-11-25T23:38:36.621892+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T04", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "event-type-gate", "ok": true, "skipped": false, "duration_seconds": 0.171, "phase": "attempt"}} +{"timestamp": "2026-11-25T23:38:36.621893+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T04", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "roadmap-link-gate", "ok": true, "skipped": false, "duration_seconds": 0.052, "phase": "attempt"}} +{"timestamp": "2026-11-25T23:38:36.621895+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T04", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "arm-sweep-gate", "ok": true, "skipped": false, "duration_seconds": 0.384, "phase": "attempt"}} +{"timestamp": "2026-11-25T23:38:36.621896+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T04", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "monitoring-example-lint", "ok": true, "skipped": false, "duration_seconds": 0.047, "phase": "attempt"}} +{"timestamp": "2026-11-25T23:38:36.621898+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T04", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "feature_oracle", "ok": true, "skipped": false, "duration_seconds": 10.447, "phase": "attempt"}} +{"timestamp": "2026-11-25T23:38:36.733953+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T04", "event_type": "attempt_outcome", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "outcome": "passed", "duration_seconds": 228.013, "agent_seconds": 206.41850266698748, "verify_seconds": 21.561221707961522, "cost_usd": 0.47442840000000003, "input_tokens": 34, "output_tokens": 12969, "cache_read_input_tokens": 1045464, "cache_creation_input_tokens": 60031, "model": "sonnet", "effort": "medium", "failure_class": null, "failure_signature": null, "failure_excerpt": null, "files_touched": [".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-04-arm-time-lint-and-docs.md", ".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl", "docs/methodology.md", "specfuse/loop/data/docs/methodology.md", "specfuse/loop/lint_plan.py", "tests/test_fail_fast_deliverables.py"], "agent_status": "complete", "agent_blocked_reason": null, "re_arm_count": 0, "failing_tests": []}} +{"timestamp": "2026-11-25T23:38:36.734113+00:00", "correlation_id": "FEAT-LOOP-2026-0251/T04", "event_type": "task_completed", "source": "driver", "source_version": "0.33.2", "payload": {"attempts": 1, "attempts_usage": [{"attempt": 1, "duration_seconds": 228.013, "cost_usd": 0.47442840000000003, "input_tokens": 34, "output_tokens": 12969, "cache_read_input_tokens": 1045464, "cache_creation_input_tokens": 60031, "agent_seconds": 206.41850266698748, "verify_seconds": 21.561221707961522}], "type": "implementation", "re_arm_count": 0, "cost_usd": 0.474428, "cumulative_cost_usd": 0.474428, "attempts_lifetime": 1, "planned_cost_usd": 1.5}} +{"timestamp": "2026-11-25T23:38:36.742148+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "driver_staleness_detected", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "wu_id": "FEAT-LOOP-2026-0251/T04", "driver_paths": ["specfuse/loop/lint_plan.py"], "halted": false, "reason": "driver_restart_required", "pinned_tree": "bd7e508193941835916c63053cc2ec0293e35acc", "next_pin_tree": "08c93348147dd5bb8705262aa0073adba4cbbb29"}} +{"timestamp": "2026-11-25T23:44:20.150756+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "broad_run_result", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "tree": "07bbf72d1e7af3c1a03af605f40e5563dc3a18db:0ec7c6da6e74f0b56753f09657b654a6d289b91b:12064a6191eeb830a9826d911a8543fbaba3da75:27968248a450a842ccd187b7dce0fb0ded934866:287efde8f90320baffac08f5f3287b9456a65cb9:2e29b2f7e073a0cbe290f01d3b397e1cdd10c81c:35c75a1cedaa1c6f5d86de48a37ee0ed7f5a40c7:42796ea0e0a6c03811b0e4bc9dbd3b5ee62dd2e4:4acc6dfc5e8cece358c167d876515eba4a39a500:834d9d9c16094a386cd9b5a6f9ced9a3a9b4e7fb:a094f79b3e937804a653ff632027c895c6aa1c4b:bbd1aea514612d76722a18c7aece7c767cf1a076:c23b62e87f1ae3890c6f9e3d8c7ca7ec9225ed81:caffe2d63ceacde448842a91bc7a12c206a67523:d74b7d113b844e84f0009098f576fd28477f072d:e1aa20b9c08a5ebe036da74f16e28c751f18f6fa:e3b0de29b81a6c8e0abeacb3898519b98014b9ef:f7cc7e015d02e9c4c7c56b31e4f2f910d044d732:fa2f4f88657587b6e3b560977858810846b1d366", "ok": false, "failing": [{"gate": "tests", "failure_class": "tests", "failure_signature": "(failures=2,"}, {"gate": "coverage", "failure_class": "other", "failure_signature": "no_gate_marker"}]}} +{"timestamp": "2026-11-25T23:44:20.150783+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "tests", "ok": false, "skipped": false, "duration_seconds": 306.85, "phase": "broad"}} +{"timestamp": "2026-11-25T23:44:20.150789+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "lint", "ok": true, "skipped": false, "duration_seconds": 0.051, "phase": "broad"}} +{"timestamp": "2026-11-25T23:44:20.150791+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "security", "ok": true, "skipped": false, "duration_seconds": 1.607, "phase": "broad"}} +{"timestamp": "2026-11-25T23:44:20.150793+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "coverage", "ok": false, "skipped": true, "duration_seconds": 0, "phase": "broad"}} +{"timestamp": "2026-11-25T23:44:20.150796+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "leak-scan", "ok": true, "skipped": false, "duration_seconds": 16.978, "phase": "broad"}} +{"timestamp": "2026-11-25T23:44:20.150798+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "changelog-fragments", "ok": true, "skipped": false, "duration_seconds": 0.048, "phase": "broad"}} +{"timestamp": "2026-11-25T23:44:20.150800+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "agent-policy-example-lint", "ok": true, "skipped": false, "duration_seconds": 0.106, "phase": "broad"}} +{"timestamp": "2026-11-25T23:44:20.150802+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "event-type-gate", "ok": true, "skipped": false, "duration_seconds": 0.146, "phase": "broad"}} +{"timestamp": "2026-11-25T23:44:20.150804+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "roadmap-link-gate", "ok": true, "skipped": false, "duration_seconds": 0.051, "phase": "broad"}} +{"timestamp": "2026-11-25T23:44:20.150805+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "arm-sweep-gate", "ok": true, "skipped": false, "duration_seconds": 0.39, "phase": "broad"}} +{"timestamp": "2026-11-25T23:44:20.150806+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "monitoring-example-lint", "ok": true, "skipped": false, "duration_seconds": 0.049, "phase": "broad"}} +{"timestamp": "2026-11-25T23:44:20.150807+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "leak-scan-hook", "ok": true, "skipped": false, "duration_seconds": 0.847, "phase": "broad"}} +{"timestamp": "2026-11-25T23:44:20.150808+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "pre-push-hook", "ok": true, "skipped": false, "duration_seconds": 3.364, "phase": "broad"}} +{"timestamp": "2026-11-25T23:44:20.150810+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "sync-scaffold-bats", "ok": true, "skipped": false, "duration_seconds": 9.878, "phase": "broad"}} +{"timestamp": "2026-11-25T23:44:20.150811+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "sync-scaffold-symlinks-bats", "ok": true, "skipped": false, "duration_seconds": 1.519, "phase": "broad"}} +{"timestamp": "2026-11-25T23:44:20.150812+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "init-sh-shim-bats", "ok": true, "skipped": false, "duration_seconds": 0.839, "phase": "broad"}} +{"timestamp": "2026-11-25T23:44:20.150813+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "init-skills-bats", "ok": true, "skipped": false, "duration_seconds": 0.118, "phase": "broad"}} +{"timestamp": "2026-11-25T23:44:20.150814+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "hookspath-conflict-bats", "ok": true, "skipped": false, "duration_seconds": 0.536, "phase": "broad"}} +{"timestamp": "2026-11-25T23:44:20.151234+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "human_escalation", "source": "driver", "source_version": "0.33.2", "payload": {"reason": "broad_run_gate_failure", "gate": 1, "failing_gates": [{"gate": "tests", "failure_class": "tests", "failure_signature": "(failures=2,"}, {"gate": "coverage", "failure_class": "other", "failure_signature": "no_gate_marker"}], "message": "Gate 1 is blocked: the full `code` gate set failed on the once-per-gate broad run this gate's closing sequence requires before it may dispatch (FEAT-2026-0109/T06).\n\nTree measured: 07bbf72d1e7af3c1a03af605f40e5563dc3a18db:0ec7c6da6e74f0b56753f09657b654a6d289b91b:12064a6191eeb830a9826d911a8543fbaba3da75:27968248a450a842ccd187b7dce0fb0ded934866:287efde8f90320baffac08f5f3287b9456a65cb9:2e29b2f7e073a0cbe290f01d3b397e1cdd10c81c:35c75a1cedaa1c6f5d86de48a37ee0ed7f5a40c7:42796ea0e0a6c03811b0e4bc9dbd3b5ee62dd2e4:4acc6dfc5e8cece358c167d876515eba4a39a500:834d9d9c16094a386cd9b5a6f9ced9a3a9b4e7fb:a094f79b3e937804a653ff632027c895c6aa1c4b:bbd1aea514612d76722a18c7aece7c767cf1a076:c23b62e87f1ae3890c6f9e3d8c7ca7ec9225ed81:caffe2d63ceacde448842a91bc7a12c206a67523:d74b7d113b844e84f0009098f576fd28477f072d:e1aa20b9c08a5ebe036da74f16e28c751f18f6fa:e3b0de29b81a6c8e0abeacb3898519b98014b9ef:f7cc7e015d02e9c4c7c56b31e4f2f910d044d732:fa2f4f88657587b6e3b560977858810846b1d366\n\nFailing check(s):\n - tests: tests (signature: (failures=2,)\n - coverage: other (signature: no_gate_marker)\n\nNo work unit's attempt count was charged for this: every unit in this gate already passed its own per-attempt verification. The per-attempt narrow tier (FEAT-2026-0109/T04, T05) scopes checks to changed files as a speed optimization \u2014 this full-set run is the safety net that catches what that narrowing missed.\n\nWhat to do next:\n 1. Reproduce the failing check(s) above locally and fix them on this branch.\n 2. Re-run the driver \u2014 the closing sequence dispatches once the broad run is clean at the current tree.", "tree": "07bbf72d1e7af3c1a03af605f40e5563dc3a18db:0ec7c6da6e74f0b56753f09657b654a6d289b91b:12064a6191eeb830a9826d911a8543fbaba3da75:27968248a450a842ccd187b7dce0fb0ded934866:287efde8f90320baffac08f5f3287b9456a65cb9:2e29b2f7e073a0cbe290f01d3b397e1cdd10c81c:35c75a1cedaa1c6f5d86de48a37ee0ed7f5a40c7:42796ea0e0a6c03811b0e4bc9dbd3b5ee62dd2e4:4acc6dfc5e8cece358c167d876515eba4a39a500:834d9d9c16094a386cd9b5a6f9ced9a3a9b4e7fb:a094f79b3e937804a653ff632027c895c6aa1c4b:bbd1aea514612d76722a18c7aece7c767cf1a076:c23b62e87f1ae3890c6f9e3d8c7ca7ec9225ed81:caffe2d63ceacde448842a91bc7a12c206a67523:d74b7d113b844e84f0009098f576fd28477f072d:e1aa20b9c08a5ebe036da74f16e28c751f18f6fa:e3b0de29b81a6c8e0abeacb3898519b98014b9ef:f7cc7e015d02e9c4c7c56b31e4f2f910d044d732:fa2f4f88657587b6e3b560977858810846b1d366"}} +{"timestamp": "2026-11-25T23:44:20.165001+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "arm_predicate_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "would_arm": true, "predicate_version": "v1", "classes": {"budget_projection": {"status": "clean", "reason": "projected spend $7.67 within 2.0x baseline planned total $11.00 (cap $22.00)"}, "judge_editing": {"status": "clean", "reason": "no drafted WU touches judge-path surfaces"}, "decision_class_paths": {"status": "clean", "reason": "no drafted WU touches a recognised dependency manifest (pyproject.toml, package.json, pom.xml, build.gradle, build.gradle.kts, Cargo.toml, go.mod, Gemfile, composer.json, requirements*.txt, *.csproj)"}, "retroactive_edits": {"status": "clean", "reason": "no passed-gate baseline WU altered or removed"}, "drift_caps": {"status": "clean", "reason": "added WUs and gates within drift caps"}, "missing_provenance": {"status": "clean", "reason": "no added WUs"}, "open_questions_human_only": {"status": "clean", "reason": "terminal gate: no drafted successor"}, "plan_next_lint": {"status": "clean", "reason": "plan-next lint: no findings"}}}} From 2200ecee545e0a928906c2707acbd304f88017d7 Mon Sep 17 00:00:00 2001 From: Test Date: Wed, 25 Nov 2026 18:50:17 -0500 Subject: [PATCH 10/69] fix(FEAT-LOOP-2026-0251): match shape findings precisely in test_produces_shape and reopen gate 1 The new produces-mentioned WARN contains the word 'directory', which the two not-flagged shape tests used as their filter. Filter on the guard name the shape ERROR carries instead. Co-Authored-By: Claude Opus 5.5 --- .../FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md | 2 +- tests/test_produces_shape.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md index 87691d31..6ed39028 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md @@ -1,6 +1,6 @@ --- gate: 1 -status: awaiting_review +status: open feature_oracle: "python3 -m unittest tests.test_fail_fast_deliverables -v -b" cost_budget_usd: 14.00 broad_run: diff --git a/tests/test_produces_shape.py b/tests/test_produces_shape.py index fc9ec765..1558ad2d 100644 --- a/tests/test_produces_shape.py +++ b/tests/test_produces_shape.py @@ -93,12 +93,12 @@ def test_the_error_names_the_guard_it_preempts(self): def test_file_produces_is_not_flagged(self): self.assertEqual( - [f for f in self._lint("src/Regression.java") if "directory" in f], [], + [f for f in self._lint("src/Regression.java") if "assert_declared_deliverables" in f], [], ) def test_glob_produces_is_not_flagged(self): self.assertEqual( - [f for f in self._lint("src/**/*.java") if "directory" in f], [], + [f for f in self._lint("src/**/*.java") if "assert_declared_deliverables" in f], [], ) From 82b87e3d67ef741378587390d4cbe3dff03f4439 Mon Sep 17 00:00:00 2001 From: Test Date: Wed, 25 Nov 2026 18:50:21 -0500 Subject: [PATCH 11/69] chore(loop): FEAT-LOOP-2026-0251 build pin recorded Feature: FEAT-LOOP-2026-0251 --- .../FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl | 1 + 1 file changed, 1 insertion(+) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index b2c9f378..a7492293 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -72,3 +72,4 @@ {"timestamp": "2026-11-25T23:44:20.150814+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "hookspath-conflict-bats", "ok": true, "skipped": false, "duration_seconds": 0.536, "phase": "broad"}} {"timestamp": "2026-11-25T23:44:20.151234+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "human_escalation", "source": "driver", "source_version": "0.33.2", "payload": {"reason": "broad_run_gate_failure", "gate": 1, "failing_gates": [{"gate": "tests", "failure_class": "tests", "failure_signature": "(failures=2,"}, {"gate": "coverage", "failure_class": "other", "failure_signature": "no_gate_marker"}], "message": "Gate 1 is blocked: the full `code` gate set failed on the once-per-gate broad run this gate's closing sequence requires before it may dispatch (FEAT-2026-0109/T06).\n\nTree measured: 07bbf72d1e7af3c1a03af605f40e5563dc3a18db:0ec7c6da6e74f0b56753f09657b654a6d289b91b:12064a6191eeb830a9826d911a8543fbaba3da75:27968248a450a842ccd187b7dce0fb0ded934866:287efde8f90320baffac08f5f3287b9456a65cb9:2e29b2f7e073a0cbe290f01d3b397e1cdd10c81c:35c75a1cedaa1c6f5d86de48a37ee0ed7f5a40c7:42796ea0e0a6c03811b0e4bc9dbd3b5ee62dd2e4:4acc6dfc5e8cece358c167d876515eba4a39a500:834d9d9c16094a386cd9b5a6f9ced9a3a9b4e7fb:a094f79b3e937804a653ff632027c895c6aa1c4b:bbd1aea514612d76722a18c7aece7c767cf1a076:c23b62e87f1ae3890c6f9e3d8c7ca7ec9225ed81:caffe2d63ceacde448842a91bc7a12c206a67523:d74b7d113b844e84f0009098f576fd28477f072d:e1aa20b9c08a5ebe036da74f16e28c751f18f6fa:e3b0de29b81a6c8e0abeacb3898519b98014b9ef:f7cc7e015d02e9c4c7c56b31e4f2f910d044d732:fa2f4f88657587b6e3b560977858810846b1d366\n\nFailing check(s):\n - tests: tests (signature: (failures=2,)\n - coverage: other (signature: no_gate_marker)\n\nNo work unit's attempt count was charged for this: every unit in this gate already passed its own per-attempt verification. The per-attempt narrow tier (FEAT-2026-0109/T04, T05) scopes checks to changed files as a speed optimization \u2014 this full-set run is the safety net that catches what that narrowing missed.\n\nWhat to do next:\n 1. Reproduce the failing check(s) above locally and fix them on this branch.\n 2. Re-run the driver \u2014 the closing sequence dispatches once the broad run is clean at the current tree.", "tree": "07bbf72d1e7af3c1a03af605f40e5563dc3a18db:0ec7c6da6e74f0b56753f09657b654a6d289b91b:12064a6191eeb830a9826d911a8543fbaba3da75:27968248a450a842ccd187b7dce0fb0ded934866:287efde8f90320baffac08f5f3287b9456a65cb9:2e29b2f7e073a0cbe290f01d3b397e1cdd10c81c:35c75a1cedaa1c6f5d86de48a37ee0ed7f5a40c7:42796ea0e0a6c03811b0e4bc9dbd3b5ee62dd2e4:4acc6dfc5e8cece358c167d876515eba4a39a500:834d9d9c16094a386cd9b5a6f9ced9a3a9b4e7fb:a094f79b3e937804a653ff632027c895c6aa1c4b:bbd1aea514612d76722a18c7aece7c767cf1a076:c23b62e87f1ae3890c6f9e3d8c7ca7ec9225ed81:caffe2d63ceacde448842a91bc7a12c206a67523:d74b7d113b844e84f0009098f576fd28477f072d:e1aa20b9c08a5ebe036da74f16e28c751f18f6fa:e3b0de29b81a6c8e0abeacb3898519b98014b9ef:f7cc7e015d02e9c4c7c56b31e4f2f910d044d732:fa2f4f88657587b6e3b560977858810846b1d366"}} {"timestamp": "2026-11-25T23:44:20.165001+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "arm_predicate_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "would_arm": true, "predicate_version": "v1", "classes": {"budget_projection": {"status": "clean", "reason": "projected spend $7.67 within 2.0x baseline planned total $11.00 (cap $22.00)"}, "judge_editing": {"status": "clean", "reason": "no drafted WU touches judge-path surfaces"}, "decision_class_paths": {"status": "clean", "reason": "no drafted WU touches a recognised dependency manifest (pyproject.toml, package.json, pom.xml, build.gradle, build.gradle.kts, Cargo.toml, go.mod, Gemfile, composer.json, requirements*.txt, *.csproj)"}, "retroactive_edits": {"status": "clean", "reason": "no passed-gate baseline WU altered or removed"}, "drift_caps": {"status": "clean", "reason": "added WUs and gates within drift caps"}, "missing_provenance": {"status": "clean", "reason": "no added WUs"}, "open_questions_human_only": {"status": "clean", "reason": "terminal gate: no drafted successor"}, "plan_next_lint": {"status": "clean", "reason": "plan-next lint: no findings"}}}} +{"timestamp": "2026-11-25T23:50:21.876989+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "driver_build_pinned", "source": "driver", "source_version": "0.33.2", "payload": {"tree": "cddc418a1eb5a10d2178a4b9a170e7fe490faa97", "path": "/private/var/folders/zc/rgq11x850d78dx_kf1fd4vx80000gn/T/specfuse-pins/cddc418a1eb5a10d2178a4b9a170e7fe490faa97/specfuse/loop"}} From ec17233c5b74f89f47afe274286bf07e3975ca98 Mon Sep 17 00:00:00 2001 From: Test Date: Wed, 25 Nov 2026 18:56:19 -0500 Subject: [PATCH 12/69] chore(loop): gate 1 broad run clean Feature: FEAT-LOOP-2026-0251 --- .../GATE-01.md | 14 ++++---------- .../events.jsonl | 19 +++++++++++++++++++ 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md index 6ed39028..326dbbac 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md @@ -4,16 +4,10 @@ status: open feature_oracle: "python3 -m unittest tests.test_fail_fast_deliverables -v -b" cost_budget_usd: 14.00 broad_run: - tree: 07bbf72d1e7af3c1a03af605f40e5563dc3a18db:0ec7c6da6e74f0b56753f09657b654a6d289b91b:12064a6191eeb830a9826d911a8543fbaba3da75:27968248a450a842ccd187b7dce0fb0ded934866:287efde8f90320baffac08f5f3287b9456a65cb9:2e29b2f7e073a0cbe290f01d3b397e1cdd10c81c:35c75a1cedaa1c6f5d86de48a37ee0ed7f5a40c7:42796ea0e0a6c03811b0e4bc9dbd3b5ee62dd2e4:4acc6dfc5e8cece358c167d876515eba4a39a500:834d9d9c16094a386cd9b5a6f9ced9a3a9b4e7fb:a094f79b3e937804a653ff632027c895c6aa1c4b:bbd1aea514612d76722a18c7aece7c767cf1a076:c23b62e87f1ae3890c6f9e3d8c7ca7ec9225ed81:caffe2d63ceacde448842a91bc7a12c206a67523:d74b7d113b844e84f0009098f576fd28477f072d:e1aa20b9c08a5ebe036da74f16e28c751f18f6fa:e3b0de29b81a6c8e0abeacb3898519b98014b9ef:f7cc7e015d02e9c4c7c56b31e4f2f910d044d732:fa2f4f88657587b6e3b560977858810846b1d366 - ran_at: 2026-11-25T23:44:20.143959+00:00 - ok: false - failing: - - gate: tests - failure_class: tests - failure_signature: "(failures=2," - - gate: coverage - failure_class: other - failure_signature: "no_gate_marker" + tree: 07bbf72d1e7af3c1a03af605f40e5563dc3a18db:0ec7c6da6e74f0b56753f09657b654a6d289b91b:11d31821bf4e32b3e962bbd52e61b97af3897c63:12064a6191eeb830a9826d911a8543fbaba3da75:27968248a450a842ccd187b7dce0fb0ded934866:287efde8f90320baffac08f5f3287b9456a65cb9:2e29b2f7e073a0cbe290f01d3b397e1cdd10c81c:35c75a1cedaa1c6f5d86de48a37ee0ed7f5a40c7:42796ea0e0a6c03811b0e4bc9dbd3b5ee62dd2e4:4acc6dfc5e8cece358c167d876515eba4a39a500:834d9d9c16094a386cd9b5a6f9ced9a3a9b4e7fb:a094f79b3e937804a653ff632027c895c6aa1c4b:bbd1aea514612d76722a18c7aece7c767cf1a076:c23b62e87f1ae3890c6f9e3d8c7ca7ec9225ed81:caffe2d63ceacde448842a91bc7a12c206a67523:d74b7d113b844e84f0009098f576fd28477f072d:e1aa20b9c08a5ebe036da74f16e28c751f18f6fa:e3b0de29b81a6c8e0abeacb3898519b98014b9ef:fa2f4f88657587b6e3b560977858810846b1d366 + ran_at: 2026-11-25T23:56:19.758395+00:00 + ok: true + failing: [] --- # Gate 1 — a missing deliverable is refused before any verification gate runs diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index a7492293..98f696d9 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -73,3 +73,22 @@ {"timestamp": "2026-11-25T23:44:20.151234+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "human_escalation", "source": "driver", "source_version": "0.33.2", "payload": {"reason": "broad_run_gate_failure", "gate": 1, "failing_gates": [{"gate": "tests", "failure_class": "tests", "failure_signature": "(failures=2,"}, {"gate": "coverage", "failure_class": "other", "failure_signature": "no_gate_marker"}], "message": "Gate 1 is blocked: the full `code` gate set failed on the once-per-gate broad run this gate's closing sequence requires before it may dispatch (FEAT-2026-0109/T06).\n\nTree measured: 07bbf72d1e7af3c1a03af605f40e5563dc3a18db:0ec7c6da6e74f0b56753f09657b654a6d289b91b:12064a6191eeb830a9826d911a8543fbaba3da75:27968248a450a842ccd187b7dce0fb0ded934866:287efde8f90320baffac08f5f3287b9456a65cb9:2e29b2f7e073a0cbe290f01d3b397e1cdd10c81c:35c75a1cedaa1c6f5d86de48a37ee0ed7f5a40c7:42796ea0e0a6c03811b0e4bc9dbd3b5ee62dd2e4:4acc6dfc5e8cece358c167d876515eba4a39a500:834d9d9c16094a386cd9b5a6f9ced9a3a9b4e7fb:a094f79b3e937804a653ff632027c895c6aa1c4b:bbd1aea514612d76722a18c7aece7c767cf1a076:c23b62e87f1ae3890c6f9e3d8c7ca7ec9225ed81:caffe2d63ceacde448842a91bc7a12c206a67523:d74b7d113b844e84f0009098f576fd28477f072d:e1aa20b9c08a5ebe036da74f16e28c751f18f6fa:e3b0de29b81a6c8e0abeacb3898519b98014b9ef:f7cc7e015d02e9c4c7c56b31e4f2f910d044d732:fa2f4f88657587b6e3b560977858810846b1d366\n\nFailing check(s):\n - tests: tests (signature: (failures=2,)\n - coverage: other (signature: no_gate_marker)\n\nNo work unit's attempt count was charged for this: every unit in this gate already passed its own per-attempt verification. The per-attempt narrow tier (FEAT-2026-0109/T04, T05) scopes checks to changed files as a speed optimization \u2014 this full-set run is the safety net that catches what that narrowing missed.\n\nWhat to do next:\n 1. Reproduce the failing check(s) above locally and fix them on this branch.\n 2. Re-run the driver \u2014 the closing sequence dispatches once the broad run is clean at the current tree.", "tree": "07bbf72d1e7af3c1a03af605f40e5563dc3a18db:0ec7c6da6e74f0b56753f09657b654a6d289b91b:12064a6191eeb830a9826d911a8543fbaba3da75:27968248a450a842ccd187b7dce0fb0ded934866:287efde8f90320baffac08f5f3287b9456a65cb9:2e29b2f7e073a0cbe290f01d3b397e1cdd10c81c:35c75a1cedaa1c6f5d86de48a37ee0ed7f5a40c7:42796ea0e0a6c03811b0e4bc9dbd3b5ee62dd2e4:4acc6dfc5e8cece358c167d876515eba4a39a500:834d9d9c16094a386cd9b5a6f9ced9a3a9b4e7fb:a094f79b3e937804a653ff632027c895c6aa1c4b:bbd1aea514612d76722a18c7aece7c767cf1a076:c23b62e87f1ae3890c6f9e3d8c7ca7ec9225ed81:caffe2d63ceacde448842a91bc7a12c206a67523:d74b7d113b844e84f0009098f576fd28477f072d:e1aa20b9c08a5ebe036da74f16e28c751f18f6fa:e3b0de29b81a6c8e0abeacb3898519b98014b9ef:f7cc7e015d02e9c4c7c56b31e4f2f910d044d732:fa2f4f88657587b6e3b560977858810846b1d366"}} {"timestamp": "2026-11-25T23:44:20.165001+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "arm_predicate_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "would_arm": true, "predicate_version": "v1", "classes": {"budget_projection": {"status": "clean", "reason": "projected spend $7.67 within 2.0x baseline planned total $11.00 (cap $22.00)"}, "judge_editing": {"status": "clean", "reason": "no drafted WU touches judge-path surfaces"}, "decision_class_paths": {"status": "clean", "reason": "no drafted WU touches a recognised dependency manifest (pyproject.toml, package.json, pom.xml, build.gradle, build.gradle.kts, Cargo.toml, go.mod, Gemfile, composer.json, requirements*.txt, *.csproj)"}, "retroactive_edits": {"status": "clean", "reason": "no passed-gate baseline WU altered or removed"}, "drift_caps": {"status": "clean", "reason": "added WUs and gates within drift caps"}, "missing_provenance": {"status": "clean", "reason": "no added WUs"}, "open_questions_human_only": {"status": "clean", "reason": "terminal gate: no drafted successor"}, "plan_next_lint": {"status": "clean", "reason": "plan-next lint: no findings"}}}} {"timestamp": "2026-11-25T23:50:21.876989+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "driver_build_pinned", "source": "driver", "source_version": "0.33.2", "payload": {"tree": "cddc418a1eb5a10d2178a4b9a170e7fe490faa97", "path": "/private/var/folders/zc/rgq11x850d78dx_kf1fd4vx80000gn/T/specfuse-pins/cddc418a1eb5a10d2178a4b9a170e7fe490faa97/specfuse/loop"}} +{"timestamp": "2026-11-25T23:56:19.765279+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "broad_run_result", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "tree": "07bbf72d1e7af3c1a03af605f40e5563dc3a18db:0ec7c6da6e74f0b56753f09657b654a6d289b91b:11d31821bf4e32b3e962bbd52e61b97af3897c63:12064a6191eeb830a9826d911a8543fbaba3da75:27968248a450a842ccd187b7dce0fb0ded934866:287efde8f90320baffac08f5f3287b9456a65cb9:2e29b2f7e073a0cbe290f01d3b397e1cdd10c81c:35c75a1cedaa1c6f5d86de48a37ee0ed7f5a40c7:42796ea0e0a6c03811b0e4bc9dbd3b5ee62dd2e4:4acc6dfc5e8cece358c167d876515eba4a39a500:834d9d9c16094a386cd9b5a6f9ced9a3a9b4e7fb:a094f79b3e937804a653ff632027c895c6aa1c4b:bbd1aea514612d76722a18c7aece7c767cf1a076:c23b62e87f1ae3890c6f9e3d8c7ca7ec9225ed81:caffe2d63ceacde448842a91bc7a12c206a67523:d74b7d113b844e84f0009098f576fd28477f072d:e1aa20b9c08a5ebe036da74f16e28c751f18f6fa:e3b0de29b81a6c8e0abeacb3898519b98014b9ef:fa2f4f88657587b6e3b560977858810846b1d366", "ok": true, "failing": []}} +{"timestamp": "2026-11-25T23:56:19.765302+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "tests", "ok": true, "skipped": false, "duration_seconds": 319.495, "phase": "broad"}} +{"timestamp": "2026-11-25T23:56:19.765306+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "lint", "ok": true, "skipped": false, "duration_seconds": 0.059, "phase": "broad"}} +{"timestamp": "2026-11-25T23:56:19.765308+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "security", "ok": true, "skipped": false, "duration_seconds": 1.56, "phase": "broad"}} +{"timestamp": "2026-11-25T23:56:19.765312+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "coverage", "ok": true, "skipped": false, "duration_seconds": 1.224, "phase": "broad"}} +{"timestamp": "2026-11-25T23:56:19.765314+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "leak-scan", "ok": true, "skipped": false, "duration_seconds": 17.379, "phase": "broad"}} +{"timestamp": "2026-11-25T23:56:19.765316+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "changelog-fragments", "ok": true, "skipped": false, "duration_seconds": 0.07, "phase": "broad"}} +{"timestamp": "2026-11-25T23:56:19.765318+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "agent-policy-example-lint", "ok": true, "skipped": false, "duration_seconds": 0.119, "phase": "broad"}} +{"timestamp": "2026-11-25T23:56:19.765319+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "event-type-gate", "ok": true, "skipped": false, "duration_seconds": 0.162, "phase": "broad"}} +{"timestamp": "2026-11-25T23:56:19.765320+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "roadmap-link-gate", "ok": true, "skipped": false, "duration_seconds": 0.05, "phase": "broad"}} +{"timestamp": "2026-11-25T23:56:19.765321+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "arm-sweep-gate", "ok": true, "skipped": false, "duration_seconds": 0.388, "phase": "broad"}} +{"timestamp": "2026-11-25T23:56:19.765323+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "monitoring-example-lint", "ok": true, "skipped": false, "duration_seconds": 0.049, "phase": "broad"}} +{"timestamp": "2026-11-25T23:56:19.765325+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "leak-scan-hook", "ok": true, "skipped": false, "duration_seconds": 0.835, "phase": "broad"}} +{"timestamp": "2026-11-25T23:56:19.765326+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "pre-push-hook", "ok": true, "skipped": false, "duration_seconds": 3.613, "phase": "broad"}} +{"timestamp": "2026-11-25T23:56:19.765329+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "sync-scaffold-bats", "ok": true, "skipped": false, "duration_seconds": 9.959, "phase": "broad"}} +{"timestamp": "2026-11-25T23:56:19.765331+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "sync-scaffold-symlinks-bats", "ok": true, "skipped": false, "duration_seconds": 1.431, "phase": "broad"}} +{"timestamp": "2026-11-25T23:56:19.765332+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "init-sh-shim-bats", "ok": true, "skipped": false, "duration_seconds": 0.819, "phase": "broad"}} +{"timestamp": "2026-11-25T23:56:19.765333+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "init-skills-bats", "ok": true, "skipped": false, "duration_seconds": 0.116, "phase": "broad"}} +{"timestamp": "2026-11-25T23:56:19.765335+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "hookspath-conflict-bats", "ok": true, "skipped": false, "duration_seconds": 0.534, "phase": "broad"}} From fe7f032100245d2863c6e647bc0cdfb0e28c8fdb Mon Sep 17 00:00:00 2001 From: Test Date: Wed, 25 Nov 2026 18:56:19 -0500 Subject: [PATCH 13/69] chore(loop): FEAT-LOOP-2026-0251/G1-CLOSE blocked (judge-editing terminal gate) Feature: FEAT-LOOP-2026-0251 --- .../WU-90-gate-1-close.md | 2 +- .../FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md index 8b453622..924cbe87 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md @@ -1,7 +1,7 @@ --- id: FEAT-LOOP-2026-0251/G1-CLOSE type: close -status: pending +status: blocked_human attempts: 0 oracle_env: macos_local planned_cost_usd: 5.00 diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index 98f696d9..24ce5745 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -92,3 +92,5 @@ {"timestamp": "2026-11-25T23:56:19.765332+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "init-sh-shim-bats", "ok": true, "skipped": false, "duration_seconds": 0.819, "phase": "broad"}} {"timestamp": "2026-11-25T23:56:19.765333+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "init-skills-bats", "ok": true, "skipped": false, "duration_seconds": 0.116, "phase": "broad"}} {"timestamp": "2026-11-25T23:56:19.765335+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "hookspath-conflict-bats", "ok": true, "skipped": false, "duration_seconds": 0.534, "phase": "broad"}} +{"timestamp": "2026-11-25T23:56:19.829550+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "terminal_judge_editing_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "status": "fired", "reason": "FEAT-LOOP-2026-0251/T01 produces specfuse/loop/loop.py; FEAT-LOOP-2026-0251/T01 declares produces_driver_helper ['execute_unit_attempt']; FEAT-LOOP-2026-0251/T02 produces specfuse/loop/loop.py; FEAT-LOOP-2026-0251/T02 produces .specfuse/verification.yml.example; FEAT-LOOP-2026-0251/T02 produces specfuse/loop/data/verification.yml.example; FEAT-LOOP-2026-0251/T02 declares produces_driver_helper ['execute_unit_attempt']; FEAT-LOOP-2026-0251/T03 produces specfuse/loop/loop.py; FEAT-LOOP-2026-0251/T04 produces specfuse/loop/lint_plan.py"}} +{"timestamp": "2026-11-25T23:56:19.832342+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "human_escalation", "source": "driver", "source_version": "0.33.2", "payload": {"reason": "judge_editing_terminal", "gate": 1, "hits": ["FEAT-LOOP-2026-0251/T01 produces specfuse/loop/loop.py", "FEAT-LOOP-2026-0251/T01 declares produces_driver_helper ['execute_unit_attempt']", "FEAT-LOOP-2026-0251/T02 produces specfuse/loop/loop.py", "FEAT-LOOP-2026-0251/T02 produces .specfuse/verification.yml.example", "FEAT-LOOP-2026-0251/T02 produces specfuse/loop/data/verification.yml.example", "FEAT-LOOP-2026-0251/T02 declares produces_driver_helper ['execute_unit_attempt']", "FEAT-LOOP-2026-0251/T03 produces specfuse/loop/loop.py", "FEAT-LOOP-2026-0251/T04 produces specfuse/loop/lint_plan.py"], "message": "ESCALATED \u2014 FEAT-LOOP-2026-0251/G1-CLOSE (G1-CLOSE \u2014 terminal close)\n\n## What has been done so far\nGate 1 is the last gate and its work is finished. Work units done: FEAT-LOOP-2026-0251/T01, FEAT-LOOP-2026-0251/T02, FEAT-LOOP-2026-0251/T03, FEAT-LOOP-2026-0251/T04. Nothing has been closed, flipped or archived yet.\n\n## What this issue is about\nOne or more finished units changed files that the judge relies on to grade this feature. Unit and path: FEAT-LOOP-2026-0251/T01 produces specfuse/loop/loop.py; FEAT-LOOP-2026-0251/T01 declares produces_driver_helper ['execute_unit_attempt']; FEAT-LOOP-2026-0251/T02 produces specfuse/loop/loop.py; FEAT-LOOP-2026-0251/T02 produces .specfuse/verification.yml.example; FEAT-LOOP-2026-0251/T02 produces specfuse/loop/data/verification.yml.example; FEAT-LOOP-2026-0251/T02 declares produces_driver_helper ['execute_unit_attempt']; FEAT-LOOP-2026-0251/T03 produces specfuse/loop/loop.py; FEAT-LOOP-2026-0251/T04 produces specfuse/loop/lint_plan.py.\n\n## What decision is needed, and why\nSomeone must decide whether those judge-surface edits are sound before the feature closes, because the close verdict would otherwise be written by the same model that made the edits.\n\n## Why it did not, or could not, close automatically\nThe safety catch fired as designed, nothing broke: the gate's own units change the code or config that grades it, so a model-authored verdict over those edits cannot be trusted to close the feature unreviewed. It stops the close however the feature was started and whatever its autonomy level.\n\n## Options, each with pros and cons\n1. **Acknowledge the edits** \u2014 review the paths above, then write `judge_edit_acknowledged` (the paths and your own reason) in the frontmatter of FEAT-LOOP-2026-0251/G1-CLOSE, then run `/unblock-wu`. Pros: the close proceeds and your reason is on the record. Cons: you must read the edits first; the acknowledgement covers only the paths it names, so a path added later stops the close again. A `produces_driver_helper` hit is covered by that literal entry, not by a file path.\n\nPaste into the frontmatter of the close unit, with your own reason:\n\n```yaml\njudge_edit_acknowledged:\n paths:\n - .specfuse/verification.yml.example\n - produces_driver_helper\n - specfuse/loop/data/verification.yml.example\n - specfuse/loop/lint_plan.py\n - specfuse/loop/loop.py\n reason: \"\"\n```\n2. **Reject the edits** \u2014 fix or revert them in the producing units. Pros: the judge stays independent. Cons: reopens finished work.\n\n## A recommendation\nOption 1 once you have read the edits and they are sound; option 2 if any of them weakens the check that grades this feature.\n\nReply with the number of your choice, or prose if none fit:\n1. Acknowledge the edits\n2. Reject the edits\n\nResume after deciding:\n python3 -m specfuse.loop.loop --feature FEAT-LOOP-2026-0251\n\n"}} From 1bce69436f0a1e6628f77b7cfb02142c626eca87 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 07:47:44 -0500 Subject: [PATCH 14/69] fix(FEAT-LOOP-2026-0251): keep re-plan and honest refusal signals for early refusals Review follow-ups before the gate 1 close: - An early deliverable refusal now consults the re-plan trigger, through replan_before_last_attempt (extracted from the failed-verification path), unless it repeats on an unmoved tree, which stays #597's halt. - The refusal measurement counts uncommitted edits to tracked files (git_diff_names(..., worktree=True), excluding the unit file), so an attempt that only edited tracked files no longer reads as an untouched tree. - An early refusal with a retained tree gets its own retry lead: the edits are kept but not verified, and the missing deliverable is the work to do. Tests: tests/test_fail_fast_deliverables.py TestEarlyRefusalRecovery, TestEarlyRetainedNoteWording (red before, green after). scripts/smoke-test.sh: 5130 tests OK (skipped=4). Co-Authored-By: Claude Opus 5.5 --- .../PLAN.md | 20 ++ specfuse/loop/loop.py | 264 ++++++++++++------ tests/test_fail_fast_deliverables.py | 84 +++++- tests/test_replan_trigger.py | 6 +- 4 files changed, 288 insertions(+), 86 deletions(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PLAN.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PLAN.md index 26a9f7b4..2ed43679 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PLAN.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PLAN.md @@ -110,3 +110,23 @@ gates: - LEARNINGS `[FEAT-LOOP-2026-0250/T01]`: a test that validates events through `validate_event` pins the packaged schemas and clears the validator caches. - `produces:` lists only `.py` files under `tests/` (#3539). +- **Review follow-ups (2026-11-26, before the close, operator-approved).** An independent review + of the gate's diff found three behaviour changes the early order introduced; fixed on this + branch, test-first, in `tests/test_fail_fast_deliverables.py` (`TestEarlyRefusalRecovery`, + `TestEarlyRetainedNoteWording`): + 1. An early refusal now consults the re-plan trigger (`replan_before_last_attempt`, extracted + from the failed-verification path), unless it is a repeat on an unmoved tree, which stays + #597's halt. Before, a unit that never wrote its deliverable lost the re-plan a failed + verification used to give it. + 2. The refusal measurement `_refusal_touched` counts uncommitted edits to tracked files + (`git_diff_names(..., worktree=True)`, excluding the unit file). Before, an attempt that only + edited tracked files read as an untouched tree and could be halted as + `deterministic_refusal_repeat` after two early refusals. `detect_deterministic_refusal_repeat` + itself is unchanged; its #1415 rule (identical summary and identical changed-file set) still + halts. + 3. An early refusal with a retained tree gets its own retry lead: the edits are kept but NOT + verified, and the missing deliverable is the work to do — not "apply only the mechanical + fix". + Accepted, not fixed: a deliverable that only a verification gate writes (a code generator, a + formatter) is refused early on every attempt; `fail_fast_deliverables: false` is the remedy, + and no in-loop test covers a gate-written deliverable. diff --git a/specfuse/loop/loop.py b/specfuse/loop/loop.py index 274cee1c..2098ed3d 100644 --- a/specfuse/loop/loop.py +++ b/specfuse/loop/loop.py @@ -2886,17 +2886,24 @@ def synthesize_retry_directive(failure_class: "str | None", *, per-class hint names the remedy generically. """ if retained: - if failure_class in _GUARD_FAILURE_CLASSES: + if failure_class in _GUARD_FAILURE_CLASSES and not verification_ran: + # Refused before verification (FEAT-LOOP-2026-0251): the retained + # edits were never checked, and the missing deliverable is the + # unit's real work, not a mechanical fix-up. + lead = ("A deliverable guard refused this attempt before the " + "verification gates ran. The previous attempt's edits " + "are STILL PRESENT in the working tree but have NOT been " + "verified. Keep what is correct, then do the missing " + "deliverable work named above and re-emit the RESULT " + "block in full. ") + elif failure_class in _GUARD_FAILURE_CLASSES: # A bookkeeping guard refused the pass (FEAT-2026-0103), not a # convergent unit mid-iteration: the tree is retained because # verify() already PASSED on it, and the one thing to avoid is # re-authoring work that is already correct. - verified = ( - "and verification already PASSED on them" if verification_ran - else "but verification did not run on them") lead = ("A bookkeeping guard refused this attempt's pass. The " "previous attempt's edits are STILL PRESENT in the " - f"working tree, {verified} " + "working tree, and verification already PASSED on them " "— re-authoring them is the one thing not to do. Apply " "only the mechanical fix below, then re-emit the RESULT " "block in full. ") @@ -3010,7 +3017,9 @@ def git(*args: str) -> str: check=True).stdout.strip() -def git_diff_names(head_before: str, head_after: str) -> list[str]: +def git_diff_names(head_before: str, head_after: str, *, + worktree: bool = False, + exclude: "tuple[Path | str, ...]" = ()) -> list[str]: """Return file paths changed between two refs via git diff --name-only. When head_after is 'HEAD', also appends untracked files from @@ -3026,10 +3035,19 @@ def git_diff_names(head_before: str, head_after: str) -> list[str]: keeps the tree — resurfaces as a new untracked file on the NEXT attempt's measurement, breaking `detect_deterministic_refusal_repeat`'s "provably untouched tree" signal (#597) for every retried guard refusal. + + *worktree* (only with ``head_after == "HEAD"``) also counts uncommitted + edits to tracked files, which the two-ref diff cannot see: an attempt's + work is not committed until the squash, so without it an attempt that only + edited tracked files reads as an untouched tree (FEAT-LOOP-2026-0251). + *exclude* drops driver-written paths, such as the unit file whose + `attempts:` the driver bumps before dispatch. """ try: + diff_args = ([head_before] if worktree and head_after == "HEAD" + else [head_before, head_after]) names = subprocess.run( - ["git", "diff", "--name-only", head_before, head_after], + ["git", "diff", "--name-only", *diff_args], capture_output=True, text=True, check=True, ).stdout.strip().splitlines() if head_after == "HEAD": @@ -3038,8 +3056,10 @@ def git_diff_names(head_before: str, head_after: str) -> list[str]: capture_output=True, text=True, check=True, ).stdout.strip().splitlines() names = names + [f for f in untracked if f] + skip = {Path(os.path.relpath(p)).as_posix() if Path(p).is_absolute() + else Path(p).as_posix() for p in exclude} return [f for f in names - if f and Path(f).name != PROGRESS_FILENAME] + if f and Path(f).name != PROGRESS_FILENAME and f not in skip] except subprocess.CalledProcessError: return [] @@ -12136,6 +12156,97 @@ def _downstream_line(cause_id: str, others: "list[WorkUnit]", +def refusal_history_repeats(refusal_history: "list[tuple[str, list]]") -> bool: + """#597's halt condition on the newest two guard refusals.""" + return len(refusal_history) >= 2 and detect_deterministic_refusal_repeat( + refusal_history[-1][0], refusal_history[-2][0], + refusal_history[-1][1], + prior_files_touched=refusal_history[-2][1]) + + +def replan_before_last_attempt( + wu: WorkUnit, attempt: int, *, wu_max_attempts: int, + replan_history: list[dict], attempt_notes: list, cum_usage: dict, + attempts_usage: list, attempt_outcomes: list, wu_events: list, + replanned_this_wu: bool, backend, work_dir: Path, feature_dir: Path, + events_path: Path, units: list, done_ids, gate, feature_id: str, +) -> "tuple[str | None, WorkUnit]": + """Re-plan ahead of a unit's last permitted attempt (FEAT-2026-0104/T02). + + Returns ``(status, wu)``: status is "blocked" when the re-plan escalated, + "replanned" when the body was rewritten (*wu* is then the reloaded unit), + and None when the trigger does not apply. Shared by `run()`'s + failed-verification path and its early deliverable refusals + (FEAT-LOOP-2026-0251), which otherwise never reach the trigger. + """ + if should_replan_instead_of_retry(wu, attempt, wu_max_attempts): + try: + replan_result = run_replan_turn(wu, replan_history) + except ReplanUnchangedError: + note_paths = persist_attempt_notes( + work_dir, wu.wu_id, attempt_notes) + backend.set_wu(wu, "status", "blocked_human") + backend.set_wu(wu, "escalation_reason", + "replan_unchanged_body") + write_cost_to_wu(backend, wu, cum_usage) + _unchanged_message = escalate_unit( + wu, gate.number, sorted(done_ids), + [w.wu_id for w in units + if w.wu_id != wu.wu_id + and w.status not in (DONE, "abandoned")], + "replan_unchanged_body", + resume_command_for(feature_id), + wu_max_attempts, attempt_outcomes, + replanned_this_wu, + ) + wu_events.append(build_event( + "human_escalation", wu.wu_id, { + "reason": "replan_unchanged_body", + "attempts": attempt, + "attempts_usage": attempts_usage, + "message": _unchanged_message, + })) + flush_events(events_path, wu_events) + _progress_path = record_progress_entry( + feature_dir, wu, attempt, "replan_unchanged_body") + commit_bookkeeping( + [wu.file, events_path, _progress_path, *note_paths], + f"chore(loop): {wu.wu_id} blocked_human " + f"(replan_unchanged_body, attempt {attempt})" + f"\n\nFeature: {wu.wu_id}", + ) + print(f" BLOCKED — re-plan turn at attempt " + f"{attempt}/{wu_max_attempts} returned a " + f"body identical to its input; refusing to " + f"dispatch an attempt that cannot differ " + f"from the one before it") + return "blocked", wu + # The dispatched session's transcript IS the rewrite + # (T03): fold it into this unit's own attempt-note + # record so it rides with the evidence any later + # escalation for this unit persists to disk. + attempt_notes.append(( + attempt, + "## Re-plan turn transcript\n\n" + + replan_result["transcript"] + )) + write_wu_body(wu.file, replan_result["body"]) + wu = reload_unit_after_replan(units, feature_dir, wu) + # gate_eval.py's evaluate_auto_close reads this as + # check 2 (a WU that needed a re-plan disqualifies + # its gate from auto-close) — the consumer predates + # this emitter by two years (FEAT-2026-0018/T02). + wu_events.append(build_event("replan", wu.wu_id, { + "attempt": attempt, + "max_attempts": wu_max_attempts, + })) + print(f" RE-PLANNED {wu.wu_id} after attempt " + f"{attempt}/{wu_max_attempts} — next dispatch " + f"uses a rewritten body") + return "replanned", wu + return None, wu + + def run( feature_arg: str | None, dry_run: bool, @@ -12803,9 +12914,9 @@ def run( replanned_this_wu = False # Per-failed-attempt (class, signature, full note) — the raw # material `synthesize_replan_brief` reads (FEAT-2026-0104/T03). - # Only the "failed" outcome branch below reaches the re-plan - # trigger check (every other outcome `continue`s earlier), so - # this only needs populating there. + # Populated by the two outcome paths that reach the re-plan + # trigger: a failed verification and an early deliverable + # refusal (FEAT-LOOP-2026-0251). replan_history: list[dict] = [] # Cost accumulators: per-attempt list goes to events.jsonl, # cumulative sum to WU frontmatter at outcome time. @@ -12845,10 +12956,7 @@ def run( # agent cannot edit its own frontmatter. Checked BEFORE the # attempt counter is bumped and before dispatch, so the # session that would buy nothing is never paid for. - if len(refusal_history) >= 2 and detect_deterministic_refusal_repeat( - refusal_history[-1][0], refusal_history[-2][0], - refusal_history[-1][1], - prior_files_touched=refusal_history[-2][1]): + if refusal_history_repeats(refusal_history): _rsum = refusal_history[-1][0] note_paths = persist_attempt_notes( work_dir, wu.wu_id, attempt_notes) @@ -12924,7 +13032,12 @@ def run( # reset_preserving_events -- afterwards the evidence is # gone and files_touched would read empty by construction, # which is what made #597's second condition vacuous. - _refusal_touched = git_diff_names(head_before, "HEAD") + # `worktree=True`: uncommitted tracked edits count too, + # or an attempt that only edited tracked files would read + # as an untouched tree (FEAT-LOOP-2026-0251). + _refusal_touched = git_diff_names( + head_before, "HEAD", worktree=True, + exclude=(wu.file,)) if outcome == "zero_token": # Agent never produced output (input_tokens=0). Skip @@ -13152,7 +13265,7 @@ def run( f" PRODUCES NOT IN DIFF attempt " f"{attempt}/{wu_max_attempts} — {_prod_summary}" ) - continue + _early_refusal = (_prod_event, _prod_note) if outcome in ("no_deliverable_files", "deliverable_missing"): @@ -13183,6 +13296,43 @@ def run( f"{attempt}/{wu_max_attempts} — " f"{payload['summary']}" ) + _early_refusal = (_early_event, _early_note) + + if outcome in ("produces_not_in_diff", + "no_deliverable_files", + "deliverable_missing"): + # An early refusal replaces the failed verification a + # missing deliverable used to cause, so it keeps that + # path's re-plan (FEAT-LOOP-2026-0251). A repeat on an + # unmoved tree is left to #597's halt at the top of + # the next attempt, as the failed path leaves a + # spinning signature to its own halt. + _ev_payload = _early_refusal[0]["payload"] + replan_history.append({ + "attempt": attempt, + "failure_class": _ev_payload.get("failure_class"), + "failure_signature": _ev_payload.get( + "failure_signature"), + "note": _early_refusal[1], + }) + if not refusal_history_repeats(refusal_history): + _replan, wu = replan_before_last_attempt( + wu, attempt, wu_max_attempts=wu_max_attempts, + replan_history=replan_history, + attempt_notes=attempt_notes, cum_usage=cum_usage, + attempts_usage=attempts_usage, + attempt_outcomes=attempt_outcomes, + wu_events=wu_events, + replanned_this_wu=replanned_this_wu, backend=backend, + work_dir=work_dir, feature_dir=feature_dir, + events_path=events_path, units=units, + done_ids=done_ids, gate=gate, feature_id=feature_id) + if _replan == "blocked": + blocked = True + break + if _replan == "replanned": + replanned_this_wu = True + failure_note = None continue if outcome == "passed": @@ -13998,73 +14148,23 @@ def run( # declined to `break` this attempt loop — a repeated # guard refusal or spinning signature escalates there and # never reaches this trigger. - if should_replan_instead_of_retry(wu, attempt, wu_max_attempts): - try: - replan_result = run_replan_turn(wu, replan_history) - except ReplanUnchangedError: - note_paths = persist_attempt_notes( - work_dir, wu.wu_id, attempt_notes) - backend.set_wu(wu, "status", "blocked_human") - backend.set_wu(wu, "escalation_reason", - "replan_unchanged_body") - write_cost_to_wu(backend, wu, cum_usage) - _unchanged_message = escalate_unit( - wu, gate.number, sorted(done_ids), - [w.wu_id for w in units - if w.wu_id != wu.wu_id - and w.status not in (DONE, "abandoned")], - "replan_unchanged_body", - resume_command_for(feature_id), - wu_max_attempts, attempt_outcomes, - replanned_this_wu, - ) - wu_events.append(build_event( - "human_escalation", wu.wu_id, { - "reason": "replan_unchanged_body", - "attempts": attempt, - "attempts_usage": attempts_usage, - "message": _unchanged_message, - })) - flush_events(events_path, wu_events) - _progress_path = record_progress_entry( - feature_dir, wu, attempt, "replan_unchanged_body") - commit_bookkeeping( - [wu.file, events_path, _progress_path, *note_paths], - f"chore(loop): {wu.wu_id} blocked_human " - f"(replan_unchanged_body, attempt {attempt})" - f"\n\nFeature: {wu.wu_id}", - ) - print(f" BLOCKED — re-plan turn at attempt " - f"{attempt}/{wu_max_attempts} returned a " - f"body identical to its input; refusing to " - f"dispatch an attempt that cannot differ " - f"from the one before it") - blocked = True - break - # The dispatched session's transcript IS the rewrite - # (T03): fold it into this unit's own attempt-note - # record so it rides with the evidence any later - # escalation for this unit persists to disk. - attempt_notes.append(( - attempt, - "## Re-plan turn transcript\n\n" - + replan_result["transcript"] - )) - write_wu_body(wu.file, replan_result["body"]) - wu = reload_unit_after_replan(units, feature_dir, wu) - # gate_eval.py's evaluate_auto_close reads this as - # check 2 (a WU that needed a re-plan disqualifies - # its gate from auto-close) — the consumer predates - # this emitter by two years (FEAT-2026-0018/T02). - wu_events.append(build_event("replan", wu.wu_id, { - "attempt": attempt, - "max_attempts": wu_max_attempts, - })) + _replan, wu = replan_before_last_attempt( + wu, attempt, wu_max_attempts=wu_max_attempts, + replan_history=replan_history, + attempt_notes=attempt_notes, cum_usage=cum_usage, + attempts_usage=attempts_usage, + attempt_outcomes=attempt_outcomes, + wu_events=wu_events, + replanned_this_wu=replanned_this_wu, backend=backend, + work_dir=work_dir, feature_dir=feature_dir, + events_path=events_path, units=units, + done_ids=done_ids, gate=gate, feature_id=feature_id) + if _replan == "blocked": + blocked = True + break + if _replan == "replanned": replanned_this_wu = True failure_note = None - print(f" RE-PLANNED {wu.wu_id} after attempt " - f"{attempt}/{wu_max_attempts} — next dispatch " - f"uses a rewritten body") continue failure_note = ( synthesize_retry_directive(_fc, retained=_retained) diff --git a/tests/test_fail_fast_deliverables.py b/tests/test_fail_fast_deliverables.py index f8810d27..083ee2fa 100644 --- a/tests/test_fail_fast_deliverables.py +++ b/tests/test_fail_fast_deliverables.py @@ -333,7 +333,10 @@ def load_cfg(*args, **kwargs): "fail_fast_deliverables": fail_fast} return cfg - def dispatch(wu, note, ct=True): + def dispatch(wu, note, cost_tracking=True): + if wu.body.startswith(loop._REPLAN_BRIEF_MARKER): + # An early refusal re-plans before the last attempt too. + return "# T01\n\nRe-planned body.\n" if wu.wu_id == T01: notes.append(note) if len(notes) == 1: @@ -461,5 +464,84 @@ def test_lint_runs_the_check(self): lint_plan.lint(fdir) self.assertIn("zzz/unnamed-thing.md", out.getvalue()) + +class TestEarlyRefusalRecovery(_Case): + """Review follow-up: an early refusal keeps the recovery paths a failed + verification had — re-planning before the last attempt, and the + repeated-refusal halt firing only on a tree that really did not move.""" + + def _run(self, act): + """`loop.run()` with T01 calling *act(n)* on its n-th attempt and never + touching `src/rule.py`. Returns (attempt count, re-plan turns, T01 + frontmatter text).""" + _, fdir = self._workspace() + Path("a.py").write_text("A = 0\n") + Path("b.py").write_text("B = 0\n") + _git("add", ".") + _git("commit", "-q", "-m", "tracked files") + attempts, replans = [], [] + + def dispatch(wu, note, cost_tracking=True): + if wu.body.startswith(loop._REPLAN_BRIEF_MARKER): + replans.append(wu.wu_id) + return "# T01\n\nRe-planned body: write src/rule.py.\n" + if wu.wu_id == T01: + attempts.append(note) + act(len(attempts)) + return _COMPLETE + + self._patch("dispatch", dispatch) + self._patch("verify", lambda wu, fd, cfg=None: (True, "(stub)")) + with contextlib.redirect_stdout(io.StringIO()): + self.assertEqual(loop.run(None, dry_run=False), 1) + return len(attempts), replans, (fdir / "WU-T01.md").read_text() + + def test_early_refusal_replans_before_the_last_attempt(self): + def new_note(n): + Path("docs").mkdir(exist_ok=True) + Path(f"docs/notes-{n}.md").write_text(f"{n}\n") + + count, replans, _ = self._run(new_note) + self.assertEqual(replans, [T01]) + self.assertEqual(count, 3) + + def test_tracked_edits_are_not_an_untouched_tree(self): + def edit_tracked(n): + Path("a.py" if n == 1 else "b.py").write_text(f"X = {n}\n") + + count, _, wu_text = self._run(edit_tracked) + self.assertNotIn("deterministic_refusal_repeat", wu_text) + self.assertEqual(count, 3) + + def test_untouched_tree_still_halts_without_replanning(self): + count, replans, wu_text = self._run(lambda n: None) + self.assertIn("escalation_reason: deterministic_refusal_repeat", + wu_text) + self.assertEqual(count, 2) + self.assertEqual(replans, []) + + +class TestEarlyRetainedNoteWording(unittest.TestCase): + """Review follow-up: a retained tree that was never verified is not + 'correct work to leave alone' — the missing deliverable IS the work.""" + + def test_early_retained_note_asks_for_the_missing_work(self): + for fc in ("produces_not_in_diff", "guard_refusal"): + with self.subTest(failure_class=fc): + lead = loop.synthesize_retry_directive( + fc, retained=True, verification_ran=False) + self.assertIn("NOT been verified", lead) + self.assertIn("missing deliverable", lead) + self.assertNotIn("re-authoring them is the one thing", lead) + self.assertNotIn("only the mechanical fix", lead) + self.assertNotIn("refused this attempt's pass", lead) + + def test_late_retained_note_is_unchanged(self): + lead = loop.synthesize_retry_directive( + "produces_not_in_diff", retained=True, verification_ran=True) + self.assertIn("verification already PASSED", lead) + self.assertIn("only the mechanical fix", lead) + + if __name__ == "__main__": unittest.main() diff --git a/tests/test_replan_trigger.py b/tests/test_replan_trigger.py index 62ab07f4..f148d052 100644 --- a/tests/test_replan_trigger.py +++ b/tests/test_replan_trigger.py @@ -237,9 +237,9 @@ def test_refusal_repeat_escalates_and_the_replanned_attempt_never_dispatches(sel # the pass identically every time ("no_deliverable_files"), which # appends to `refusal_history` with empty `files_touched`. That is a # guard refusal, a structurally distinct code path from a real - # verify() failure: `should_replan_instead_of_retry` is only ever - # consulted on the "outcome == failed" path, so it is never reached - # here at all — the refusal-repeat check owns the outcome outright. + # verify() failure. An early refusal does consult the re-plan trigger + # (FEAT-LOOP-2026-0251), but only when it is not a repeat on an + # unmoved tree — so the refusal-repeat check owns the outcome outright. # `detect_deterministic_refusal_repeat` fires at the top of attempt 3 # once 2 identical refusals (from attempts 1 and 2) exist, blocking # BEFORE attempt 3 is ever dispatched: proven directly by From 170f208a01659736003876e467222c3f1849c158 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 08:30:05 -0500 Subject: [PATCH 15/69] chore(loop): FEAT-LOOP-2026-0251/G1-CLOSE re-armed (operator acknowledged judge edits) Co-Authored-By: Claude Opus 5.5 --- .../WU-90-gate-1-close.md | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md index 924cbe87..3c44d7f4 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md @@ -1,13 +1,30 @@ --- id: FEAT-LOOP-2026-0251/G1-CLOSE type: close -status: blocked_human +status: pending attempts: 0 oracle_env: macos_local planned_cost_usd: 5.00 auto_close_disabled: true model: sonnet effort: high +judge_edit_acknowledged: + paths: + - .specfuse/verification.yml.example + - produces_driver_helper + - specfuse/loop/data/verification.yml.example + - specfuse/loop/lint_plan.py + - specfuse/loop/loop.py + reason: "Review fixes tested, full suite green, accept the generator risk" +re_arm_count: 1 +re_arm_history: + - + timestamp: 2026-11-26T13:30:05+00:00 + prior_status: blocked_human + prior_attempts: 0 + prior_cost_usd: 0.0 + prior_duration_seconds: 0.0 + reason: "Review fixes tested, full suite green, accept the generator risk" --- # G1-CLOSE — terminal close From e55f56739021382965fbc224a53ea9e83f1f0664 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 08:30:16 -0500 Subject: [PATCH 16/69] chore(loop): FEAT-LOOP-2026-0251 build pin recorded Feature: FEAT-LOOP-2026-0251 --- .../FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl | 1 + 1 file changed, 1 insertion(+) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index 24ce5745..b5ab324b 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -94,3 +94,4 @@ {"timestamp": "2026-11-25T23:56:19.765335+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "hookspath-conflict-bats", "ok": true, "skipped": false, "duration_seconds": 0.534, "phase": "broad"}} {"timestamp": "2026-11-25T23:56:19.829550+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "terminal_judge_editing_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "status": "fired", "reason": "FEAT-LOOP-2026-0251/T01 produces specfuse/loop/loop.py; FEAT-LOOP-2026-0251/T01 declares produces_driver_helper ['execute_unit_attempt']; FEAT-LOOP-2026-0251/T02 produces specfuse/loop/loop.py; FEAT-LOOP-2026-0251/T02 produces .specfuse/verification.yml.example; FEAT-LOOP-2026-0251/T02 produces specfuse/loop/data/verification.yml.example; FEAT-LOOP-2026-0251/T02 declares produces_driver_helper ['execute_unit_attempt']; FEAT-LOOP-2026-0251/T03 produces specfuse/loop/loop.py; FEAT-LOOP-2026-0251/T04 produces specfuse/loop/lint_plan.py"}} {"timestamp": "2026-11-25T23:56:19.832342+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "human_escalation", "source": "driver", "source_version": "0.33.2", "payload": {"reason": "judge_editing_terminal", "gate": 1, "hits": ["FEAT-LOOP-2026-0251/T01 produces specfuse/loop/loop.py", "FEAT-LOOP-2026-0251/T01 declares produces_driver_helper ['execute_unit_attempt']", "FEAT-LOOP-2026-0251/T02 produces specfuse/loop/loop.py", "FEAT-LOOP-2026-0251/T02 produces .specfuse/verification.yml.example", "FEAT-LOOP-2026-0251/T02 produces specfuse/loop/data/verification.yml.example", "FEAT-LOOP-2026-0251/T02 declares produces_driver_helper ['execute_unit_attempt']", "FEAT-LOOP-2026-0251/T03 produces specfuse/loop/loop.py", "FEAT-LOOP-2026-0251/T04 produces specfuse/loop/lint_plan.py"], "message": "ESCALATED \u2014 FEAT-LOOP-2026-0251/G1-CLOSE (G1-CLOSE \u2014 terminal close)\n\n## What has been done so far\nGate 1 is the last gate and its work is finished. Work units done: FEAT-LOOP-2026-0251/T01, FEAT-LOOP-2026-0251/T02, FEAT-LOOP-2026-0251/T03, FEAT-LOOP-2026-0251/T04. Nothing has been closed, flipped or archived yet.\n\n## What this issue is about\nOne or more finished units changed files that the judge relies on to grade this feature. Unit and path: FEAT-LOOP-2026-0251/T01 produces specfuse/loop/loop.py; FEAT-LOOP-2026-0251/T01 declares produces_driver_helper ['execute_unit_attempt']; FEAT-LOOP-2026-0251/T02 produces specfuse/loop/loop.py; FEAT-LOOP-2026-0251/T02 produces .specfuse/verification.yml.example; FEAT-LOOP-2026-0251/T02 produces specfuse/loop/data/verification.yml.example; FEAT-LOOP-2026-0251/T02 declares produces_driver_helper ['execute_unit_attempt']; FEAT-LOOP-2026-0251/T03 produces specfuse/loop/loop.py; FEAT-LOOP-2026-0251/T04 produces specfuse/loop/lint_plan.py.\n\n## What decision is needed, and why\nSomeone must decide whether those judge-surface edits are sound before the feature closes, because the close verdict would otherwise be written by the same model that made the edits.\n\n## Why it did not, or could not, close automatically\nThe safety catch fired as designed, nothing broke: the gate's own units change the code or config that grades it, so a model-authored verdict over those edits cannot be trusted to close the feature unreviewed. It stops the close however the feature was started and whatever its autonomy level.\n\n## Options, each with pros and cons\n1. **Acknowledge the edits** \u2014 review the paths above, then write `judge_edit_acknowledged` (the paths and your own reason) in the frontmatter of FEAT-LOOP-2026-0251/G1-CLOSE, then run `/unblock-wu`. Pros: the close proceeds and your reason is on the record. Cons: you must read the edits first; the acknowledgement covers only the paths it names, so a path added later stops the close again. A `produces_driver_helper` hit is covered by that literal entry, not by a file path.\n\nPaste into the frontmatter of the close unit, with your own reason:\n\n```yaml\njudge_edit_acknowledged:\n paths:\n - .specfuse/verification.yml.example\n - produces_driver_helper\n - specfuse/loop/data/verification.yml.example\n - specfuse/loop/lint_plan.py\n - specfuse/loop/loop.py\n reason: \"\"\n```\n2. **Reject the edits** \u2014 fix or revert them in the producing units. Pros: the judge stays independent. Cons: reopens finished work.\n\n## A recommendation\nOption 1 once you have read the edits and they are sound; option 2 if any of them weakens the check that grades this feature.\n\nReply with the number of your choice, or prose if none fit:\n1. Acknowledge the edits\n2. Reject the edits\n\nResume after deciding:\n python3 -m specfuse.loop.loop --feature FEAT-LOOP-2026-0251\n\n"}} +{"timestamp": "2026-11-26T13:30:16.649695+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "driver_build_pinned", "source": "driver", "source_version": "0.33.2", "payload": {"tree": "eb3075573964adbe5b7a9de58f97ce8ec6ad9124", "path": "/private/var/folders/zc/rgq11x850d78dx_kf1fd4vx80000gn/T/specfuse-pins/eb3075573964adbe5b7a9de58f97ce8ec6ad9124/specfuse/loop"}} From b76ffc6e8ed7c9a654825a467ee233ab8efe89b1 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 08:36:49 -0500 Subject: [PATCH 17/69] chore(loop): gate 1 broad run clean Feature: FEAT-LOOP-2026-0251 --- .../GATE-01.md | 4 ++-- .../events.jsonl | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md index 326dbbac..8e638862 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md @@ -4,8 +4,8 @@ status: open feature_oracle: "python3 -m unittest tests.test_fail_fast_deliverables -v -b" cost_budget_usd: 14.00 broad_run: - tree: 07bbf72d1e7af3c1a03af605f40e5563dc3a18db:0ec7c6da6e74f0b56753f09657b654a6d289b91b:11d31821bf4e32b3e962bbd52e61b97af3897c63:12064a6191eeb830a9826d911a8543fbaba3da75:27968248a450a842ccd187b7dce0fb0ded934866:287efde8f90320baffac08f5f3287b9456a65cb9:2e29b2f7e073a0cbe290f01d3b397e1cdd10c81c:35c75a1cedaa1c6f5d86de48a37ee0ed7f5a40c7:42796ea0e0a6c03811b0e4bc9dbd3b5ee62dd2e4:4acc6dfc5e8cece358c167d876515eba4a39a500:834d9d9c16094a386cd9b5a6f9ced9a3a9b4e7fb:a094f79b3e937804a653ff632027c895c6aa1c4b:bbd1aea514612d76722a18c7aece7c767cf1a076:c23b62e87f1ae3890c6f9e3d8c7ca7ec9225ed81:caffe2d63ceacde448842a91bc7a12c206a67523:d74b7d113b844e84f0009098f576fd28477f072d:e1aa20b9c08a5ebe036da74f16e28c751f18f6fa:e3b0de29b81a6c8e0abeacb3898519b98014b9ef:fa2f4f88657587b6e3b560977858810846b1d366 - ran_at: 2026-11-25T23:56:19.758395+00:00 + tree: 07bbf72d1e7af3c1a03af605f40e5563dc3a18db:0ec7c6da6e74f0b56753f09657b654a6d289b91b:12064a6191eeb830a9826d911a8543fbaba3da75:27968248a450a842ccd187b7dce0fb0ded934866:287efde8f90320baffac08f5f3287b9456a65cb9:2e29b2f7e073a0cbe290f01d3b397e1cdd10c81c:42796ea0e0a6c03811b0e4bc9dbd3b5ee62dd2e4:4acc6dfc5e8cece358c167d876515eba4a39a500:641be9742f9a620d6209e7c786d1ff6f6664ef20:834d9d9c16094a386cd9b5a6f9ced9a3a9b4e7fb:a90788bb48ee6cdb0fa8b0f867c80a4643acd35d:bbd1aea514612d76722a18c7aece7c767cf1a076:c23b62e87f1ae3890c6f9e3d8c7ca7ec9225ed81:caffe2d63ceacde448842a91bc7a12c206a67523:d261cc7cb35eba19cd0f077fa66e995cd61b02b4:d74b7d113b844e84f0009098f576fd28477f072d:e1aa20b9c08a5ebe036da74f16e28c751f18f6fa:e3b0de29b81a6c8e0abeacb3898519b98014b9ef:fa2f4f88657587b6e3b560977858810846b1d366 + ran_at: 2026-11-26T13:36:49.008653+00:00 ok: true failing: [] --- diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index b5ab324b..43cd5933 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -95,3 +95,22 @@ {"timestamp": "2026-11-25T23:56:19.829550+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "terminal_judge_editing_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "status": "fired", "reason": "FEAT-LOOP-2026-0251/T01 produces specfuse/loop/loop.py; FEAT-LOOP-2026-0251/T01 declares produces_driver_helper ['execute_unit_attempt']; FEAT-LOOP-2026-0251/T02 produces specfuse/loop/loop.py; FEAT-LOOP-2026-0251/T02 produces .specfuse/verification.yml.example; FEAT-LOOP-2026-0251/T02 produces specfuse/loop/data/verification.yml.example; FEAT-LOOP-2026-0251/T02 declares produces_driver_helper ['execute_unit_attempt']; FEAT-LOOP-2026-0251/T03 produces specfuse/loop/loop.py; FEAT-LOOP-2026-0251/T04 produces specfuse/loop/lint_plan.py"}} {"timestamp": "2026-11-25T23:56:19.832342+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "human_escalation", "source": "driver", "source_version": "0.33.2", "payload": {"reason": "judge_editing_terminal", "gate": 1, "hits": ["FEAT-LOOP-2026-0251/T01 produces specfuse/loop/loop.py", "FEAT-LOOP-2026-0251/T01 declares produces_driver_helper ['execute_unit_attempt']", "FEAT-LOOP-2026-0251/T02 produces specfuse/loop/loop.py", "FEAT-LOOP-2026-0251/T02 produces .specfuse/verification.yml.example", "FEAT-LOOP-2026-0251/T02 produces specfuse/loop/data/verification.yml.example", "FEAT-LOOP-2026-0251/T02 declares produces_driver_helper ['execute_unit_attempt']", "FEAT-LOOP-2026-0251/T03 produces specfuse/loop/loop.py", "FEAT-LOOP-2026-0251/T04 produces specfuse/loop/lint_plan.py"], "message": "ESCALATED \u2014 FEAT-LOOP-2026-0251/G1-CLOSE (G1-CLOSE \u2014 terminal close)\n\n## What has been done so far\nGate 1 is the last gate and its work is finished. Work units done: FEAT-LOOP-2026-0251/T01, FEAT-LOOP-2026-0251/T02, FEAT-LOOP-2026-0251/T03, FEAT-LOOP-2026-0251/T04. Nothing has been closed, flipped or archived yet.\n\n## What this issue is about\nOne or more finished units changed files that the judge relies on to grade this feature. Unit and path: FEAT-LOOP-2026-0251/T01 produces specfuse/loop/loop.py; FEAT-LOOP-2026-0251/T01 declares produces_driver_helper ['execute_unit_attempt']; FEAT-LOOP-2026-0251/T02 produces specfuse/loop/loop.py; FEAT-LOOP-2026-0251/T02 produces .specfuse/verification.yml.example; FEAT-LOOP-2026-0251/T02 produces specfuse/loop/data/verification.yml.example; FEAT-LOOP-2026-0251/T02 declares produces_driver_helper ['execute_unit_attempt']; FEAT-LOOP-2026-0251/T03 produces specfuse/loop/loop.py; FEAT-LOOP-2026-0251/T04 produces specfuse/loop/lint_plan.py.\n\n## What decision is needed, and why\nSomeone must decide whether those judge-surface edits are sound before the feature closes, because the close verdict would otherwise be written by the same model that made the edits.\n\n## Why it did not, or could not, close automatically\nThe safety catch fired as designed, nothing broke: the gate's own units change the code or config that grades it, so a model-authored verdict over those edits cannot be trusted to close the feature unreviewed. It stops the close however the feature was started and whatever its autonomy level.\n\n## Options, each with pros and cons\n1. **Acknowledge the edits** \u2014 review the paths above, then write `judge_edit_acknowledged` (the paths and your own reason) in the frontmatter of FEAT-LOOP-2026-0251/G1-CLOSE, then run `/unblock-wu`. Pros: the close proceeds and your reason is on the record. Cons: you must read the edits first; the acknowledgement covers only the paths it names, so a path added later stops the close again. A `produces_driver_helper` hit is covered by that literal entry, not by a file path.\n\nPaste into the frontmatter of the close unit, with your own reason:\n\n```yaml\njudge_edit_acknowledged:\n paths:\n - .specfuse/verification.yml.example\n - produces_driver_helper\n - specfuse/loop/data/verification.yml.example\n - specfuse/loop/lint_plan.py\n - specfuse/loop/loop.py\n reason: \"\"\n```\n2. **Reject the edits** \u2014 fix or revert them in the producing units. Pros: the judge stays independent. Cons: reopens finished work.\n\n## A recommendation\nOption 1 once you have read the edits and they are sound; option 2 if any of them weakens the check that grades this feature.\n\nReply with the number of your choice, or prose if none fit:\n1. Acknowledge the edits\n2. Reject the edits\n\nResume after deciding:\n python3 -m specfuse.loop.loop --feature FEAT-LOOP-2026-0251\n\n"}} {"timestamp": "2026-11-26T13:30:16.649695+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "driver_build_pinned", "source": "driver", "source_version": "0.33.2", "payload": {"tree": "eb3075573964adbe5b7a9de58f97ce8ec6ad9124", "path": "/private/var/folders/zc/rgq11x850d78dx_kf1fd4vx80000gn/T/specfuse-pins/eb3075573964adbe5b7a9de58f97ce8ec6ad9124/specfuse/loop"}} +{"timestamp": "2026-11-26T13:36:49.017427+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "broad_run_result", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "tree": "07bbf72d1e7af3c1a03af605f40e5563dc3a18db:0ec7c6da6e74f0b56753f09657b654a6d289b91b:12064a6191eeb830a9826d911a8543fbaba3da75:27968248a450a842ccd187b7dce0fb0ded934866:287efde8f90320baffac08f5f3287b9456a65cb9:2e29b2f7e073a0cbe290f01d3b397e1cdd10c81c:42796ea0e0a6c03811b0e4bc9dbd3b5ee62dd2e4:4acc6dfc5e8cece358c167d876515eba4a39a500:641be9742f9a620d6209e7c786d1ff6f6664ef20:834d9d9c16094a386cd9b5a6f9ced9a3a9b4e7fb:a90788bb48ee6cdb0fa8b0f867c80a4643acd35d:bbd1aea514612d76722a18c7aece7c767cf1a076:c23b62e87f1ae3890c6f9e3d8c7ca7ec9225ed81:caffe2d63ceacde448842a91bc7a12c206a67523:d261cc7cb35eba19cd0f077fa66e995cd61b02b4:d74b7d113b844e84f0009098f576fd28477f072d:e1aa20b9c08a5ebe036da74f16e28c751f18f6fa:e3b0de29b81a6c8e0abeacb3898519b98014b9ef:fa2f4f88657587b6e3b560977858810846b1d366", "ok": true, "failing": []}} +{"timestamp": "2026-11-26T13:36:49.017457+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "tests", "ok": true, "skipped": false, "duration_seconds": 351.828, "phase": "broad"}} +{"timestamp": "2026-11-26T13:36:49.017461+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "lint", "ok": true, "skipped": false, "duration_seconds": 0.079, "phase": "broad"}} +{"timestamp": "2026-11-26T13:36:49.017464+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "security", "ok": true, "skipped": false, "duration_seconds": 1.629, "phase": "broad"}} +{"timestamp": "2026-11-26T13:36:49.017466+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "coverage", "ok": true, "skipped": false, "duration_seconds": 1.3, "phase": "broad"}} +{"timestamp": "2026-11-26T13:36:49.017468+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "leak-scan", "ok": true, "skipped": false, "duration_seconds": 17.683, "phase": "broad"}} +{"timestamp": "2026-11-26T13:36:49.017471+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "changelog-fragments", "ok": true, "skipped": false, "duration_seconds": 0.075, "phase": "broad"}} +{"timestamp": "2026-11-26T13:36:49.017472+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "agent-policy-example-lint", "ok": true, "skipped": false, "duration_seconds": 0.117, "phase": "broad"}} +{"timestamp": "2026-11-26T13:36:49.017475+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "event-type-gate", "ok": true, "skipped": false, "duration_seconds": 0.168, "phase": "broad"}} +{"timestamp": "2026-11-26T13:36:49.017477+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "roadmap-link-gate", "ok": true, "skipped": false, "duration_seconds": 0.051, "phase": "broad"}} +{"timestamp": "2026-11-26T13:36:49.017479+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "arm-sweep-gate", "ok": true, "skipped": false, "duration_seconds": 0.411, "phase": "broad"}} +{"timestamp": "2026-11-26T13:36:49.017480+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "monitoring-example-lint", "ok": true, "skipped": false, "duration_seconds": 0.052, "phase": "broad"}} +{"timestamp": "2026-11-26T13:36:49.017481+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "leak-scan-hook", "ok": true, "skipped": false, "duration_seconds": 0.863, "phase": "broad"}} +{"timestamp": "2026-11-26T13:36:49.017482+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "pre-push-hook", "ok": true, "skipped": false, "duration_seconds": 3.492, "phase": "broad"}} +{"timestamp": "2026-11-26T13:36:49.017485+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "sync-scaffold-bats", "ok": true, "skipped": false, "duration_seconds": 11.233, "phase": "broad"}} +{"timestamp": "2026-11-26T13:36:49.017487+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "sync-scaffold-symlinks-bats", "ok": true, "skipped": false, "duration_seconds": 1.663, "phase": "broad"}} +{"timestamp": "2026-11-26T13:36:49.017488+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "init-sh-shim-bats", "ok": true, "skipped": false, "duration_seconds": 0.851, "phase": "broad"}} +{"timestamp": "2026-11-26T13:36:49.017489+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "init-skills-bats", "ok": true, "skipped": false, "duration_seconds": 0.124, "phase": "broad"}} +{"timestamp": "2026-11-26T13:36:49.017490+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "hookspath-conflict-bats", "ok": true, "skipped": false, "duration_seconds": 0.583, "phase": "broad"}} From d1fc68d3906f5962fff0902e8d5e943865ee0f14 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 08:41:40 -0500 Subject: [PATCH 18/69] =?UTF-8?q?feat:=20G1-CLOSE=20=E2=80=94=20terminal?= =?UTF-8?q?=20close?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Feature: FEAT-LOOP-2026-0251/G1-CLOSE --- .../FOLLOW-UPS.md | 60 ++++++ .../LEARNINGS-pending.md | 23 +++ .../PROGRESS.md | 2 + .../RETROSPECTIVE.md | 185 ++++++++++++++++++ .../WU-90-gate-1-close.md | 18 +- .../events.jsonl | 2 + ...efaults-fail-fast-deliverables-in-verif.md | 5 + ...pecfuse-lint-prints-a-warn-for-a-dispat.md | 5 + ...he-produces-not-in-diff-deliverable-mis.md | 5 + ...he-retry-note-for-the-three-deliverable.md | 5 + 10 files changed, 308 insertions(+), 2 deletions(-) create mode 100644 .specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md create mode 100644 .specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/LEARNINGS-pending.md create mode 100644 .specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/RETROSPECTIVE.md create mode 100644 changelog.d/FEAT-LOOP-2026-0251-defaults-fail-fast-deliverables-in-verif.md create mode 100644 changelog.d/FEAT-LOOP-2026-0251-specfuse-lint-prints-a-warn-for-a-dispat.md create mode 100644 changelog.d/FEAT-LOOP-2026-0251-the-produces-not-in-diff-deliverable-mis.md create mode 100644 changelog.d/FEAT-LOOP-2026-0251-the-retry-note-for-the-three-deliverable.md diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md new file mode 100644 index 00000000..6714f3af --- /dev/null +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md @@ -0,0 +1,60 @@ +# Follow-ups — FEAT-LOOP-2026-0251 + +### An early refusal records a different outcome from the late order for one input + +**Criterion (verbatim).** "A surviving skip, or an early refusal whose outcome or failure +class differs from the late one for the same input: record `not_met` with a follow-up." + +**Evidence.** A probe drove `loop.run()` with a unit declaring `src/rule.py`, an attempt +writing only `docs/notes.md`, a RESULT listing both under `files_changed`, and green gates. +With `fail_fast_deliverables: true` the first `attempt_outcome` is `produces_not_in_diff` +(class `produces_not_in_diff`, 0 verify calls). With `false` it is `files_changed_mismatch` +(class `files_changed_mismatch`, 1 verify call). The control with a plain RESULT gives +`produces_not_in_diff` both ways. `tests/test_files_changed_auto_repair.py`, +`test_untouched_deliverable_still_refuses`, had its expected outcome changed to match. + +**What happened, in plain terms.** The attempt is refused both ways. Only the name of the +refusal, and so the retry advice, differs. `PLAN.md` says the feature does not change what +is refused, only when, and that `files_changed_mismatch` stays where it is. It does not say +which refusal wins when both apply. The close cannot settle that. + +**Options.** + +1. Accept the new precedence and state it in the definition of done and the docs. For: no + code change; no gate run is paid; the retry note names the missing deliverable. Against: + the RESULT's false `files_changed` claim is not reported on that attempt. +2. Skip the early refusal when the RESULT's `files_changed` would trip the mismatch guard. + For: outcomes match the old order. Against: code and tests change, and those attempts pay + for a full gate run again. + +**Recommendation.** Option 1. + +**Re-run condition.** Either `GATE-01.md` and the close unit state that a deliverable +refusal takes precedence over `files_changed_mismatch`, or case A records the same outcome +and failure class with the key `true` and `false`, asserted by a test. + +### Clause 6 does not hold literally for two pre-existing tests + +**Criterion (verbatim).** "**Nothing else changes.** Every existing test of the three +guards passes unchanged, apart from assertions on the order of `verify` and the guard, which +are updated and named in the close." + +**Evidence.** A `diff` of `tests/` against a snapshot of public `main` shows two edits that +are not about order. `test_deterministic_refusal_repeat` moved a source-text anchor to +`if not deliv_ok:`, because the emit call moved into a shared helper. +`test_produces_shape` changed two filters from `directory` to +`assert_declared_deliverables`, because the new lint WARN contains "directory". All ten +changed modules pass (68 tests, exit 0). Neither edit removes an assertion. + +**Options.** + +1. Widen the clause to allow edits forced by a refactor or by new lint wording. For: matches + what was built, with no code change. Against: the clause is relaxed after the fact. +2. Restore both tests unchanged. For: the clause holds as written. Against: the WARN must be + reworded and the driver's emit call moved back to each call site, which duplicates code + the gate's arming discipline says to share. + +**Recommendation.** Option 1. + +**Re-run condition.** `GATE-01.md` clause 6 covers these two kinds of edit, or both test +files match their pre-feature text and pass. diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/LEARNINGS-pending.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/LEARNINGS-pending.md new file mode 100644 index 00000000..2b2f26f9 --- /dev/null +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/LEARNINGS-pending.md @@ -0,0 +1,23 @@ + + +# Lessons staged for promotion — FEAT-LOOP-2026-0251 + +`autonomy_default: auto`, so `FEAT-LOOP-2026-0251/G1-CLOSE` may not append to +`.specfuse/LEARNINGS.md` directly (`assert_learnings_staged_under_auto`). Two entries generalize. + +## Entries + +- [FEAT-LOOP-2026-0251/T01] **A unit that moves a guard earlier must state which refusal wins + when two apply, for every guard it now runs ahead of.** "Change only when, not what" is + not satisfiable on its own: moving `produces_not_in_diff` before `verify()` also moved it + ahead of `files_changed_mismatch`, which changed the recorded outcome for an input both + guards refuse. List the overtaken guards and the intended precedence in the plan. + +- [FEAT-LOOP-2026-0251/T04] **A unit that adds a lint message must run every test module + that lints, not only the ones its Verification section names.** Existing tests filtered + lint output on the word "directory"; the new WARN contained it, the narrow tier passed, + and the gate's broad run went red. The named module (`tests.test_lint_plan`) did not + exist, so check that each module a unit names can be imported before arming. diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md index 9bbebb28..5477e43d 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md @@ -4,3 +4,5 @@ - **FEAT-LOOP-2026-0251/T03**: Retry notes for all three deliverable refusals (early and late) now list the paths the attempt changed, from the diff the guard judged, capped at 20 plus a count of the rest, or say this attempt changed no files. - note: The list leaves out driver bookkeeping (the unit's WU file, events.jsonl, PROGRESS note); otherwise an attempt that changed nothing could never say so. Early presence refusals now carry `touched` (the pending diff). Event `files_touched` and the refusal history are unchanged. `loop.run()` tests fail in the sandbox on `~/.claude/session-env`, so I ran them with HOME pointed under $TMPDIR. - **FEAT-LOOP-2026-0251/T04**: Added the WARN check `check_produces_mentioned` to `specfuse lint`, replaced the skipped `TestArmTimeWarning` with real tests, and documented the early refusal order in docs/methodology.md. +- **FEAT-LOOP-2026-0251/G1-CLOSE**: Wrote the terminal close (retrospective, two follow-ups, two staged lessons, four changelog fragments) with advisory verdict not_met, because one input gets a different early and late refusal outcome and two pre-existing test edits are not order assertions. + - note: Operator must decide whether a deliverable refusal takes precedence over files_changed_mismatch (see FOLLOW-UPS.md) and acknowledge the four consumer-visible changes. diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/RETROSPECTIVE.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/RETROSPECTIVE.md new file mode 100644 index 00000000..2168f00b --- /dev/null +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/RETROSPECTIVE.md @@ -0,0 +1,185 @@ +# Retrospective — FEAT-LOOP-2026-0251, refuse a missing deliverable before verification + +## Gate 1 + +## Verdict + +`not_met` (advisory; the judge concludes). The early refusals work and every oracle is green. +Two things do not hold as written: + +1. For one input, the early refusal records a different outcome and failure class than the + late order records. This is the close unit's escalation trigger. +2. Two edits to pre-existing tests are not assertions on the order of verify and guard, so + clause 6 does not hold literally. + +Both may be acceptable as designed. That is an operator decision, and `FOLLOW-UPS.md` states it. + +## Measurements + +All commands ran fresh in this session on the working tree. Runs that drive `loop.run()` used +`HOME` under `$TMPDIR`, because the sandbox blocks writes to the real session directory. + +### feature_oracle: PASS + +`python3 -m unittest tests.test_fail_fast_deliverables -v -b`: exit 0, `Ran 29 tests`, `OK`, +no skips. `grep -c "unittest.skip" tests/test_fail_fast_deliverables.py` prints `0`, and a +search for `skipIf`, `skipUnless`, `skipTest` and `@skip` in that file finds nothing. + +### Other oracles + +| Check | Result | +|---|---| +| `python3 -m unittest tests.test_dispatch_skeleton tests.test_gate_timings -b` | 25 tests, OK | +| `python3 -m unittest tests.test_lint_plan -b` (named by T04) | **error: no such module** (`ModuleNotFoundError`) | +| the six `tests/test_lint_plan*.py` modules that do exist | 46 tests, OK | +| the ten changed pre-existing test modules | 68 tests, OK | +| `.specfuse/scripts/lint_plan.py` over every feature folder with a `PLAN.md` | 97 linted, 0 non-zero exits | +| `diff` of `verification.yml.example` against its packaged copy | empty | +| `diff docs/methodology.md specfuse/loop/data/docs/methodology.md` | empty | +| `python3 -m specfuse.loop.changelog_fragments check` | exit 0 | + +The full suite and coverage were not re-run by this session. The driver's broad run at +2026-11-26T13:36:49Z recorded `ok: true`; its tests log shows `Ran 5143 tests`, +`OK (skipped=4)`, and its coverage log shows 92% total. + +### Mutation control + +With `resolve_fail_fast_deliverables` forced to return `False`, 12 of the 29 oracle tests +fail, with no errors. They are in `TestProducesNotInDiffEarly` (2), `TestPresenceEarly` (3), +`TestOptOut` (4, including the resolver's own default test), `TestTreeAndNote` (2) and +`TestEarlyRefusalRecovery` (1). So these classes observe the new order. +`TestArmTimeWarning` calls `check_produces_mentioned`, which does not exist on `main`. +No unit's "fails on HEAD" claim was re-run against a pre-feature tree. + +### Early against late, same input + +A throwaway probe drove `loop.run()` over the oracle's fixture and read the first +`attempt_outcome` for T01. The unit declares `src/rule.py`; the attempt writes only +`docs/notes.md`. + +| Case | `fail_fast` true | `fail_fast` false | Same | +|---|---|---|---| +| A: RESULT lists `src/rule.py` in `files_changed`, gates green | `produces_not_in_diff` / `produces_not_in_diff`, 0 verify calls | `files_changed_mismatch` / `files_changed_mismatch`, 1 call | **no** | +| B: plain RESULT, gates red | `produces_not_in_diff`, 0 calls | `failed` / `other`, 1 call | no (see below) | +| C: control, plain RESULT, gates green | `produces_not_in_diff`, 0 calls | `produces_not_in_diff`, 1 call | yes | + +B follows from the feature's purpose: a gate that never runs cannot report a failure. +A does not follow from it. `files_changed_mismatch` needs no gate result, and `PLAN.md` +decision 4 says that guard stays where it is. The early produces check now pre-empts it. +The pre-existing test `test_untouched_deliverable_still_refuses` shows the same change. + +By reading the code only, not measured: the early check also runs before the smoke-import +guard, the closing-deliverable guards and the produced-verdict contradiction check. An +attempt that would trip one of those and also misses a deliverable is now reported as the +deliverable refusal. + +carried forward: 0 criteria, re-measured: 13 + +## Definition of done, clause by clause + +| Clause | Proven | By | +|---|---|---| +| 1. `produces_not_in_diff` early | Refused with 0 `verify_fn` calls, `verify_seconds` 0, no attempt-phase `gate_result`; a changed path verifies once and passes; a justified path still verifies; class, signature and summary equal the late site's | `TestProducesNotInDiffEarly` (5 tests). Case A above is an input where the late order never reaches that late site | +| 2. Presence early | Absent, empty and bookkeeping-only diffs are refused with 0 calls | `TestPresenceEarly` | +| 3. Opt-out | With the key `false`, each of the three cases verifies once; outcome, class, signature and summary equal the default's | `TestOptOut`, on plain-RESULT, green-gate inputs only | +| 4. Tree and note | Note says verification did not run and lists changed paths or says none; cap of 20 plus a count; tree kept or reset | `TestTreeAndNote`. The kept/reset assertions use `produces_not_in_diff` only; no test asserts tree handling for an early presence refusal | +| 5. Arm-time WARN | Warns on an unmentioned path; silent on full path, file name or parent directory, and on `done` / `abandoned`; `lint()` calls it | `TestArmTimeWarning` | +| 6. Nothing else changes | **Not literally.** See the list below | diff of `tests/` against a snapshot of public `main`, fetched this session | + +Three review fixes made before this close, outside any work unit, are covered by +`TestEarlyRefusalRecovery` (re-plan still fires; uncommitted tracked edits count as a moved +tree; an untouched tree still halts) and `TestEarlyRetainedNoteWording`. + +## Pre-existing tests changed + +The comparison is against `main` as fetched during this close, not against the recorded +merge base, because this session runs no git command. Besides the new oracle file, ten +test modules differ. + +Changed because of the order of verify and guard: + +| Test module | Change | Why | +|---|---|---| +| `test_files_changed_auto_repair` | `test_untouched_deliverable_still_refuses` now expects `produces_not_in_diff`, not `files_changed_mismatch` | The early check pre-empts the post-verify guard. This changes the expected **outcome**, not only the order (case A) | +| `test_guard_repair_e2e` | Patches `early_produces_refusal` to return `None` in one test | The absent `src/extra.py` would be refused early, so the guard under test would never run. The test now exercises the late order only | +| `test_arm_wiring` | Two dispatch stubs wrapped in `with_deliverable` | The stubs wrote nothing and relied on `verify` failing first | +| `test_loop_files_changed_guard` | One stub wrapped in `with_deliverable` | Same: it must get past the presence refusal to reach `verify` | +| `test_replan_end_to_end` | Stub wrapped in `with_deliverable` | Same | +| `test_replan_event_emission` | Stub wrapped in `with_deliverable` | Same | +| `test_replan_note_collision` | Stub wrapped in `with_deliverable` | Same | +| `test_replan_trigger` | One stub writes `deliverable.txt`; one comment rewritten | Attempts must reach `verify`; the comment's claim that the re-plan trigger is never consulted became false | + +Not an assertion on order: + +| Test module | Change | Why | +|---|---|---| +| `test_deterministic_refusal_repeat` | The source-text anchor moved from `"deliverable_missing",` to `if not deliv_ok:` | The emit call moved into the shared `refuse_deliverable_missing` helper. The two assertions are unchanged. They cover the late branch only | +| `test_produces_shape` | Two negative tests filter findings on `assert_declared_deliverables`, not `directory` | The new WARN text contains "directory". The shape check's ERROR still carries the new marker, so the filter can still catch it | + +## What happened + +T01 to T04 each passed on the first attempt. The gate's first broad run +(2026-11-25T23:44Z) failed: `tests` with 5125 tests and 2 failures, both in +`test_produces_shape`, and `coverage` with `no_gate_marker`. The T04 WARN text caused the +two test failures. No unit's narrow tier selected that module. A later broad run was clean. +The terminal judge-editing stop then fired, as `GATE-01.md` expected. An independent review +found three behaviour changes, fixed test-first on the branch, and the operator +acknowledged the judge edits and re-armed this unit. + +T04 passed although its Verification section names `tests.test_lint_plan`, which does not +exist. + +## Cost analysis + +Unit costs are from the `task_completed` events in `events.jsonl`. + +| Unit | Planned USD | Actual USD | Actual / planned | Attempts | +|---|---|---|---|---| +| T01 | 2.00 | 0.88 | 44% | 1 | +| T02 | 1.50 | 0.77 | 51% | 1 | +| T03 | 1.00 | 0.55 | 55% | 1 | +| T04 | 1.50 | 0.47 | 32% | 1 | +| Substantive total | 6.00 | 2.67 | 45% | 4 | +| G1-CLOSE | 5.00 | not yet recorded | — | in progress | + +The plan total is 11.00 and the gate budget 14.00. The close's own cost and the judge's are +written after this session. The earlier `blocked_human` stop of this unit recorded 0.00. +The review and its fixes happened outside the loop, so `events.jsonl` has no cost for them. + +**T04's warning rate.** Re-measured this session over `done` units with `produces:`: the +shipped rule (path, file name or parent directory) would fire on 35 of 402, **8.7%**, under +the 10% limit. Path or file name alone would fire on 81 of 402, 20.1%. T04 recorded 81 and +35 of 401 in the check's docstring; the population has since grown by one. T04's progress +note does not carry the count that its criterion 3 asked for in the RESULT notes, and this +session did not see that RESULT. The parent-directory match is a plain substring test, so a +short directory such as `tests` is satisfied by almost any body. The WARN is weak for such +paths. + +## Consumer-visible contract changes + +Pending human acknowledgment. Each has a `changelog.d/` fragment tracing to +`FEAT-LOOP-2026-0251`. + +1. **Changed:** the three deliverable refusals run before verification. An attempt that + would also have failed a gate or `files_changed_mismatch` is reported as the deliverable + refusal. +2. **Added:** `defaults.fail_fast_deliverables`, default `true`. +3. **Changed:** the retry note for the three refusals lists the changed paths, at most 20 + plus a count. +4. **Added:** a `specfuse lint` WARN for a `produces:` path the unit's body never mentions. + +## What the loop did NOT verify + +- **A real project whose gates write a declared deliverable.** The opt-out is tested only + with stubs. With the default, such a unit is refused early on every attempt. +- **Real refused attempts on the new build.** T01 to T04 ran on a build pinned before the + change (`bd7e508`). `events.jsonl` shows later pins (`cddc418`, `eb30755`), and this + close was dispatched after the last one, so "every attempt ran on the old build" is not + established for the close. No event in this feature shows a real early refusal, so no + real saving in gate time is measured. +- Tree handling for early `deliverable_missing` and `no_deliverable_files` refusals. +- The precedence over the smoke-import, closing-deliverable and contradiction checks. +- Whether the pending-diff computation matches the squash diff for renames, submodules or + ignored files. Only the oracle's simple cases were run. +- `specfuse lint` as the installed command. The pipx build differs from this tree, so the + repository scripts were used. diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md index 3c44d7f4..bb83216e 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md @@ -1,11 +1,12 @@ --- id: FEAT-LOOP-2026-0251/G1-CLOSE type: close -status: pending -attempts: 0 +status: done +attempts: 1 oracle_env: macos_local planned_cost_usd: 5.00 auto_close_disabled: true +verdict: not_met model: sonnet effort: high judge_edit_acknowledged: @@ -25,6 +26,19 @@ re_arm_history: prior_cost_usd: 0.0 prior_duration_seconds: 0.0 reason: "Review fixes tested, full suite green, accept the generator risk" +cumulative_cost_usd: 0.0 +cumulative_duration_seconds: 0.0 +cumulative_input_tokens: 0 +cumulative_output_tokens: 0 +cumulative_attempts: 0 +cost_usd: 1.256598 +duration_seconds: 291.43 +input_tokens: 56 +output_tokens: 29850 +folded_through_re_arm: 1 +gate_set: plannext +driver_version: 0.33.2 +started_at: 2026-11-26T13:36:49.213745+00:00 --- # G1-CLOSE — terminal close diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index 43cd5933..71123945 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -114,3 +114,5 @@ {"timestamp": "2026-11-26T13:36:49.017488+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "init-sh-shim-bats", "ok": true, "skipped": false, "duration_seconds": 0.851, "phase": "broad"}} {"timestamp": "2026-11-26T13:36:49.017489+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "init-skills-bats", "ok": true, "skipped": false, "duration_seconds": 0.124, "phase": "broad"}} {"timestamp": "2026-11-26T13:36:49.017490+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "hookspath-conflict-bats", "ok": true, "skipped": false, "duration_seconds": 0.583, "phase": "broad"}} +{"timestamp": "2026-11-26T13:36:49.116308+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "terminal_judge_editing_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "status": "clean", "reason": "acknowledged by operator: .specfuse/verification.yml.example, produces_driver_helper, specfuse/loop/data/verification.yml.example, specfuse/loop/lint_plan.py, specfuse/loop/loop.py"}} +{"timestamp": "2026-11-26T13:36:49.118957+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "terminal_judge_editing_acknowledged", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "close_unit": "FEAT-LOOP-2026-0251/G1-CLOSE", "paths": [".specfuse/verification.yml.example", "produces_driver_helper", "specfuse/loop/data/verification.yml.example", "specfuse/loop/lint_plan.py", "specfuse/loop/loop.py"], "reason": "Review fixes tested, full suite green, accept the generator risk"}} diff --git a/changelog.d/FEAT-LOOP-2026-0251-defaults-fail-fast-deliverables-in-verif.md b/changelog.d/FEAT-LOOP-2026-0251-defaults-fail-fast-deliverables-in-verif.md new file mode 100644 index 00000000..91636f48 --- /dev/null +++ b/changelog.d/FEAT-LOOP-2026-0251-defaults-fail-fast-deliverables-in-verif.md @@ -0,0 +1,5 @@ +--- +class: added +trace: FEAT-LOOP-2026-0251 +--- +`defaults.fail_fast_deliverables` in `verification.yml` (default `true`); set `false` to run the three deliverable refusals after verification, as before. Needed when a verification gate itself writes a declared deliverable diff --git a/changelog.d/FEAT-LOOP-2026-0251-specfuse-lint-prints-a-warn-for-a-dispat.md b/changelog.d/FEAT-LOOP-2026-0251-specfuse-lint-prints-a-warn-for-a-dispat.md new file mode 100644 index 00000000..7a740e63 --- /dev/null +++ b/changelog.d/FEAT-LOOP-2026-0251-specfuse-lint-prints-a-warn-for-a-dispat.md @@ -0,0 +1,5 @@ +--- +class: added +trace: FEAT-LOOP-2026-0251 +--- +`specfuse lint` prints a WARN for a dispatchable work unit whose `produces:` path its body never mentions by full path, file name or parent directory diff --git a/changelog.d/FEAT-LOOP-2026-0251-the-produces-not-in-diff-deliverable-mis.md b/changelog.d/FEAT-LOOP-2026-0251-the-produces-not-in-diff-deliverable-mis.md new file mode 100644 index 00000000..97b6728e --- /dev/null +++ b/changelog.d/FEAT-LOOP-2026-0251-the-produces-not-in-diff-deliverable-mis.md @@ -0,0 +1,5 @@ +--- +class: changed +trace: FEAT-LOOP-2026-0251 +--- +The `produces_not_in_diff`, `deliverable_missing` and `no_deliverable_files` refusals now run before the verification gates, so a refused attempt pays for no gate run. An attempt that also would have failed a gate, or `files_changed_mismatch`, is now reported as the deliverable refusal instead diff --git a/changelog.d/FEAT-LOOP-2026-0251-the-retry-note-for-the-three-deliverable.md b/changelog.d/FEAT-LOOP-2026-0251-the-retry-note-for-the-three-deliverable.md new file mode 100644 index 00000000..2b8655ec --- /dev/null +++ b/changelog.d/FEAT-LOOP-2026-0251-the-retry-note-for-the-three-deliverable.md @@ -0,0 +1,5 @@ +--- +class: changed +trace: FEAT-LOOP-2026-0251 +--- +The retry note for the three deliverable refusals now lists the paths the attempt changed (at most 20, plus a count of the rest), or says it changed none From 216b70a0b2ef61d991253df4da1e2c71923bb38c Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 08:42:57 -0500 Subject: [PATCH 19/69] chore(loop): FEAT-LOOP-2026-0251/G1-CLOSE judge cost fold Feature: FEAT-LOOP-2026-0251 --- .../WU-90-gate-1-close.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md index bb83216e..246a4cc8 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md @@ -31,10 +31,10 @@ cumulative_duration_seconds: 0.0 cumulative_input_tokens: 0 cumulative_output_tokens: 0 cumulative_attempts: 0 -cost_usd: 1.256598 +cost_usd: 1.69295 duration_seconds: 291.43 -input_tokens: 56 -output_tokens: 29850 +input_tokens: 70 +output_tokens: 36654 folded_through_re_arm: 1 gate_set: plannext driver_version: 0.33.2 From de295800d9f59d22c9be615f89a3781ba0ab2d0e Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 08:42:57 -0500 Subject: [PATCH 20/69] chore(loop): gate 1 awaiting_review Feature: FEAT-LOOP-2026-0251 --- .../GATE-01.md | 2 +- .../events.jsonl | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md index 8e638862..5c712c3e 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md @@ -1,6 +1,6 @@ --- gate: 1 -status: open +status: awaiting_review feature_oracle: "python3 -m unittest tests.test_fail_fast_deliverables -v -b" cost_budget_usd: 14.00 broad_run: diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index 71123945..2134e895 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -116,3 +116,12 @@ {"timestamp": "2026-11-26T13:36:49.017490+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "hookspath-conflict-bats", "ok": true, "skipped": false, "duration_seconds": 0.583, "phase": "broad"}} {"timestamp": "2026-11-26T13:36:49.116308+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "terminal_judge_editing_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "status": "clean", "reason": "acknowledged by operator: .specfuse/verification.yml.example, produces_driver_helper, specfuse/loop/data/verification.yml.example, specfuse/loop/lint_plan.py, specfuse/loop/loop.py"}} {"timestamp": "2026-11-26T13:36:49.118957+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "terminal_judge_editing_acknowledged", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "close_unit": "FEAT-LOOP-2026-0251/G1-CLOSE", "paths": [".specfuse/verification.yml.example", "produces_driver_helper", "specfuse/loop/data/verification.yml.example", "specfuse/loop/lint_plan.py", "specfuse/loop/loop.py"], "reason": "Review fixes tested, full suite green, accept the generator risk"}} +{"timestamp": "2026-11-26T13:36:49.213996+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "task_started", "source": "driver", "source_version": "0.33.2", "payload": {"type": "close", "model": "sonnet", "re_arm_count": 1}} +{"timestamp": "2026-11-26T13:36:49.214001+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "re_arm_dispatched", "source": "driver", "source_version": "0.33.2", "payload": {"re_arm_count": 1, "reason": "Review fixes tested, full suite green, accept the generator risk"}} +{"timestamp": "2026-11-26T13:41:40.647444+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "plan-lint", "ok": true, "skipped": false, "duration_seconds": 0.127, "phase": "attempt"}} +{"timestamp": "2026-11-26T13:41:40.647474+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "feature_oracle", "ok": true, "skipped": false, "duration_seconds": 14.017, "phase": "attempt"}} +{"timestamp": "2026-11-26T13:42:57.817022+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "judged", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "close_verdict": "not_met", "close_model": "sonnet", "judge_verdict": "not_met", "verdict": "not_met", "lowered": false, "disagreed": false, "findings": 4, "reason": null, "diff_base": "a89373d119f8e2d8003a8956dbd4bd27dde8057f", "diff_base_source": "merge-base of HEAD with main", "usage": {"cost_usd": 0.436352, "input_tokens": 14, "output_tokens": 6804, "cache_read_input_tokens": 462080, "cache_creation_input_tokens": 80519}, "judge_cost_usd": 0.436352}} +{"timestamp": "2026-11-26T13:42:57.818204+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "attempt_outcome", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "outcome": "passed", "duration_seconds": 291.43, "agent_seconds": 277.10579370788764, "verify_seconds": 14.151980416034348, "cost_usd": 1.69295, "input_tokens": 70, "output_tokens": 36654, "cache_read_input_tokens": 3808540, "cache_creation_input_tokens": 236354, "model": "sonnet", "effort": "high", "failure_class": null, "failure_signature": null, "failure_excerpt": null, "files_touched": [".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md", ".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/LEARNINGS-pending.md", ".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/RETROSPECTIVE.md", ".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md", ".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl", "changelog.d/FEAT-LOOP-2026-0251-defaults-fail-fast-deliverables-in-verif.md", "changelog.d/FEAT-LOOP-2026-0251-specfuse-lint-prints-a-warn-for-a-dispat.md", "changelog.d/FEAT-LOOP-2026-0251-the-produces-not-in-diff-deliverable-mis.md", "changelog.d/FEAT-LOOP-2026-0251-the-retry-note-for-the-three-deliverable.md"], "agent_status": "complete", "agent_blocked_reason": null, "re_arm_count": 0, "failing_tests": []}} +{"timestamp": "2026-11-26T13:42:57.818353+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "task_completed", "source": "driver", "source_version": "0.33.2", "payload": {"attempts": 1, "attempts_usage": [{"attempt": 1, "duration_seconds": 291.43, "cost_usd": 1.69295, "input_tokens": 70, "output_tokens": 36654, "cache_read_input_tokens": 3808540, "cache_creation_input_tokens": 236354, "agent_seconds": 277.10579370788764, "verify_seconds": 14.151980416034348}], "type": "close", "re_arm_count": 1, "cost_usd": 1.69295, "cumulative_cost_usd": 1.69295, "attempts_lifetime": 1, "planned_cost_usd": 5.0}} +{"timestamp": "2026-11-26T13:42:57.836279+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_reached", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1}} +{"timestamp": "2026-11-26T13:42:57.836271+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "arm_predicate_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "would_arm": true, "predicate_version": "v1", "classes": {"budget_projection": {"status": "clean", "reason": "projected spend $4.37 within 2.0x baseline planned total $11.00 (cap $22.00)"}, "judge_editing": {"status": "clean", "reason": "no drafted WU touches judge-path surfaces"}, "decision_class_paths": {"status": "clean", "reason": "no drafted WU touches a recognised dependency manifest (pyproject.toml, package.json, pom.xml, build.gradle, build.gradle.kts, Cargo.toml, go.mod, Gemfile, composer.json, requirements*.txt, *.csproj)"}, "retroactive_edits": {"status": "clean", "reason": "no passed-gate baseline WU altered or removed"}, "drift_caps": {"status": "clean", "reason": "added WUs and gates within drift caps"}, "missing_provenance": {"status": "clean", "reason": "no added WUs"}, "open_questions_human_only": {"status": "clean", "reason": "terminal gate: no drafted successor"}, "plan_next_lint": {"status": "clean", "reason": "plan-next lint: no findings"}}}} From f3ae26229885403e8a4d07804456ca66a6e6db16 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 08:43:02 -0500 Subject: [PATCH 21/69] =?UTF-8?q?chore(loop):=20FEAT-LOOP-2026-0251=20?= =?UTF-8?q?=E2=80=94=20record=20the=20follow-up=20issues=20the=20driver=20?= =?UTF-8?q?filed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md | 4 ++++ .../FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl | 1 + 2 files changed, 5 insertions(+) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md index 6714f3af..17bef352 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md @@ -2,6 +2,8 @@ ### An early refusal records a different outcome from the late order for one input +**Tracked as #3608.** + **Criterion (verbatim).** "A surviving skip, or an early refusal whose outcome or failure class differs from the late one for the same input: record `not_met` with a follow-up." @@ -35,6 +37,8 @@ and failure class with the key `true` and `false`, asserted by a test. ### Clause 6 does not hold literally for two pre-existing tests +**Tracked as #3609.** + **Criterion (verbatim).** "**Nothing else changes.** Every existing test of the three guards passes unchanged, apart from assertions on the order of `verify` and the guard, which are updated and named in the close." diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index 2134e895..cac89164 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -125,3 +125,4 @@ {"timestamp": "2026-11-26T13:42:57.818353+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "task_completed", "source": "driver", "source_version": "0.33.2", "payload": {"attempts": 1, "attempts_usage": [{"attempt": 1, "duration_seconds": 291.43, "cost_usd": 1.69295, "input_tokens": 70, "output_tokens": 36654, "cache_read_input_tokens": 3808540, "cache_creation_input_tokens": 236354, "agent_seconds": 277.10579370788764, "verify_seconds": 14.151980416034348}], "type": "close", "re_arm_count": 1, "cost_usd": 1.69295, "cumulative_cost_usd": 1.69295, "attempts_lifetime": 1, "planned_cost_usd": 5.0}} {"timestamp": "2026-11-26T13:42:57.836279+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_reached", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1}} {"timestamp": "2026-11-26T13:42:57.836271+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "arm_predicate_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "would_arm": true, "predicate_version": "v1", "classes": {"budget_projection": {"status": "clean", "reason": "projected spend $4.37 within 2.0x baseline planned total $11.00 (cap $22.00)"}, "judge_editing": {"status": "clean", "reason": "no drafted WU touches judge-path surfaces"}, "decision_class_paths": {"status": "clean", "reason": "no drafted WU touches a recognised dependency manifest (pyproject.toml, package.json, pom.xml, build.gradle, build.gradle.kts, Cargo.toml, go.mod, Gemfile, composer.json, requirements*.txt, *.csproj)"}, "retroactive_edits": {"status": "clean", "reason": "no passed-gate baseline WU altered or removed"}, "drift_caps": {"status": "clean", "reason": "added WUs and gates within drift caps"}, "missing_provenance": {"status": "clean", "reason": "no added WUs"}, "open_questions_human_only": {"status": "clean", "reason": "terminal gate: no drafted successor"}, "plan_next_lint": {"status": "clean", "reason": "plan-next lint: no findings"}}}} +{"timestamp": "2026-11-26T13:43:02.496391+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "followups_recorded", "source": "driver", "source_version": "0.33.2", "payload": {"filed": 2, "unfiled": 0, "already_tracked": 0, "issue_numbers": ["3608", "3609"], "written_back": ["FOLLOW-UPS.md"]}} From c2c6851649bbf19bcdd8d3e1db7dbf001c4ee5d9 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 08:51:06 -0500 Subject: [PATCH 22/69] chore(FEAT-LOOP-2026-0251): amend gate 1 definition of done for #3608 and #3609, re-arm the close Operator decision after the first close recorded not_met: state that a deliverable refusal outranks files_changed_mismatch under the default order (#3608), asserted by a new test on both sides of the opt-out; widen clause 6 to cover test edits forced by a shared-helper refactor or new lint wording, none of which removes an assertion (#3609). Co-Authored-By: Claude Opus 5.5 --- .../GATE-01.md | 16 +++++++-- .../WU-90-gate-1-close.md | 28 +++++++++++---- tests/test_fail_fast_deliverables.py | 34 +++++++++++++++++++ 3 files changed, 68 insertions(+), 10 deletions(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md index 5c712c3e..385034dc 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md @@ -1,6 +1,6 @@ --- gate: 1 -status: awaiting_review +status: open feature_oracle: "python3 -m unittest tests.test_fail_fast_deliverables -v -b" cost_budget_usd: 14.00 broad_run: @@ -33,8 +33,18 @@ leaves a known diff and a `verify_fn` that counts its calls: 5. **Arm-time warning.** `specfuse lint` prints a WARN for a dispatchable unit whose `produces:` path appears nowhere in its body, by full path or file name, and stays silent when it does. 6. **Nothing else changes.** Every existing test of the three guards passes unchanged, apart - from assertions on the order of `verify` and the guard, which are updated and named in the - close. + from assertions on the order of `verify` and the guard, and edits forced by moving code into + a shared helper or by new lint wording that a text-matching assertion picks up. No such edit + removes or weakens an assertion, and each is named in the close. *(Widened 2026-11-26 by the + operator after the first close, #3609.)* + +**Precedence when two refusals apply** *(stated 2026-11-26 by the operator after the first +close, #3608).* An attempt whose RESULT claims a declared `produces:` path it did not change +trips both `produces_not_in_diff` and `files_changed_mismatch`. Under the default order the +deliverable refusal wins and verification does not run; with `fail_fast_deliverables: false` +the old `files_changed_mismatch` outcome holds. Both sides are asserted by +`TestProducesNotInDiffEarly.test_deliverable_refusal_outranks_files_changed_mismatch`. +Clause 3's "same outcome and failure class" applies to inputs that trip only one refusal. The `feature_oracle` proves 1–5. It is red on the current tree; `FEAT-LOOP-2026-0251/T01` is the walking skeleton that creates `tests/test_fail_fast_deliverables.py` and turns clause 1 green, diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md index 246a4cc8..7fdb7e58 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md @@ -1,12 +1,11 @@ --- id: FEAT-LOOP-2026-0251/G1-CLOSE type: close -status: done -attempts: 1 +status: pending +attempts: 0 oracle_env: macos_local planned_cost_usd: 5.00 auto_close_disabled: true -verdict: not_met model: sonnet effort: high judge_edit_acknowledged: @@ -17,7 +16,7 @@ judge_edit_acknowledged: - specfuse/loop/lint_plan.py - specfuse/loop/loop.py reason: "Review fixes tested, full suite green, accept the generator risk" -re_arm_count: 1 +re_arm_count: 2 re_arm_history: - timestamp: 2026-11-26T13:30:05+00:00 @@ -26,6 +25,13 @@ re_arm_history: prior_cost_usd: 0.0 prior_duration_seconds: 0.0 reason: "Review fixes tested, full suite green, accept the generator risk" + - + timestamp: 2026-11-26T13:50:58+00:00 + prior_status: done + prior_attempts: 1 + prior_cost_usd: 1.69295 + prior_duration_seconds: 291.43 + reason: "A for both, go ahead" cumulative_cost_usd: 0.0 cumulative_duration_seconds: 0.0 cumulative_input_tokens: 0 @@ -51,8 +57,8 @@ warns on a `produces:` path its unit never mentions. 1. `RETROSPECTIVE.md` records, per Definition-of-done clause in `GATE-01.md`, what was proven and by which test, and that no `unittest.skip` survives in - `tests/test_fail_fast_deliverables.py`. It lists every pre-existing test whose assertion on - the order of verify and guard was changed (clause 6), with why. + `tests/test_fail_fast_deliverables.py`. It lists every pre-existing test that was changed + (clause 6, as widened for #3609), with why. 2. Each consumer-visible change (the new order, `defaults.fail_fast_deliverables`, the retry note's path list, the lint WARN) is written with `python3 -m specfuse.loop.changelog_fragments add`, tracing to `FEAT-LOOP-2026-0251`. @@ -69,4 +75,12 @@ warns on a `produces:` path its unit never mentions. **Verification.** `specfuse lint --closing`, plus the gate set in `.specfuse/verification.yml`. **Escalation triggers.** A surviving skip, or an early refusal whose outcome or failure class -differs from the late one for the same input: record `not_met` with a follow-up. +differs from the late one for the same input, other than the deliverable-over- +`files_changed_mismatch` precedence `GATE-01.md` states (#3608): record `not_met` with a +follow-up. + +**Re-close note (2026-11-26).** The first close recorded `not_met` on #3608 and #3609; the +operator chose to amend the definition of done for both (see `GATE-01.md` clause 6 and +"Precedence when two refusals apply"). That close already wrote `RETROSPECTIVE.md`, +`FOLLOW-UPS.md`, `LEARNINGS-pending.md` and changelog fragments: update them in place, do not +duplicate fragments, and say in `FOLLOW-UPS.md` whether each entry's re-run condition now holds. diff --git a/tests/test_fail_fast_deliverables.py b/tests/test_fail_fast_deliverables.py index 083ee2fa..19d09678 100644 --- a/tests/test_fail_fast_deliverables.py +++ b/tests/test_fail_fast_deliverables.py @@ -130,6 +130,40 @@ def test_changed_path_verifies_once_and_passes(self): self.assertEqual(outcome, "passed") self.assertEqual(calls, [T01]) + def test_deliverable_refusal_outranks_files_changed_mismatch(self): + """GATE-01.md precedence (#3608): a RESULT that claims an untouched + declared path trips both guards; the default order names the + deliverable refusal, the opt-out keeps the old post-verify name.""" + claim = ("```result\nstatus: complete\nfiles_changed:\n" + " - docs/notes.md\n - src/rule.py\n```\n") + _, outcome, _, _, calls = self._attempt("docs/notes.md", claim) + self.assertEqual(outcome, "produces_not_in_diff") + self.assertEqual(calls, []) + os.chdir(self._cwd) + + _, fdir = self._workspace() + wu = loop.load_wu(fdir, {"id": T01, "file": "WU-T01.md", + "depends_on": []}) + head = _git("rev-parse", "HEAD") + late_calls = [] + + def dispatch_fn(w, note): + Path("docs").mkdir(exist_ok=True) + Path("docs/notes.md").write_text("changed\n") + return claim + + def verify_fn(w, fd): + late_calls.append(w.wu_id) + return True, "(stub)" + + outcome, _, _ = loop.execute_unit_attempt( + wu, fdir, None, dispatch_fn=dispatch_fn, verify_fn=verify_fn, + cost_tracking=False, head_before=head, + prerun_cfg={"defaults": {"fail_fast_deliverables": False}}, + untracked_before=loop.untracked_paths()) + self.assertEqual(outcome, "files_changed_mismatch") + self.assertEqual(late_calls, [T01]) + def test_justified_path_still_verifies(self): _, outcome, _, _, calls = self._attempt( "docs/notes.md", From c66843b142a7860dc8c756fec9ca8da20cc5d5b9 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 08:51:06 -0500 Subject: [PATCH 23/69] chore(loop): FEAT-LOOP-2026-0251 build pin recorded Feature: FEAT-LOOP-2026-0251 --- .../FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl | 1 + 1 file changed, 1 insertion(+) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index cac89164..5a44c85b 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -126,3 +126,4 @@ {"timestamp": "2026-11-26T13:42:57.836279+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_reached", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1}} {"timestamp": "2026-11-26T13:42:57.836271+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "arm_predicate_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "would_arm": true, "predicate_version": "v1", "classes": {"budget_projection": {"status": "clean", "reason": "projected spend $4.37 within 2.0x baseline planned total $11.00 (cap $22.00)"}, "judge_editing": {"status": "clean", "reason": "no drafted WU touches judge-path surfaces"}, "decision_class_paths": {"status": "clean", "reason": "no drafted WU touches a recognised dependency manifest (pyproject.toml, package.json, pom.xml, build.gradle, build.gradle.kts, Cargo.toml, go.mod, Gemfile, composer.json, requirements*.txt, *.csproj)"}, "retroactive_edits": {"status": "clean", "reason": "no passed-gate baseline WU altered or removed"}, "drift_caps": {"status": "clean", "reason": "added WUs and gates within drift caps"}, "missing_provenance": {"status": "clean", "reason": "no added WUs"}, "open_questions_human_only": {"status": "clean", "reason": "terminal gate: no drafted successor"}, "plan_next_lint": {"status": "clean", "reason": "plan-next lint: no findings"}}}} {"timestamp": "2026-11-26T13:43:02.496391+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "followups_recorded", "source": "driver", "source_version": "0.33.2", "payload": {"filed": 2, "unfiled": 0, "already_tracked": 0, "issue_numbers": ["3608", "3609"], "written_back": ["FOLLOW-UPS.md"]}} +{"timestamp": "2026-11-26T13:51:06.744598+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "driver_build_pinned", "source": "driver", "source_version": "0.33.2", "payload": {"tree": "b2513b4b90ea629561419494ccfffdd53b5055e5", "path": "/private/var/folders/zc/rgq11x850d78dx_kf1fd4vx80000gn/T/specfuse-pins/b2513b4b90ea629561419494ccfffdd53b5055e5/specfuse/loop"}} From 0bf636df1512b8812834316a27a5911e2bcfd1ff Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 08:59:19 -0500 Subject: [PATCH 24/69] chore(loop): gate 1 broad run clean Feature: FEAT-LOOP-2026-0251 --- .../GATE-01.md | 4 ++-- .../events.jsonl | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md index 385034dc..290ed1e9 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md @@ -4,8 +4,8 @@ status: open feature_oracle: "python3 -m unittest tests.test_fail_fast_deliverables -v -b" cost_budget_usd: 14.00 broad_run: - tree: 07bbf72d1e7af3c1a03af605f40e5563dc3a18db:0ec7c6da6e74f0b56753f09657b654a6d289b91b:12064a6191eeb830a9826d911a8543fbaba3da75:27968248a450a842ccd187b7dce0fb0ded934866:287efde8f90320baffac08f5f3287b9456a65cb9:2e29b2f7e073a0cbe290f01d3b397e1cdd10c81c:42796ea0e0a6c03811b0e4bc9dbd3b5ee62dd2e4:4acc6dfc5e8cece358c167d876515eba4a39a500:641be9742f9a620d6209e7c786d1ff6f6664ef20:834d9d9c16094a386cd9b5a6f9ced9a3a9b4e7fb:a90788bb48ee6cdb0fa8b0f867c80a4643acd35d:bbd1aea514612d76722a18c7aece7c767cf1a076:c23b62e87f1ae3890c6f9e3d8c7ca7ec9225ed81:caffe2d63ceacde448842a91bc7a12c206a67523:d261cc7cb35eba19cd0f077fa66e995cd61b02b4:d74b7d113b844e84f0009098f576fd28477f072d:e1aa20b9c08a5ebe036da74f16e28c751f18f6fa:e3b0de29b81a6c8e0abeacb3898519b98014b9ef:fa2f4f88657587b6e3b560977858810846b1d366 - ran_at: 2026-11-26T13:36:49.008653+00:00 + tree: 07bbf72d1e7af3c1a03af605f40e5563dc3a18db:0ec7c6da6e74f0b56753f09657b654a6d289b91b:12064a6191eeb830a9826d911a8543fbaba3da75:27968248a450a842ccd187b7dce0fb0ded934866:287efde8f90320baffac08f5f3287b9456a65cb9:2e29b2f7e073a0cbe290f01d3b397e1cdd10c81c:42796ea0e0a6c03811b0e4bc9dbd3b5ee62dd2e4:4acc6dfc5e8cece358c167d876515eba4a39a500:834d9d9c16094a386cd9b5a6f9ced9a3a9b4e7fb:a90788bb48ee6cdb0fa8b0f867c80a4643acd35d:bbd1aea514612d76722a18c7aece7c767cf1a076:c23b62e87f1ae3890c6f9e3d8c7ca7ec9225ed81:cab62f76bd04445beb1bf0786c2ee8df617496bb:caffe2d63ceacde448842a91bc7a12c206a67523:d74b7d113b844e84f0009098f576fd28477f072d:e1aa20b9c08a5ebe036da74f16e28c751f18f6fa:e3b0de29b81a6c8e0abeacb3898519b98014b9ef:f52cfa168d3517ad5d14d0c2b706e13ec571268e:fa2f4f88657587b6e3b560977858810846b1d366 + ran_at: 2026-11-26T13:59:19.214421+00:00 ok: true failing: [] --- diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index 5a44c85b..b2f89891 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -127,3 +127,22 @@ {"timestamp": "2026-11-26T13:42:57.836271+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "arm_predicate_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "would_arm": true, "predicate_version": "v1", "classes": {"budget_projection": {"status": "clean", "reason": "projected spend $4.37 within 2.0x baseline planned total $11.00 (cap $22.00)"}, "judge_editing": {"status": "clean", "reason": "no drafted WU touches judge-path surfaces"}, "decision_class_paths": {"status": "clean", "reason": "no drafted WU touches a recognised dependency manifest (pyproject.toml, package.json, pom.xml, build.gradle, build.gradle.kts, Cargo.toml, go.mod, Gemfile, composer.json, requirements*.txt, *.csproj)"}, "retroactive_edits": {"status": "clean", "reason": "no passed-gate baseline WU altered or removed"}, "drift_caps": {"status": "clean", "reason": "added WUs and gates within drift caps"}, "missing_provenance": {"status": "clean", "reason": "no added WUs"}, "open_questions_human_only": {"status": "clean", "reason": "terminal gate: no drafted successor"}, "plan_next_lint": {"status": "clean", "reason": "plan-next lint: no findings"}}}} {"timestamp": "2026-11-26T13:43:02.496391+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "followups_recorded", "source": "driver", "source_version": "0.33.2", "payload": {"filed": 2, "unfiled": 0, "already_tracked": 0, "issue_numbers": ["3608", "3609"], "written_back": ["FOLLOW-UPS.md"]}} {"timestamp": "2026-11-26T13:51:06.744598+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "driver_build_pinned", "source": "driver", "source_version": "0.33.2", "payload": {"tree": "b2513b4b90ea629561419494ccfffdd53b5055e5", "path": "/private/var/folders/zc/rgq11x850d78dx_kf1fd4vx80000gn/T/specfuse-pins/b2513b4b90ea629561419494ccfffdd53b5055e5/specfuse/loop"}} +{"timestamp": "2026-11-26T13:59:19.221960+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "broad_run_result", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "tree": "07bbf72d1e7af3c1a03af605f40e5563dc3a18db:0ec7c6da6e74f0b56753f09657b654a6d289b91b:12064a6191eeb830a9826d911a8543fbaba3da75:27968248a450a842ccd187b7dce0fb0ded934866:287efde8f90320baffac08f5f3287b9456a65cb9:2e29b2f7e073a0cbe290f01d3b397e1cdd10c81c:42796ea0e0a6c03811b0e4bc9dbd3b5ee62dd2e4:4acc6dfc5e8cece358c167d876515eba4a39a500:834d9d9c16094a386cd9b5a6f9ced9a3a9b4e7fb:a90788bb48ee6cdb0fa8b0f867c80a4643acd35d:bbd1aea514612d76722a18c7aece7c767cf1a076:c23b62e87f1ae3890c6f9e3d8c7ca7ec9225ed81:cab62f76bd04445beb1bf0786c2ee8df617496bb:caffe2d63ceacde448842a91bc7a12c206a67523:d74b7d113b844e84f0009098f576fd28477f072d:e1aa20b9c08a5ebe036da74f16e28c751f18f6fa:e3b0de29b81a6c8e0abeacb3898519b98014b9ef:f52cfa168d3517ad5d14d0c2b706e13ec571268e:fa2f4f88657587b6e3b560977858810846b1d366", "ok": true, "failing": []}} +{"timestamp": "2026-11-26T13:59:19.222005+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "tests", "ok": true, "skipped": false, "duration_seconds": 450.393, "phase": "broad"}} +{"timestamp": "2026-11-26T13:59:19.222009+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "lint", "ok": true, "skipped": false, "duration_seconds": 0.069, "phase": "broad"}} +{"timestamp": "2026-11-26T13:59:19.222011+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "security", "ok": true, "skipped": false, "duration_seconds": 1.69, "phase": "broad"}} +{"timestamp": "2026-11-26T13:59:19.222013+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "coverage", "ok": true, "skipped": false, "duration_seconds": 1.3, "phase": "broad"}} +{"timestamp": "2026-11-26T13:59:19.222021+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "leak-scan", "ok": true, "skipped": false, "duration_seconds": 18.877, "phase": "broad"}} +{"timestamp": "2026-11-26T13:59:19.222023+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "changelog-fragments", "ok": true, "skipped": false, "duration_seconds": 0.071, "phase": "broad"}} +{"timestamp": "2026-11-26T13:59:19.222025+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "agent-policy-example-lint", "ok": true, "skipped": false, "duration_seconds": 0.12, "phase": "broad"}} +{"timestamp": "2026-11-26T13:59:19.222027+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "event-type-gate", "ok": true, "skipped": false, "duration_seconds": 0.174, "phase": "broad"}} +{"timestamp": "2026-11-26T13:59:19.222028+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "roadmap-link-gate", "ok": true, "skipped": false, "duration_seconds": 0.056, "phase": "broad"}} +{"timestamp": "2026-11-26T13:59:19.222029+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "arm-sweep-gate", "ok": true, "skipped": false, "duration_seconds": 0.426, "phase": "broad"}} +{"timestamp": "2026-11-26T13:59:19.222030+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "monitoring-example-lint", "ok": true, "skipped": false, "duration_seconds": 0.055, "phase": "broad"}} +{"timestamp": "2026-11-26T13:59:19.222033+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "leak-scan-hook", "ok": true, "skipped": false, "duration_seconds": 0.9, "phase": "broad"}} +{"timestamp": "2026-11-26T13:59:19.222039+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "pre-push-hook", "ok": true, "skipped": false, "duration_seconds": 3.505, "phase": "broad"}} +{"timestamp": "2026-11-26T13:59:19.222041+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "sync-scaffold-bats", "ok": true, "skipped": false, "duration_seconds": 11.327, "phase": "broad"}} +{"timestamp": "2026-11-26T13:59:19.222043+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "sync-scaffold-symlinks-bats", "ok": true, "skipped": false, "duration_seconds": 1.737, "phase": "broad"}} +{"timestamp": "2026-11-26T13:59:19.222044+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "init-sh-shim-bats", "ok": true, "skipped": false, "duration_seconds": 0.867, "phase": "broad"}} +{"timestamp": "2026-11-26T13:59:19.222045+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "init-skills-bats", "ok": true, "skipped": false, "duration_seconds": 0.135, "phase": "broad"}} +{"timestamp": "2026-11-26T13:59:19.222047+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "hookspath-conflict-bats", "ok": true, "skipped": false, "duration_seconds": 0.596, "phase": "broad"}} From 6176256e444cd346300a39dce3bb35ea25eebc76 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 09:03:38 -0500 Subject: [PATCH 25/69] =?UTF-8?q?feat:=20G1-CLOSE=20=E2=80=94=20terminal?= =?UTF-8?q?=20close?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Feature: FEAT-LOOP-2026-0251/G1-CLOSE --- .../FOLLOW-UPS.md | 126 ++++++----- .../LEARNINGS-pending.md | 10 +- .../PROGRESS.md | 2 + .../RETROSPECTIVE.md | 203 +++++++++++------- .../WU-90-gate-1-close.md | 27 +-- .../events.jsonl | 2 + ...he-produces-not-in-diff-deliverable-mis.md | 2 +- 7 files changed, 224 insertions(+), 148 deletions(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md index 17bef352..ef77c82c 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md @@ -1,64 +1,78 @@ # Follow-ups — FEAT-LOOP-2026-0251 -### An early refusal records a different outcome from the late order for one input +Re-close, 2026-11-26. One entry is open. The two entries from the first close are listed +under "Resolved"; both re-run conditions now hold. -**Tracked as #3608.** +### The early refusal also outranks three other checks, and no precedence is stated for them **Criterion (verbatim).** "A surviving skip, or an early refusal whose outcome or failure -class differs from the late one for the same input: record `not_met` with a follow-up." - -**Evidence.** A probe drove `loop.run()` with a unit declaring `src/rule.py`, an attempt -writing only `docs/notes.md`, a RESULT listing both under `files_changed`, and green gates. -With `fail_fast_deliverables: true` the first `attempt_outcome` is `produces_not_in_diff` -(class `produces_not_in_diff`, 0 verify calls). With `false` it is `files_changed_mismatch` -(class `files_changed_mismatch`, 1 verify call). The control with a plain RESULT gives -`produces_not_in_diff` both ways. `tests/test_files_changed_auto_repair.py`, -`test_untouched_deliverable_still_refuses`, had its expected outcome changed to match. - -**What happened, in plain terms.** The attempt is refused both ways. Only the name of the -refusal, and so the retry advice, differs. `PLAN.md` says the feature does not change what -is refused, only when, and that `files_changed_mismatch` stays where it is. It does not say -which refusal wins when both apply. The close cannot settle that. +class differs from the late one for the same input, other than the deliverable-over- +`files_changed_mismatch` precedence `GATE-01.md` states (#3608): record `not_met` with a +follow-up." + +**Evidence.** A probe drove `loop.run()` with the key `true` and then `false`. Each input +leaves a deliverable refusal in place and also trips a second check. Each cell is outcome / +failure class. The unit declares `src/rule.py`. + +| Input | `true` | `false` | +|---|---|---| +| D: failing smoke-import line, `src/rule.py` untouched | `produces_not_in_diff` / `produces_not_in_diff` | `smoke_import_failed` / `smoke_import_failed` | +| E: produced `.md` with a `BLOCKED` verdict heading, `src/rule.py` untouched | `produces_not_in_diff` / `produces_not_in_diff` | `failed` / `guard_refusal` | +| F: `close` unit, `src/rule.py` untouched | `produces_not_in_diff` / `produces_not_in_diff` | `closing_deliverable_missing` / `guard_refusal` | +| G: failing smoke-import line, `src/rule.py` emptied | `deliverable_missing` / `guard_refusal` | `smoke_import_failed` / `smoke_import_failed` | + +Controls: with every declared path changed and the key `true`, the D unit still gets +`smoke_import_failed` and the E unit still gets `failed` / `guard_refusal`. Details are in +`RETROSPECTIVE.md` under "Early against late, same input". + +**What happened, in plain terms.** Every one of these attempts is still refused. Only the +name of the refusal, and so the retry advice, differs. The deliverable check now runs first, +so it wins over every check that used to run before it. The amendment after the first close +named just one of those checks. The first close had mentioned the others only as something +read in the code. The close cannot choose the precedence itself, and its instructions tell +it to record this. + +One side effect comes from reading the code and was not measured. The old smoke-import and +closing-deliverable refusals always reset the working tree. The early refusal keeps it by +default. So in D, F and G the next attempt likely starts from a different tree. + +**Why it was not fixed automatically.** The close may not edit source, the gate's definition +of done or the close unit. **Options.** -1. Accept the new precedence and state it in the definition of done and the docs. For: no - code change; no gate run is paid; the retry note names the missing deliverable. Against: - the RESULT's false `files_changed` claim is not reported on that attempt. -2. Skip the early refusal when the RESULT's `files_changed` would trip the mismatch guard. - For: outcomes match the old order. Against: code and tests change, and those attempts pay - for a full gate run again. - -**Recommendation.** Option 1. - -**Re-run condition.** Either `GATE-01.md` and the close unit state that a deliverable -refusal takes precedence over `files_changed_mismatch`, or case A records the same outcome -and failure class with the key `true` and `false`, asserted by a test. - -### Clause 6 does not hold literally for two pre-existing tests - -**Tracked as #3609.** - -**Criterion (verbatim).** "**Nothing else changes.** Every existing test of the three -guards passes unchanged, apart from assertions on the order of `verify` and the guard, which -are updated and named in the close." - -**Evidence.** A `diff` of `tests/` against a snapshot of public `main` shows two edits that -are not about order. `test_deterministic_refusal_repeat` moved a source-text anchor to -`if not deliv_ok:`, because the emit call moved into a shared helper. -`test_produces_shape` changed two filters from `directory` to -`assert_declared_deliverables`, because the new lint WARN contains "directory". All ten -changed modules pass (68 tests, exit 0). Neither edit removes an assertion. - -**Options.** - -1. Widen the clause to allow edits forced by a refactor or by new lint wording. For: matches - what was built, with no code change. Against: the clause is relaxed after the fact. -2. Restore both tests unchanged. For: the clause holds as written. Against: the WARN must be - reworded and the driver's emit call moved back to each call site, which duplicates code - the gate's arming discipline says to share. - -**Recommendation.** Option 1. - -**Re-run condition.** `GATE-01.md` clause 6 covers these two kinds of edit, or both test -files match their pre-feature text and pass. +1. State one general rule: a deliverable refusal takes precedence over every check that + runs after the agent session (the verification gates and the later guards), and says so + in `GATE-01.md`, the close unit's trigger and `docs/methodology.md`. For: no code change; + matches what was built; covers checks nobody has listed. Against: on such an attempt the + other problem is reported only on a later attempt, after the deliverable is fixed. It + relaxes the plan after the fact, and costs one more close. +2. Run the cheap later checks (blocked verdict, smoke-import) before the early refusal. For: + those outcomes match the old order. Against: smoke-import runs commands from the unit + body and the closing guards expect a squashed commit, so this is real code and test work; + `PLAN.md` decision 4 says those guards stay where they are. +3. Accept the `not_met` and merge by hand. For: no further loop spend. Against: the record + keeps a failed gate for a difference in labelling. + +**Recommendation.** Option 1. It states the rule once instead of one guard per re-close. + +**Re-run condition.** Either `GATE-01.md` and the close unit's escalation trigger both state +a precedence that covers cases D to G, or each of D to G records the same outcome and +failure class with the key `true` and `false`, asserted by a test. + +## Resolved + +#### An early refusal records a different outcome from the late order for one input + +**Tracked as #3608.** **Re-run condition holds.** `GATE-01.md` ("Precedence when two +refusals apply") and the close unit's escalation trigger state that the deliverable refusal +takes precedence over `files_changed_mismatch`. +`test_deliverable_refusal_outranks_files_changed_mismatch` asserts both sides and passed in +this session; the probe's case A agrees. + +#### Clause 6 does not hold literally for two pre-existing tests + +**Tracked as #3609.** **Re-run condition holds.** `GATE-01.md` clause 6, widened on +2026-11-26, covers edits forced by moving code into a shared helper and by new lint wording. +The ten changed modules pass (68 tests, exit 0), and the two edits are named in +`RETROSPECTIVE.md`. diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/LEARNINGS-pending.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/LEARNINGS-pending.md index 2b2f26f9..8e7adadb 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/LEARNINGS-pending.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/LEARNINGS-pending.md @@ -11,10 +11,12 @@ Licensed under the Apache License, Version 2.0. See LICENSE. ## Entries - [FEAT-LOOP-2026-0251/T01] **A unit that moves a guard earlier must state which refusal wins - when two apply, for every guard it now runs ahead of.** "Change only when, not what" is - not satisfiable on its own: moving `produces_not_in_diff` before `verify()` also moved it - ahead of `files_changed_mismatch`, which changed the recorded outcome for an input both - guards refuse. List the overtaken guards and the intended precedence in the plan. + when two apply, for every check it now runs ahead of.** Moving `produces_not_in_diff` + before `verify()` also moved it ahead of `files_changed_mismatch`, the blocked-verdict + check, the smoke-import check and the closing-deliverable guards. The plan named none. The + amendment after the first close named one, and the re-close failed on the others. List + every overtaken check, probe each one early against late, and put the whole list in one + follow-up; a "read in the code" aside does not reach the operator's decision. - [FEAT-LOOP-2026-0251/T04] **A unit that adds a lint message must run every test module that lints, not only the ones its Verification section names.** Existing tests filtered diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md index 5477e43d..599ee91a 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md @@ -6,3 +6,5 @@ - **FEAT-LOOP-2026-0251/T04**: Added the WARN check `check_produces_mentioned` to `specfuse lint`, replaced the skipped `TestArmTimeWarning` with real tests, and documented the early refusal order in docs/methodology.md. - **FEAT-LOOP-2026-0251/G1-CLOSE**: Wrote the terminal close (retrospective, two follow-ups, two staged lessons, four changelog fragments) with advisory verdict not_met, because one input gets a different early and late refusal outcome and two pre-existing test edits are not order assertions. - note: Operator must decide whether a deliverable refusal takes precedence over files_changed_mismatch (see FOLLOW-UPS.md) and acknowledge the four consumer-visible changes. +- **FEAT-LOOP-2026-0251/G1-CLOSE**: Re-ran the terminal close with advisory verdict not_met, because probes show the early deliverable refusal also yields a different outcome or failure class than the late order for smoke-import, blocked-verdict and closing-deliverable inputs, which the stated files_changed_mismatch precedence does not cover. + - note: The operator must decide the one open FOLLOW-UPS.md entry (recommended: one general precedence rule in GATE-01.md, the close trigger and docs/methodology.md) and acknowledge the four consumer-visible changes; the re-run conditions for diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/RETROSPECTIVE.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/RETROSPECTIVE.md index 2168f00b..b80406cb 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/RETROSPECTIVE.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/RETROSPECTIVE.md @@ -4,15 +4,11 @@ ## Verdict -`not_met` (advisory; the judge concludes). The early refusals work and every oracle is green. -Two things do not hold as written: - -1. For one input, the early refusal records a different outcome and failure class than the - late order records. This is the close unit's escalation trigger. -2. Two edits to pre-existing tests are not assertions on the order of verify and guard, so - clause 6 does not hold literally. - -Both may be acceptable as designed. That is an operator decision, and `FOLLOW-UPS.md` states it. +`not_met` (advisory; the judge concludes). This is the second close of the gate. The two +`not_met` findings of the first close (#3608, #3609) are settled by the operator's amendment +to the definition of done. The close unit's escalation trigger still fires on inputs the +amendment does not name: four probed inputs get a different early and late refusal outcome, +and none of them involves `files_changed_mismatch`. `FOLLOW-UPS.md` states the decision. ## Measurements @@ -21,57 +17,91 @@ All commands ran fresh in this session on the working tree. Runs that drive `loo ### feature_oracle: PASS -`python3 -m unittest tests.test_fail_fast_deliverables -v -b`: exit 0, `Ran 29 tests`, `OK`, -no skips. `grep -c "unittest.skip" tests/test_fail_fast_deliverables.py` prints `0`, and a -search for `skipIf`, `skipUnless`, `skipTest` and `@skip` in that file finds nothing. +`python3 -m unittest tests.test_fail_fast_deliverables -v -b`: exit 0, `Ran 30 tests`, `OK`, +no skips. `grep -c "unittest.skip" tests/test_fail_fast_deliverables.py` prints `0`. A search +of that file for `unittest.skip`, `skipIf`, `skipUnless`, `skipTest` and `@skip` finds nothing. ### Other oracles | Check | Result | |---|---| -| `python3 -m unittest tests.test_dispatch_skeleton tests.test_gate_timings -b` | 25 tests, OK | -| `python3 -m unittest tests.test_lint_plan -b` (named by T04) | **error: no such module** (`ModuleNotFoundError`) | -| the six `tests/test_lint_plan*.py` modules that do exist | 46 tests, OK | -| the ten changed pre-existing test modules | 68 tests, OK | +| `python3 -m unittest tests.test_dispatch_skeleton tests.test_gate_timings -b` | exit 0, 25 tests | +| `python3 -m unittest tests.test_lint_plan -b` (named by T04) | **error: no such module** | +| the six `tests/test_lint_plan*.py` modules that do exist | exit 0, 46 tests | +| the ten changed pre-existing test modules | exit 0, 68 tests | | `.specfuse/scripts/lint_plan.py` over every feature folder with a `PLAN.md` | 97 linted, 0 non-zero exits | -| `diff` of `verification.yml.example` against its packaged copy | empty | -| `diff docs/methodology.md specfuse/loop/data/docs/methodology.md` | empty | +| `diff` of `verification.yml.example` against its packaged copy | exit 0, empty | +| `diff docs/methodology.md specfuse/loop/data/docs/methodology.md` | exit 0, empty | | `python3 -m specfuse.loop.changelog_fragments check` | exit 0 | -The full suite and coverage were not re-run by this session. The driver's broad run at -2026-11-26T13:36:49Z recorded `ok: true`; its tests log shows `Ran 5143 tests`, -`OK (skipped=4)`, and its coverage log shows 92% total. +This session did not run the full suite or coverage. The driver's broad run recorded at +2026-11-26T13:59:19Z has `ok: true` and no failing gate. The newest tests log in +`work/gate-logs/` (stamp `20261126T135837`) shows `Ran 5144 tests`, `OK (skipped=4)`. The +coverage log of the same run shows 92% total. ### Mutation control -With `resolve_fail_fast_deliverables` forced to return `False`, 12 of the 29 oracle tests -fail, with no errors. They are in `TestProducesNotInDiffEarly` (2), `TestPresenceEarly` (3), -`TestOptOut` (4, including the resolver's own default test), `TestTreeAndNote` (2) and +With `resolve_fail_fast_deliverables` forced to return `False`, 13 of the 30 oracle tests +fail, with no errors: `TestOptOut` (4, including the resolver's own default test), +`TestPresenceEarly` (3), `TestProducesNotInDiffEarly` (3), `TestTreeAndNote` (2) and `TestEarlyRefusalRecovery` (1). So these classes observe the new order. -`TestArmTimeWarning` calls `check_produces_mentioned`, which does not exist on `main`. -No unit's "fails on HEAD" claim was re-run against a pre-feature tree. +`TestArmTimeWarning` was not part of this control. No unit's "fails on HEAD" claim was +re-run against a pre-feature tree. ### Early against late, same input A throwaway probe drove `loop.run()` over the oracle's fixture and read the first -`attempt_outcome` for T01. The unit declares `src/rule.py`; the attempt writes only -`docs/notes.md`. - -| Case | `fail_fast` true | `fail_fast` false | Same | -|---|---|---|---| -| A: RESULT lists `src/rule.py` in `files_changed`, gates green | `produces_not_in_diff` / `produces_not_in_diff`, 0 verify calls | `files_changed_mismatch` / `files_changed_mismatch`, 1 call | **no** | -| B: plain RESULT, gates red | `produces_not_in_diff`, 0 calls | `failed` / `other`, 1 call | no (see below) | -| C: control, plain RESULT, gates green | `produces_not_in_diff`, 0 calls | `produces_not_in_diff`, 1 call | yes | - -B follows from the feature's purpose: a gate that never runs cannot report a failure. -A does not follow from it. `files_changed_mismatch` needs no gate result, and `PLAN.md` -decision 4 says that guard stays where it is. The early produces check now pre-empts it. -The pre-existing test `test_untouched_deliverable_still_refuses` shows the same change. +`attempt_outcome` for T01, once with `fail_fast_deliverables` `true` and once `false`. +Verification is a stub. The unit declares `src/rule.py`. Unless the row says otherwise, the +attempt writes only `docs/notes.md`, the RESULT is plain and the stub passes. Each cell is +outcome / failure class. Every `true` run had `verify_seconds: 0`. -By reading the code only, not measured: the early check also runs before the smoke-import -guard, the closing-deliverable guards and the produced-verdict contradiction check. An -attempt that would trip one of those and also misses a deliverable is now reported as the -deliverable refusal. +| Case | `true` | `false` | Same | Named precedence | +|---|---|---|---|---| +| A: RESULT claims `src/rule.py` in `files_changed` | `produces_not_in_diff` / `produces_not_in_diff` | `files_changed_mismatch` / `files_changed_mismatch` | no | yes (#3608) | +| B: the verify stub fails | `produces_not_in_diff` / `produces_not_in_diff` | `failed` / `other` | no | no | +| C: control | `produces_not_in_diff` / `produces_not_in_diff` | same | yes | — | +| D: unit body has a failing smoke-import line | `produces_not_in_diff` / `produces_not_in_diff` | `smoke_import_failed` / `smoke_import_failed` | **no** | **no** | +| E: also declares `docs/report.md`; attempt writes it with a `BLOCKED` verdict heading | `produces_not_in_diff` / `produces_not_in_diff` | `failed` / `guard_refusal` | **no** | **no** | +| F: the same unit typed `close` | `produces_not_in_diff` / `produces_not_in_diff` | `closing_deliverable_missing` / `guard_refusal` | **no** | **no** | +| G: attempt empties `src/rule.py`; failing smoke-import line | `deliverable_missing` / `guard_refusal` | `smoke_import_failed` / `smoke_import_failed` | **no** | **no** | + +Positive controls with `fail_fast` `true` and every declared path changed: the D unit gets +`smoke_import_failed`, and the E unit gets `failed` / `guard_refusal`. So the second check +in D and E fires on its own. F has no separate control; its `false` run shows the closing +guard firing. F needs a `close` unit that declares `produces:`. + +A, D, E, F and G are each refused under both orders. Only the reported refusal differs. +B is not a second refusal guard: a gate that never runs cannot report a failure, which is +what the feature is for. D to G each trip two refusals. `GATE-01.md` limits clause 3 to +inputs that trip one, so clause 3 is not contradicted. The same file names a precedence only +over `files_changed_mismatch`, and the close unit's trigger exempts only that one. + +Read in `loop.py`, not measured: the late smoke-import and closing-deliverable refusals call +`reset_preserving_events` without consulting `retain_on_guard_refusal`. The early refusal +follows that key, which defaults to keeping the tree. So for D, F and G the tree handling +should differ too. + +### Per-criterion results + +All 13 criteria were re-measured. `GATE-01-CRITERIA.md` is left as the driver seeded it, +because it is not one of this unit's permitted closing surfaces. + +| Criterion | Result | Evidence | +|---|---|---| +| T01#1 | passes now | `TestProducesNotInDiffEarly`, in the oracle run; "fails on HEAD" not re-run | +| T01#2 | passes | `test_early_record_equals_late_record` (plain RESULT, passing stub) | +| T01#3 | passes | 25 tests, exit 0 | +| T02#1 | passes now | `TestPresenceEarly`; "fails on HEAD" not re-run | +| T02#2 | passes now | `TestOptOut`; "fails on HEAD" not re-run | +| T02#3 | passes | empty diff | +| T03#1 | passes now | `TestTreeAndNote`; "fails on HEAD" not re-run | +| T03#2 | passes | `test_list_is_capped_at_twenty` | +| T04#1 | passes now | `TestArmTimeWarning`; "fails on HEAD" not re-run | +| T04#2 | passes with the repository script | 97 folders, 0 non-zero exits; the installed `specfuse` command was not used | +| T04#3 | not observed | this session did not see T04's RESULT; the count is re-measured below | +| T04#4 | passes | empty diff | +| T04#5 | passes | prints `0` | carried forward: 0 criteria, re-measured: 13 @@ -79,28 +109,32 @@ carried forward: 0 criteria, re-measured: 13 | Clause | Proven | By | |---|---|---| -| 1. `produces_not_in_diff` early | Refused with 0 `verify_fn` calls, `verify_seconds` 0, no attempt-phase `gate_result`; a changed path verifies once and passes; a justified path still verifies; class, signature and summary equal the late site's | `TestProducesNotInDiffEarly` (5 tests). Case A above is an input where the late order never reaches that late site | -| 2. Presence early | Absent, empty and bookkeeping-only diffs are refused with 0 calls | `TestPresenceEarly` | -| 3. Opt-out | With the key `false`, each of the three cases verifies once; outcome, class, signature and summary equal the default's | `TestOptOut`, on plain-RESULT, green-gate inputs only | -| 4. Tree and note | Note says verification did not run and lists changed paths or says none; cap of 20 plus a count; tree kept or reset | `TestTreeAndNote`. The kept/reset assertions use `produces_not_in_diff` only; no test asserts tree handling for an early presence refusal | -| 5. Arm-time WARN | Warns on an unmentioned path; silent on full path, file name or parent directory, and on `done` / `abandoned`; `lint()` calls it | `TestArmTimeWarning` | -| 6. Nothing else changes | **Not literally.** See the list below | diff of `tests/` against a snapshot of public `main`, fetched this session | - -Three review fixes made before this close, outside any work unit, are covered by -`TestEarlyRefusalRecovery` (re-plan still fires; uncommitted tracked edits count as a moved -tree; an untouched tree still halts) and `TestEarlyRetainedNoteWording`. +| 1. `produces_not_in_diff` early | Refused with 0 `verify_fn` calls, `verify_seconds` 0, no attempt-phase `gate_result`; a changed path verifies once and passes; a justified path still verifies; class, signature and summary equal the late site's | `TestProducesNotInDiffEarly` (6 tests) | +| 2. Presence early | Absent, empty and bookkeeping-only diffs are refused with 0 calls | `TestPresenceEarly` (3) | +| 3. Opt-out | With the key `false`, each of the three cases verifies once; outcome, class, signature and summary equal the default's, for inputs that trip one refusal | `TestOptOut` (4), on plain-RESULT, passing-stub inputs | +| 4. Tree and note | Note says verification did not run and lists changed paths or says none; cap of 20 plus a count; tree kept or reset | `TestTreeAndNote` (6). The kept/reset assertions use `produces_not_in_diff` only; no test asserts tree handling for an early presence refusal | +| 5. Arm-time WARN | Warns on an unmentioned path; silent on full path, file name or parent directory, and on `done` / `abandoned`; `lint()` calls it | `TestArmTimeWarning` (6) | +| 6. Nothing else changes | Holds as widened for #3609. See the list below | `diff -ru` of `tests/` against the recorded base; the ten modules pass | +| Precedence over `files_changed_mismatch` | Both sides asserted | `test_deliverable_refusal_outranks_files_changed_mismatch`; probe case A | + +Three review fixes made before the first close, outside any work unit, are covered by +`TestEarlyRefusalRecovery` (3: re-plan still fires; uncommitted tracked edits count as a +moved tree; an untouched tree still halts) and `TestEarlyRetainedNoteWording` (2). ## Pre-existing tests changed -The comparison is against `main` as fetched during this close, not against the recorded -merge base, because this session runs no git command. Besides the new oracle file, ten -test modules differ. +Compared against the public tarball of `a89373d119f8e2d8003a8956dbd4bd27dde8057f`, the +merge base recorded on the first close's `judged` event, and against public `main` as +fetched in this session. No git command was run. Against `main`, besides the new oracle +file, exactly ten test modules differ. Against the older base the same ten differ; three +further test files absent from that base are identical to `main`. The `.claude` directory +under `tests/` was left out of the comparison. Changed because of the order of verify and guard: | Test module | Change | Why | |---|---|---| -| `test_files_changed_auto_repair` | `test_untouched_deliverable_still_refuses` now expects `produces_not_in_diff`, not `files_changed_mismatch` | The early check pre-empts the post-verify guard. This changes the expected **outcome**, not only the order (case A) | +| `test_files_changed_auto_repair` | `test_untouched_deliverable_still_refuses` now expects `produces_not_in_diff`, not `files_changed_mismatch`, and reads `payload["remaining"]` | The early check pre-empts the post-verify guard. The expected outcome changed; this is the stated precedence (#3608) | | `test_guard_repair_e2e` | Patches `early_produces_refusal` to return `None` in one test | The absent `src/extra.py` would be refused early, so the guard under test would never run. The test now exercises the late order only | | `test_arm_wiring` | Two dispatch stubs wrapped in `with_deliverable` | The stubs wrote nothing and relied on `verify` failing first | | `test_loop_files_changed_guard` | One stub wrapped in `with_deliverable` | Same: it must get past the presence refusal to reach `verify` | @@ -109,12 +143,12 @@ Changed because of the order of verify and guard: | `test_replan_note_collision` | Stub wrapped in `with_deliverable` | Same | | `test_replan_trigger` | One stub writes `deliverable.txt`; one comment rewritten | Attempts must reach `verify`; the comment's claim that the re-plan trigger is never consulted became false | -Not an assertion on order: +Forced by the shared helper or the new lint wording (the widened clause 6): | Test module | Change | Why | |---|---|---| -| `test_deterministic_refusal_repeat` | The source-text anchor moved from `"deliverable_missing",` to `if not deliv_ok:` | The emit call moved into the shared `refuse_deliverable_missing` helper. The two assertions are unchanged. They cover the late branch only | -| `test_produces_shape` | Two negative tests filter findings on `assert_declared_deliverables`, not `directory` | The new WARN text contains "directory". The shape check's ERROR still carries the new marker, so the filter can still catch it | +| `test_deterministic_refusal_repeat` | The source-text anchor moved from `"deliverable_missing",` to `if not deliv_ok:` | The emit call moved into the shared `refuse_deliverable_missing` helper. Both assertions are unchanged. They cover the late branch only | +| `test_produces_shape` | Two negative tests filter findings on `assert_declared_deliverables`, not `directory` | The new WARN text contains "directory". `lint_plan.py` puts the new marker in the shape ERROR, and the two positive tests are unchanged, so the negative tests still catch a shape ERROR on a file or glob | ## What happened @@ -126,6 +160,13 @@ The terminal judge-editing stop then fired, as `GATE-01.md` expected. An indepen found three behaviour changes, fixed test-first on the branch, and the operator acknowledged the judge edits and re-armed this unit. +The first close (2026-11-26T13:42Z) and the judge both recorded `not_met`, and the driver +filed #3608 and #3609. The operator amended `GATE-01.md` for both (precedence over +`files_changed_mismatch`; a wider clause 6), added a test for the precedence, and re-armed +this unit. The first close had noted the other overtaken checks from reading the code but +did not probe them or put them in a follow-up entry, so the amendment named only one. This +close probed them (cases D to G). + T04 passed although its Verification section names `tests.test_lint_plan`, which does not exist. @@ -140,14 +181,17 @@ Unit costs are from the `task_completed` events in `events.jsonl`. | T03 | 1.00 | 0.55 | 55% | 1 | | T04 | 1.50 | 0.47 | 32% | 1 | | Substantive total | 6.00 | 2.67 | 45% | 4 | -| G1-CLOSE | 5.00 | not yet recorded | — | in progress | +| G1-CLOSE, first close | 5.00 | 1.69 | 34% | 1 | +| G1-CLOSE, this re-close | (same plan line) | not yet recorded | — | in progress | -The plan total is 11.00 and the gate budget 14.00. The close's own cost and the judge's are -written after this session. The earlier `blocked_human` stop of this unit recorded 0.00. -The review and its fixes happened outside the loop, so `events.jsonl` has no cost for them. +Recorded unit spend is 4.37 USD. The first close's `judged` event also records a judge cost +of 0.44 USD; the events do not say whether the close's 1.69 includes it. The plan total is +11.00 and the gate budget 14.00. This session's cost and its judge's are written later. The +earlier `blocked_human` stop of this unit recorded 0.00. The review, its fixes and the +amendment happened outside the loop, so `events.jsonl` has no cost for them. **T04's warning rate.** Re-measured this session over `done` units with `produces:`: the -shipped rule (path, file name or parent directory) would fire on 35 of 402, **8.7%**, under +shipped rule (path, file name or parent directory) would fire on 35 of 402, **8.7%** (same as the first close), under the 10% limit. Path or file name alone would fire on 81 of 402, 20.1%. T04 recorded 81 and 35 of 401 in the check's docstring; the population has since grown by one. T04's progress note does not carry the count that its criterion 3 asked for in the RESULT notes, and this @@ -158,10 +202,12 @@ paths. ## Consumer-visible contract changes Pending human acknowledgment. Each has a `changelog.d/` fragment tracing to -`FEAT-LOOP-2026-0251`. +`FEAT-LOOP-2026-0251`. This re-close added no fragment; it extended the first one in place +with the overtaken checks measured in cases D to G. 1. **Changed:** the three deliverable refusals run before verification. An attempt that - would also have failed a gate or `files_changed_mismatch` is reported as the deliverable + would also have failed a gate, `files_changed_mismatch`, the smoke-import check, a + closing-deliverable guard or the blocked-verdict check is reported as the deliverable refusal. 2. **Added:** `defaults.fail_fast_deliverables`, default `true`. 3. **Changed:** the retry note for the three refusals lists the changed paths, at most 20 @@ -173,13 +219,22 @@ Pending human acknowledgment. Each has a `changelog.d/` fragment tracing to - **A real project whose gates write a declared deliverable.** The opt-out is tested only with stubs. With the default, such a unit is refused early on every attempt. - **Real refused attempts on the new build.** T01 to T04 ran on a build pinned before the - change (`bd7e508`). `events.jsonl` shows later pins (`cddc418`, `eb30755`), and this - close was dispatched after the last one, so "every attempt ran on the old build" is not - established for the close. No event in this feature shows a real early refusal, so no - real saving in gate time is measured. + change (`bd7e508`). `events.jsonl` shows three later pins (`cddc418`, `eb30755`, + `b2513b4`), and both closes were dispatched after a later pin, so "every attempt ran on + the old build" holds for T01 to T04 and is not established for the closes. No event in + this feature shows a real early refusal, so no real saving in gate time is measured. - Tree handling for early `deliverable_missing` and `no_deliverable_files` refusals. -- The precedence over the smoke-import, closing-deliverable and contradiction checks. +- Tree handling in probe cases D, F and G; the difference stated above is from the code. +- The probe used a stubbed `verify`. `no_deliverable_files` was not paired with any + overtaken check. +- That cases A to G are the whole list of overtaken checks. The list comes from reading + `execute_unit_attempt()` and the post-squash guards in `run()`; a squash-commit failure, + for one, was not probed. +- Any unit's "fails on HEAD" claim, against a pre-feature tree. - Whether the pending-diff computation matches the squash diff for renames, submodules or ignored files. Only the oracle's simple cases were run. -- `specfuse lint` as the installed command. The pipx build differs from this tree, so the - repository scripts were used. +- `specfuse lint` as the installed command. The installed build differs from this tree, so + the repository scripts were used. +- `docs/methodology.md` states the early order but names no precedence; this unit may not + edit it. Its line "What is refused does not change, only when" was not checked beyond + the probe cases. diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md index 7fdb7e58..bdb36742 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md @@ -1,8 +1,9 @@ --- id: FEAT-LOOP-2026-0251/G1-CLOSE type: close -status: pending -attempts: 0 +verdict: not_met +status: done +attempts: 1 oracle_env: macos_local planned_cost_usd: 5.00 auto_close_disabled: true @@ -32,19 +33,19 @@ re_arm_history: prior_cost_usd: 1.69295 prior_duration_seconds: 291.43 reason: "A for both, go ahead" -cumulative_cost_usd: 0.0 -cumulative_duration_seconds: 0.0 -cumulative_input_tokens: 0 -cumulative_output_tokens: 0 -cumulative_attempts: 0 -cost_usd: 1.69295 -duration_seconds: 291.43 -input_tokens: 70 -output_tokens: 36654 -folded_through_re_arm: 1 +cumulative_cost_usd: 1.69295 +cumulative_duration_seconds: 291.43 +cumulative_input_tokens: 70 +cumulative_output_tokens: 36654 +cumulative_attempts: 1 +cost_usd: 1.009056 +duration_seconds: 259.427 +input_tokens: 36 +output_tokens: 27277 +folded_through_re_arm: 2 gate_set: plannext driver_version: 0.33.2 -started_at: 2026-11-26T13:36:49.213745+00:00 +started_at: 2026-11-26T13:59:19.394548+00:00 --- # G1-CLOSE — terminal close diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index b2f89891..9271af1d 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -146,3 +146,5 @@ {"timestamp": "2026-11-26T13:59:19.222044+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "init-sh-shim-bats", "ok": true, "skipped": false, "duration_seconds": 0.867, "phase": "broad"}} {"timestamp": "2026-11-26T13:59:19.222045+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "init-skills-bats", "ok": true, "skipped": false, "duration_seconds": 0.135, "phase": "broad"}} {"timestamp": "2026-11-26T13:59:19.222047+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "hookspath-conflict-bats", "ok": true, "skipped": false, "duration_seconds": 0.596, "phase": "broad"}} +{"timestamp": "2026-11-26T13:59:19.293600+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "terminal_judge_editing_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "status": "clean", "reason": "acknowledged by operator: .specfuse/verification.yml.example, produces_driver_helper, specfuse/loop/data/verification.yml.example, specfuse/loop/lint_plan.py, specfuse/loop/loop.py"}} +{"timestamp": "2026-11-26T13:59:19.296802+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "terminal_judge_editing_acknowledged", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "close_unit": "FEAT-LOOP-2026-0251/G1-CLOSE", "paths": [".specfuse/verification.yml.example", "produces_driver_helper", "specfuse/loop/data/verification.yml.example", "specfuse/loop/lint_plan.py", "specfuse/loop/loop.py"], "reason": "Review fixes tested, full suite green, accept the generator risk"}} diff --git a/changelog.d/FEAT-LOOP-2026-0251-the-produces-not-in-diff-deliverable-mis.md b/changelog.d/FEAT-LOOP-2026-0251-the-produces-not-in-diff-deliverable-mis.md index 97b6728e..a4dc88fa 100644 --- a/changelog.d/FEAT-LOOP-2026-0251-the-produces-not-in-diff-deliverable-mis.md +++ b/changelog.d/FEAT-LOOP-2026-0251-the-produces-not-in-diff-deliverable-mis.md @@ -2,4 +2,4 @@ class: changed trace: FEAT-LOOP-2026-0251 --- -The `produces_not_in_diff`, `deliverable_missing` and `no_deliverable_files` refusals now run before the verification gates, so a refused attempt pays for no gate run. An attempt that also would have failed a gate, or `files_changed_mismatch`, is now reported as the deliverable refusal instead +The `produces_not_in_diff`, `deliverable_missing` and `no_deliverable_files` refusals now run before the verification gates, so a refused attempt pays for no gate run. An attempt that also would have failed a gate, `files_changed_mismatch`, the smoke-import check, a closing-deliverable guard or the blocked-verdict check is now reported as the deliverable refusal instead From bcacd2ac3904f9bf9198f3c7e38f7e493beb0f9b Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 09:10:17 -0500 Subject: [PATCH 26/69] chore(loop): FEAT-LOOP-2026-0251/G1-CLOSE judge cost fold Feature: FEAT-LOOP-2026-0251 --- .../WU-90-gate-1-close.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md index bdb36742..0f578020 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md @@ -38,10 +38,10 @@ cumulative_duration_seconds: 291.43 cumulative_input_tokens: 70 cumulative_output_tokens: 36654 cumulative_attempts: 1 -cost_usd: 1.009056 +cost_usd: 1.489002 duration_seconds: 259.427 -input_tokens: 36 -output_tokens: 27277 +input_tokens: 48 +output_tokens: 34844 folded_through_re_arm: 2 gate_set: plannext driver_version: 0.33.2 From 612999a5e9dc88a0741c489b89b6d8c9b595e49d Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 09:10:17 -0500 Subject: [PATCH 27/69] chore(loop): gate 1 awaiting_review Feature: FEAT-LOOP-2026-0251 --- .../GATE-01.md | 2 +- .../events.jsonl | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md index 290ed1e9..e42d791b 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md @@ -1,6 +1,6 @@ --- gate: 1 -status: open +status: awaiting_review feature_oracle: "python3 -m unittest tests.test_fail_fast_deliverables -v -b" cost_budget_usd: 14.00 broad_run: diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index 9271af1d..0266e098 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -148,3 +148,12 @@ {"timestamp": "2026-11-26T13:59:19.222047+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "hookspath-conflict-bats", "ok": true, "skipped": false, "duration_seconds": 0.596, "phase": "broad"}} {"timestamp": "2026-11-26T13:59:19.293600+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "terminal_judge_editing_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "status": "clean", "reason": "acknowledged by operator: .specfuse/verification.yml.example, produces_driver_helper, specfuse/loop/data/verification.yml.example, specfuse/loop/lint_plan.py, specfuse/loop/loop.py"}} {"timestamp": "2026-11-26T13:59:19.296802+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "terminal_judge_editing_acknowledged", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "close_unit": "FEAT-LOOP-2026-0251/G1-CLOSE", "paths": [".specfuse/verification.yml.example", "produces_driver_helper", "specfuse/loop/data/verification.yml.example", "specfuse/loop/lint_plan.py", "specfuse/loop/loop.py"], "reason": "Review fixes tested, full suite green, accept the generator risk"}} +{"timestamp": "2026-11-26T13:59:19.394823+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "task_started", "source": "driver", "source_version": "0.33.2", "payload": {"type": "close", "model": "sonnet", "re_arm_count": 2}} +{"timestamp": "2026-11-26T13:59:19.394829+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "re_arm_dispatched", "source": "driver", "source_version": "0.33.2", "payload": {"re_arm_count": 2, "reason": "A for both, go ahead"}} +{"timestamp": "2026-11-26T14:03:38.823723+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "plan-lint", "ok": true, "skipped": false, "duration_seconds": 0.128, "phase": "attempt"}} +{"timestamp": "2026-11-26T14:03:38.823755+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "feature_oracle", "ok": true, "skipped": false, "duration_seconds": 13.236, "phase": "attempt"}} +{"timestamp": "2026-11-26T14:10:17.023134+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "judged", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "close_verdict": "not_met", "close_model": "sonnet", "judge_verdict": "not_met", "verdict": "not_met", "lowered": false, "disagreed": false, "findings": 1, "reason": null, "diff_base": "a89373d119f8e2d8003a8956dbd4bd27dde8057f", "diff_base_source": "merge-base of HEAD with main", "usage": {"cost_usd": 0.47994549999999997, "input_tokens": 12, "output_tokens": 7567, "cache_read_input_tokens": 396235, "cache_creation_input_tokens": 91157}, "judge_cost_usd": 0.479945}} +{"timestamp": "2026-11-26T14:10:17.024701+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "attempt_outcome", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "outcome": "passed", "duration_seconds": 259.427, "agent_seconds": 245.9689366670791, "verify_seconds": 13.369104042067192, "cost_usd": 1.4890017, "input_tokens": 48, "output_tokens": 34844, "cache_read_input_tokens": 2269217, "cache_creation_input_tokens": 228386, "model": "sonnet", "effort": "high", "failure_class": null, "failure_signature": null, "failure_excerpt": null, "files_touched": [".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md", ".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/LEARNINGS-pending.md", ".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/RETROSPECTIVE.md", ".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md", ".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl", "changelog.d/FEAT-LOOP-2026-0251-the-produces-not-in-diff-deliverable-mis.md"], "agent_status": "complete", "agent_blocked_reason": null, "re_arm_count": 0, "failing_tests": []}} +{"timestamp": "2026-11-26T14:10:17.024880+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "task_completed", "source": "driver", "source_version": "0.33.2", "payload": {"attempts": 1, "attempts_usage": [{"attempt": 1, "duration_seconds": 259.427, "cost_usd": 1.4890017, "input_tokens": 48, "output_tokens": 34844, "cache_read_input_tokens": 2269217, "cache_creation_input_tokens": 228386, "agent_seconds": 245.9689366670791, "verify_seconds": 13.369104042067192}], "type": "close", "re_arm_count": 2, "cost_usd": 1.489002, "cumulative_cost_usd": 3.181952, "attempts_lifetime": 2, "planned_cost_usd": 5.0}} +{"timestamp": "2026-11-26T14:10:17.046100+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_reached", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1}} +{"timestamp": "2026-11-26T14:10:17.046089+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "arm_predicate_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "would_arm": true, "predicate_version": "v1", "classes": {"budget_projection": {"status": "clean", "reason": "projected spend $5.86 within 2.0x baseline planned total $11.00 (cap $22.00)"}, "judge_editing": {"status": "clean", "reason": "no drafted WU touches judge-path surfaces"}, "decision_class_paths": {"status": "clean", "reason": "no drafted WU touches a recognised dependency manifest (pyproject.toml, package.json, pom.xml, build.gradle, build.gradle.kts, Cargo.toml, go.mod, Gemfile, composer.json, requirements*.txt, *.csproj)"}, "retroactive_edits": {"status": "clean", "reason": "no passed-gate baseline WU altered or removed"}, "drift_caps": {"status": "clean", "reason": "added WUs and gates within drift caps"}, "missing_provenance": {"status": "clean", "reason": "no added WUs"}, "open_questions_human_only": {"status": "clean", "reason": "terminal gate: no drafted successor"}, "plan_next_lint": {"status": "clean", "reason": "plan-next lint: no findings"}}}} From 1c8bb73fd5e0f11269481f8bf0d87cec78896f04 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 09:10:19 -0500 Subject: [PATCH 28/69] =?UTF-8?q?chore(loop):=20FEAT-LOOP-2026-0251=20?= =?UTF-8?q?=E2=80=94=20record=20the=20follow-up=20issues=20the=20driver=20?= =?UTF-8?q?filed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md | 2 ++ .../FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl | 1 + 2 files changed, 3 insertions(+) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md index ef77c82c..727d831b 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md @@ -5,6 +5,8 @@ under "Resolved"; both re-run conditions now hold. ### The early refusal also outranks three other checks, and no precedence is stated for them +**Tracked as #3610.** + **Criterion (verbatim).** "A surviving skip, or an early refusal whose outcome or failure class differs from the late one for the same input, other than the deliverable-over- `files_changed_mismatch` precedence `GATE-01.md` states (#3608): record `not_met` with a diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index 0266e098..35e2f097 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -157,3 +157,4 @@ {"timestamp": "2026-11-26T14:10:17.024880+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "task_completed", "source": "driver", "source_version": "0.33.2", "payload": {"attempts": 1, "attempts_usage": [{"attempt": 1, "duration_seconds": 259.427, "cost_usd": 1.4890017, "input_tokens": 48, "output_tokens": 34844, "cache_read_input_tokens": 2269217, "cache_creation_input_tokens": 228386, "agent_seconds": 245.9689366670791, "verify_seconds": 13.369104042067192}], "type": "close", "re_arm_count": 2, "cost_usd": 1.489002, "cumulative_cost_usd": 3.181952, "attempts_lifetime": 2, "planned_cost_usd": 5.0}} {"timestamp": "2026-11-26T14:10:17.046100+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_reached", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1}} {"timestamp": "2026-11-26T14:10:17.046089+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "arm_predicate_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "would_arm": true, "predicate_version": "v1", "classes": {"budget_projection": {"status": "clean", "reason": "projected spend $5.86 within 2.0x baseline planned total $11.00 (cap $22.00)"}, "judge_editing": {"status": "clean", "reason": "no drafted WU touches judge-path surfaces"}, "decision_class_paths": {"status": "clean", "reason": "no drafted WU touches a recognised dependency manifest (pyproject.toml, package.json, pom.xml, build.gradle, build.gradle.kts, Cargo.toml, go.mod, Gemfile, composer.json, requirements*.txt, *.csproj)"}, "retroactive_edits": {"status": "clean", "reason": "no passed-gate baseline WU altered or removed"}, "drift_caps": {"status": "clean", "reason": "added WUs and gates within drift caps"}, "missing_provenance": {"status": "clean", "reason": "no added WUs"}, "open_questions_human_only": {"status": "clean", "reason": "terminal gate: no drafted successor"}, "plan_next_lint": {"status": "clean", "reason": "plan-next lint: no findings"}}}} +{"timestamp": "2026-11-26T14:10:19.728537+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "followups_recorded", "source": "driver", "source_version": "0.33.2", "payload": {"filed": 1, "unfiled": 0, "already_tracked": 0, "issue_numbers": ["3610"], "written_back": ["FOLLOW-UPS.md"]}} From f372529f42f162bc8d624adfe2c311c0febcf90e Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 10:22:50 -0500 Subject: [PATCH 29/69] =?UTF-8?q?chore(loop):=20FEAT-LOOP-2026-0251=20?= =?UTF-8?q?=E2=80=94=20state=20one=20precedence=20rule=20for=20deliverable?= =?UTF-8?q?=20refusals=20(#3610),=20re-arm=20the=20close?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The second close recorded not_met on #3610: the early deliverable refusal also outranks the smoke-import, blocked-verdict and closing-deliverable checks. Operator chose to state one general rule. GATE-01.md, the close unit's escalation trigger and docs/methodology.md (plus the packaged copy) now say a deliverable refusal outranks every check that runs after the agent session, and record the kept-tree side effect. Co-Authored-By: Claude Opus 5.5 --- .../GATE-01.md | 20 ++++++++++---- .../WU-90-gate-1-close.md | 27 ++++++++++++++----- docs/methodology.md | 7 +++++ specfuse/loop/data/docs/methodology.md | 7 +++++ 4 files changed, 49 insertions(+), 12 deletions(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md index e42d791b..796b0fd5 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md @@ -1,6 +1,6 @@ --- gate: 1 -status: awaiting_review +status: open feature_oracle: "python3 -m unittest tests.test_fail_fast_deliverables -v -b" cost_budget_usd: 14.00 broad_run: @@ -39,13 +39,23 @@ leaves a known diff and a `verify_fn` that counts its calls: operator after the first close, #3609.)* **Precedence when two refusals apply** *(stated 2026-11-26 by the operator after the first -close, #3608).* An attempt whose RESULT claims a declared `produces:` path it did not change -trips both `produces_not_in_diff` and `files_changed_mismatch`. Under the default order the -deliverable refusal wins and verification does not run; with `fail_fast_deliverables: false` -the old `files_changed_mismatch` outcome holds. Both sides are asserted by +close, #3608; widened after the second close, #3610).* Under the default order a deliverable +refusal (`produces_not_in_diff`, `deliverable_missing`, `no_deliverable_files`) takes +precedence over every check that runs after the agent session: the verification gates and +the later guards, including `files_changed_mismatch`, `smoke_import_failed`, the +blocked-verdict guard and the closing-deliverable guards. An attempt that trips a +deliverable refusal and one of those checks records the deliverable refusal, and the other +check runs only on a later attempt, once the deliverable is fixed. With +`fail_fast_deliverables: false` the old order and its outcomes hold. The +`files_changed_mismatch` pair is asserted on both sides by `TestProducesNotInDiffEarly.test_deliverable_refusal_outranks_files_changed_mismatch`. Clause 3's "same outcome and failure class" applies to inputs that trip only one refusal. +One side effect follows and is accepted. The early refusal keeps or resets the tree per +`defaults.retain_on_guard_refusal` (clause 4), so by default it keeps the tree. The +smoke-import and closing-deliverable refusals it now outranks always reset it. On an input +that trips both, the next attempt therefore starts from the kept tree, not a clean one. + The `feature_oracle` proves 1–5. It is red on the current tree; `FEAT-LOOP-2026-0251/T01` is the walking skeleton that creates `tests/test_fail_fast_deliverables.py` and turns clause 1 green, with every other class `unittest.skip` naming its owner (T02–T04). A skip surviving to the close diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md index 0f578020..e7a572e1 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md @@ -1,9 +1,8 @@ --- id: FEAT-LOOP-2026-0251/G1-CLOSE type: close -verdict: not_met -status: done -attempts: 1 +status: pending +attempts: 0 oracle_env: macos_local planned_cost_usd: 5.00 auto_close_disabled: true @@ -17,7 +16,7 @@ judge_edit_acknowledged: - specfuse/loop/lint_plan.py - specfuse/loop/loop.py reason: "Review fixes tested, full suite green, accept the generator risk" -re_arm_count: 2 +re_arm_count: 3 re_arm_history: - timestamp: 2026-11-26T13:30:05+00:00 @@ -33,6 +32,13 @@ re_arm_history: prior_cost_usd: 1.69295 prior_duration_seconds: 291.43 reason: "A for both, go ahead" + - + timestamp: 2026-11-26T15:22:22+00:00 + prior_status: done + prior_attempts: 1 + prior_cost_usd: 1.489002 + prior_duration_seconds: 259.427 + reason: "1, go ahead" cumulative_cost_usd: 1.69295 cumulative_duration_seconds: 291.43 cumulative_input_tokens: 70 @@ -76,12 +82,19 @@ warns on a `produces:` path its unit never mentions. **Verification.** `specfuse lint --closing`, plus the gate set in `.specfuse/verification.yml`. **Escalation triggers.** A surviving skip, or an early refusal whose outcome or failure class -differs from the late one for the same input, other than the deliverable-over- -`files_changed_mismatch` precedence `GATE-01.md` states (#3608): record `not_met` with a -follow-up. +differs from the late one for the same input, other than the precedence `GATE-01.md` states +under "Precedence when two refusals apply" (a deliverable refusal outranks every check that +runs after the agent session, #3608 and #3610): record `not_met` with a follow-up. **Re-close note (2026-11-26).** The first close recorded `not_met` on #3608 and #3609; the operator chose to amend the definition of done for both (see `GATE-01.md` clause 6 and "Precedence when two refusals apply"). That close already wrote `RETROSPECTIVE.md`, `FOLLOW-UPS.md`, `LEARNINGS-pending.md` and changelog fragments: update them in place, do not duplicate fragments, and say in `FOLLOW-UPS.md` whether each entry's re-run condition now holds. + +**Second re-close note (2026-11-26).** The second close recorded `not_met` on #3610 (cases D to +G: the deliverable refusal also outranks the smoke-import, blocked-verdict and +closing-deliverable checks). The operator chose to state one general precedence rule; it is in +`GATE-01.md`, in the escalation trigger above and in `docs/methodology.md`, together with the +kept-tree side effect. Update `RETROSPECTIVE.md`, `FOLLOW-UPS.md` and the other closing files in +place as before, and say in `FOLLOW-UPS.md` whether #3610's re-run condition now holds. diff --git a/docs/methodology.md b/docs/methodology.md index 9ba38245..febf0334 100644 --- a/docs/methodology.md +++ b/docs/methodology.md @@ -516,6 +516,13 @@ order, in which they run only after verification passes. What is refused does not change, only when. The retry note for these refusals also lists the paths the attempt did change. `specfuse lint` warns before arming when a unit's body never mentions a `produces:` path (full path, file name or parent directory). +A deliverable refusal takes precedence over every check that runs after the +agent session: on an attempt that also fails a gate, `files_changed_mismatch`, +the smoke-import guard, the blocked-verdict guard or a closing-deliverable +guard, only the deliverable refusal is recorded, and the other check runs on a +later attempt. Because the early refusal follows `retain_on_guard_refusal`, such +an attempt keeps its tree by default where the smoke-import and +closing-deliverable refusals would have reset it. **Retain-and-repair (FEAT-2026-0103).** `files_changed_mismatch`, `produces_not_in_diff`, `deliverable_missing`, and `no_deliverable_files` — diff --git a/specfuse/loop/data/docs/methodology.md b/specfuse/loop/data/docs/methodology.md index 9ba38245..febf0334 100644 --- a/specfuse/loop/data/docs/methodology.md +++ b/specfuse/loop/data/docs/methodology.md @@ -516,6 +516,13 @@ order, in which they run only after verification passes. What is refused does not change, only when. The retry note for these refusals also lists the paths the attempt did change. `specfuse lint` warns before arming when a unit's body never mentions a `produces:` path (full path, file name or parent directory). +A deliverable refusal takes precedence over every check that runs after the +agent session: on an attempt that also fails a gate, `files_changed_mismatch`, +the smoke-import guard, the blocked-verdict guard or a closing-deliverable +guard, only the deliverable refusal is recorded, and the other check runs on a +later attempt. Because the early refusal follows `retain_on_guard_refusal`, such +an attempt keeps its tree by default where the smoke-import and +closing-deliverable refusals would have reset it. **Retain-and-repair (FEAT-2026-0103).** `files_changed_mismatch`, `produces_not_in_diff`, `deliverable_missing`, and `no_deliverable_files` — From 396aa5115613ec486fd4d0824c91062df1501f6d Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 10:22:53 -0500 Subject: [PATCH 30/69] chore(loop): FEAT-LOOP-2026-0251 build pin recorded Feature: FEAT-LOOP-2026-0251 --- .../FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl | 1 + 1 file changed, 1 insertion(+) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index 35e2f097..cc89845b 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -158,3 +158,4 @@ {"timestamp": "2026-11-26T14:10:17.046100+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_reached", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1}} {"timestamp": "2026-11-26T14:10:17.046089+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "arm_predicate_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "would_arm": true, "predicate_version": "v1", "classes": {"budget_projection": {"status": "clean", "reason": "projected spend $5.86 within 2.0x baseline planned total $11.00 (cap $22.00)"}, "judge_editing": {"status": "clean", "reason": "no drafted WU touches judge-path surfaces"}, "decision_class_paths": {"status": "clean", "reason": "no drafted WU touches a recognised dependency manifest (pyproject.toml, package.json, pom.xml, build.gradle, build.gradle.kts, Cargo.toml, go.mod, Gemfile, composer.json, requirements*.txt, *.csproj)"}, "retroactive_edits": {"status": "clean", "reason": "no passed-gate baseline WU altered or removed"}, "drift_caps": {"status": "clean", "reason": "added WUs and gates within drift caps"}, "missing_provenance": {"status": "clean", "reason": "no added WUs"}, "open_questions_human_only": {"status": "clean", "reason": "terminal gate: no drafted successor"}, "plan_next_lint": {"status": "clean", "reason": "plan-next lint: no findings"}}}} {"timestamp": "2026-11-26T14:10:19.728537+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "followups_recorded", "source": "driver", "source_version": "0.33.2", "payload": {"filed": 1, "unfiled": 0, "already_tracked": 0, "issue_numbers": ["3610"], "written_back": ["FOLLOW-UPS.md"]}} +{"timestamp": "2026-11-26T15:22:53.630315+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "driver_build_pinned", "source": "driver", "source_version": "0.33.2", "payload": {"tree": "a3f9d0cef2b2ca5ff6b069cdba9ab76e4f691df2", "path": "/private/var/folders/zc/rgq11x850d78dx_kf1fd4vx80000gn/T/specfuse-pins/a3f9d0cef2b2ca5ff6b069cdba9ab76e4f691df2/specfuse/loop"}} From 1eaac2cc07276bd0e5683a5b8f7858bd09225620 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 10:32:04 -0500 Subject: [PATCH 31/69] chore(loop): gate 1 broad run clean Feature: FEAT-LOOP-2026-0251 --- .../GATE-01.md | 4 ++-- .../events.jsonl | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md index 796b0fd5..04557652 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md @@ -4,8 +4,8 @@ status: open feature_oracle: "python3 -m unittest tests.test_fail_fast_deliverables -v -b" cost_budget_usd: 14.00 broad_run: - tree: 07bbf72d1e7af3c1a03af605f40e5563dc3a18db:0ec7c6da6e74f0b56753f09657b654a6d289b91b:12064a6191eeb830a9826d911a8543fbaba3da75:27968248a450a842ccd187b7dce0fb0ded934866:287efde8f90320baffac08f5f3287b9456a65cb9:2e29b2f7e073a0cbe290f01d3b397e1cdd10c81c:42796ea0e0a6c03811b0e4bc9dbd3b5ee62dd2e4:4acc6dfc5e8cece358c167d876515eba4a39a500:834d9d9c16094a386cd9b5a6f9ced9a3a9b4e7fb:a90788bb48ee6cdb0fa8b0f867c80a4643acd35d:bbd1aea514612d76722a18c7aece7c767cf1a076:c23b62e87f1ae3890c6f9e3d8c7ca7ec9225ed81:cab62f76bd04445beb1bf0786c2ee8df617496bb:caffe2d63ceacde448842a91bc7a12c206a67523:d74b7d113b844e84f0009098f576fd28477f072d:e1aa20b9c08a5ebe036da74f16e28c751f18f6fa:e3b0de29b81a6c8e0abeacb3898519b98014b9ef:f52cfa168d3517ad5d14d0c2b706e13ec571268e:fa2f4f88657587b6e3b560977858810846b1d366 - ran_at: 2026-11-26T13:59:19.214421+00:00 + tree: 07bbf72d1e7af3c1a03af605f40e5563dc3a18db:0ec7c6da6e74f0b56753f09657b654a6d289b91b:12064a6191eeb830a9826d911a8543fbaba3da75:1a8258cf8dd2af85aa66b31c9d341781000b1229:27968248a450a842ccd187b7dce0fb0ded934866:287efde8f90320baffac08f5f3287b9456a65cb9:2e29b2f7e073a0cbe290f01d3b397e1cdd10c81c:42796ea0e0a6c03811b0e4bc9dbd3b5ee62dd2e4:4acc6dfc5e8cece358c167d876515eba4a39a500:56ae45adcc17a1292977c436fd195ef8c61cc9e4:5a3f321ad3cdb33ab16e1356d0f149be66301b74:834d9d9c16094a386cd9b5a6f9ced9a3a9b4e7fb:bbd1aea514612d76722a18c7aece7c767cf1a076:c23b62e87f1ae3890c6f9e3d8c7ca7ec9225ed81:cab62f76bd04445beb1bf0786c2ee8df617496bb:caffe2d63ceacde448842a91bc7a12c206a67523:d74b7d113b844e84f0009098f576fd28477f072d:e3b0de29b81a6c8e0abeacb3898519b98014b9ef:fa2f4f88657587b6e3b560977858810846b1d366 + ran_at: 2026-11-26T15:32:03.970343+00:00 ok: true failing: [] --- diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index cc89845b..c10bebac 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -159,3 +159,22 @@ {"timestamp": "2026-11-26T14:10:17.046089+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "arm_predicate_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "would_arm": true, "predicate_version": "v1", "classes": {"budget_projection": {"status": "clean", "reason": "projected spend $5.86 within 2.0x baseline planned total $11.00 (cap $22.00)"}, "judge_editing": {"status": "clean", "reason": "no drafted WU touches judge-path surfaces"}, "decision_class_paths": {"status": "clean", "reason": "no drafted WU touches a recognised dependency manifest (pyproject.toml, package.json, pom.xml, build.gradle, build.gradle.kts, Cargo.toml, go.mod, Gemfile, composer.json, requirements*.txt, *.csproj)"}, "retroactive_edits": {"status": "clean", "reason": "no passed-gate baseline WU altered or removed"}, "drift_caps": {"status": "clean", "reason": "added WUs and gates within drift caps"}, "missing_provenance": {"status": "clean", "reason": "no added WUs"}, "open_questions_human_only": {"status": "clean", "reason": "terminal gate: no drafted successor"}, "plan_next_lint": {"status": "clean", "reason": "plan-next lint: no findings"}}}} {"timestamp": "2026-11-26T14:10:19.728537+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "followups_recorded", "source": "driver", "source_version": "0.33.2", "payload": {"filed": 1, "unfiled": 0, "already_tracked": 0, "issue_numbers": ["3610"], "written_back": ["FOLLOW-UPS.md"]}} {"timestamp": "2026-11-26T15:22:53.630315+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "driver_build_pinned", "source": "driver", "source_version": "0.33.2", "payload": {"tree": "a3f9d0cef2b2ca5ff6b069cdba9ab76e4f691df2", "path": "/private/var/folders/zc/rgq11x850d78dx_kf1fd4vx80000gn/T/specfuse-pins/a3f9d0cef2b2ca5ff6b069cdba9ab76e4f691df2/specfuse/loop"}} +{"timestamp": "2026-11-26T15:32:03.990356+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "broad_run_result", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "tree": "07bbf72d1e7af3c1a03af605f40e5563dc3a18db:0ec7c6da6e74f0b56753f09657b654a6d289b91b:12064a6191eeb830a9826d911a8543fbaba3da75:1a8258cf8dd2af85aa66b31c9d341781000b1229:27968248a450a842ccd187b7dce0fb0ded934866:287efde8f90320baffac08f5f3287b9456a65cb9:2e29b2f7e073a0cbe290f01d3b397e1cdd10c81c:42796ea0e0a6c03811b0e4bc9dbd3b5ee62dd2e4:4acc6dfc5e8cece358c167d876515eba4a39a500:56ae45adcc17a1292977c436fd195ef8c61cc9e4:5a3f321ad3cdb33ab16e1356d0f149be66301b74:834d9d9c16094a386cd9b5a6f9ced9a3a9b4e7fb:bbd1aea514612d76722a18c7aece7c767cf1a076:c23b62e87f1ae3890c6f9e3d8c7ca7ec9225ed81:cab62f76bd04445beb1bf0786c2ee8df617496bb:caffe2d63ceacde448842a91bc7a12c206a67523:d74b7d113b844e84f0009098f576fd28477f072d:e3b0de29b81a6c8e0abeacb3898519b98014b9ef:fa2f4f88657587b6e3b560977858810846b1d366", "ok": true, "failing": []}} +{"timestamp": "2026-11-26T15:32:03.990406+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "tests", "ok": true, "skipped": false, "duration_seconds": 485.06, "phase": "broad"}} +{"timestamp": "2026-11-26T15:32:03.990414+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "lint", "ok": true, "skipped": false, "duration_seconds": 0.81, "phase": "broad"}} +{"timestamp": "2026-11-26T15:32:03.990420+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "security", "ok": true, "skipped": false, "duration_seconds": 3.244, "phase": "broad"}} +{"timestamp": "2026-11-26T15:32:03.990426+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "coverage", "ok": true, "skipped": false, "duration_seconds": 1.573, "phase": "broad"}} +{"timestamp": "2026-11-26T15:32:03.990428+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "leak-scan", "ok": true, "skipped": false, "duration_seconds": 29.266, "phase": "broad"}} +{"timestamp": "2026-11-26T15:32:03.990433+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "changelog-fragments", "ok": true, "skipped": false, "duration_seconds": 0.137, "phase": "broad"}} +{"timestamp": "2026-11-26T15:32:03.990436+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "agent-policy-example-lint", "ok": true, "skipped": false, "duration_seconds": 0.167, "phase": "broad"}} +{"timestamp": "2026-11-26T15:32:03.990439+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "event-type-gate", "ok": true, "skipped": false, "duration_seconds": 0.424, "phase": "broad"}} +{"timestamp": "2026-11-26T15:32:03.990446+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "roadmap-link-gate", "ok": true, "skipped": false, "duration_seconds": 0.074, "phase": "broad"}} +{"timestamp": "2026-11-26T15:32:03.990448+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "arm-sweep-gate", "ok": true, "skipped": false, "duration_seconds": 0.996, "phase": "broad"}} +{"timestamp": "2026-11-26T15:32:03.990449+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "monitoring-example-lint", "ok": true, "skipped": false, "duration_seconds": 0.076, "phase": "broad"}} +{"timestamp": "2026-11-26T15:32:03.990453+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "leak-scan-hook", "ok": true, "skipped": false, "duration_seconds": 1.463, "phase": "broad"}} +{"timestamp": "2026-11-26T15:32:03.990460+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "pre-push-hook", "ok": true, "skipped": false, "duration_seconds": 4.643, "phase": "broad"}} +{"timestamp": "2026-11-26T15:32:03.990462+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "sync-scaffold-bats", "ok": true, "skipped": false, "duration_seconds": 16.37, "phase": "broad"}} +{"timestamp": "2026-11-26T15:32:03.990463+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "sync-scaffold-symlinks-bats", "ok": true, "skipped": false, "duration_seconds": 2.985, "phase": "broad"}} +{"timestamp": "2026-11-26T15:32:03.990465+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "init-sh-shim-bats", "ok": true, "skipped": false, "duration_seconds": 1.328, "phase": "broad"}} +{"timestamp": "2026-11-26T15:32:03.990471+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "init-skills-bats", "ok": true, "skipped": false, "duration_seconds": 0.239, "phase": "broad"}} +{"timestamp": "2026-11-26T15:32:03.990472+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "hookspath-conflict-bats", "ok": true, "skipped": false, "duration_seconds": 1.02, "phase": "broad"}} From fc3cd2b64f9780df6d5c88ce158aef6faa88a9a9 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 10:38:24 -0500 Subject: [PATCH 32/69] =?UTF-8?q?feat:=20G1-CLOSE=20=E2=80=94=20terminal?= =?UTF-8?q?=20close?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Feature: FEAT-LOOP-2026-0251/G1-CLOSE --- .../FOLLOW-UPS.md | 72 +---- .../LEARNINGS-pending.md | 4 +- .../PROGRESS.md | 2 + .../RETROSPECTIVE.md | 267 +++++++++++------- .../WU-90-gate-1-close.md | 27 +- .../events.jsonl | 2 + ...he-produces-not-in-diff-deliverable-mis.md | 2 +- 7 files changed, 196 insertions(+), 180 deletions(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md index 727d831b..925c1e22 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md @@ -1,68 +1,20 @@ # Follow-ups — FEAT-LOOP-2026-0251 -Re-close, 2026-11-26. One entry is open. The two entries from the first close are listed -under "Resolved"; both re-run conditions now hold. +Third close, 2026-11-26. No entry is open. All three re-run conditions hold. Two wording +gaps that are not failed criteria are in `RETROSPECTIVE.md` under "Notes for the human +reviewer". -### The early refusal also outranks three other checks, and no precedence is stated for them - -**Tracked as #3610.** - -**Criterion (verbatim).** "A surviving skip, or an early refusal whose outcome or failure -class differs from the late one for the same input, other than the deliverable-over- -`files_changed_mismatch` precedence `GATE-01.md` states (#3608): record `not_met` with a -follow-up." - -**Evidence.** A probe drove `loop.run()` with the key `true` and then `false`. Each input -leaves a deliverable refusal in place and also trips a second check. Each cell is outcome / -failure class. The unit declares `src/rule.py`. - -| Input | `true` | `false` | -|---|---|---| -| D: failing smoke-import line, `src/rule.py` untouched | `produces_not_in_diff` / `produces_not_in_diff` | `smoke_import_failed` / `smoke_import_failed` | -| E: produced `.md` with a `BLOCKED` verdict heading, `src/rule.py` untouched | `produces_not_in_diff` / `produces_not_in_diff` | `failed` / `guard_refusal` | -| F: `close` unit, `src/rule.py` untouched | `produces_not_in_diff` / `produces_not_in_diff` | `closing_deliverable_missing` / `guard_refusal` | -| G: failing smoke-import line, `src/rule.py` emptied | `deliverable_missing` / `guard_refusal` | `smoke_import_failed` / `smoke_import_failed` | - -Controls: with every declared path changed and the key `true`, the D unit still gets -`smoke_import_failed` and the E unit still gets `failed` / `guard_refusal`. Details are in -`RETROSPECTIVE.md` under "Early against late, same input". - -**What happened, in plain terms.** Every one of these attempts is still refused. Only the -name of the refusal, and so the retry advice, differs. The deliverable check now runs first, -so it wins over every check that used to run before it. The amendment after the first close -named just one of those checks. The first close had mentioned the others only as something -read in the code. The close cannot choose the precedence itself, and its instructions tell -it to record this. - -One side effect comes from reading the code and was not measured. The old smoke-import and -closing-deliverable refusals always reset the working tree. The early refusal keeps it by -default. So in D, F and G the next attempt likely starts from a different tree. - -**Why it was not fixed automatically.** The close may not edit source, the gate's definition -of done or the close unit. - -**Options.** - -1. State one general rule: a deliverable refusal takes precedence over every check that - runs after the agent session (the verification gates and the later guards), and says so - in `GATE-01.md`, the close unit's trigger and `docs/methodology.md`. For: no code change; - matches what was built; covers checks nobody has listed. Against: on such an attempt the - other problem is reported only on a later attempt, after the deliverable is fixed. It - relaxes the plan after the fact, and costs one more close. -2. Run the cheap later checks (blocked verdict, smoke-import) before the early refusal. For: - those outcomes match the old order. Against: smoke-import runs commands from the unit - body and the closing guards expect a squashed commit, so this is real code and test work; - `PLAN.md` decision 4 says those guards stay where they are. -3. Accept the `not_met` and merge by hand. For: no further loop spend. Against: the record - keeps a failed gate for a difference in labelling. - -**Recommendation.** Option 1. It states the rule once instead of one guard per re-close. +## Resolved -**Re-run condition.** Either `GATE-01.md` and the close unit's escalation trigger both state -a precedence that covers cases D to G, or each of D to G records the same outcome and -failure class with the key `true` and `false`, asserted by a test. +#### The early refusal also outranks three other checks, and no precedence is stated for them -## Resolved +**Tracked as #3610.** **Re-run condition holds** (first branch). `GATE-01.md` ("Precedence +when two refusals apply") and the close unit's escalation trigger both state that a +deliverable refusal outranks every check that runs after the agent session, which covers +cases D to G. `docs/methodology.md` states it too, with the kept-tree side effect. The +third close reran D to G with the same results as before, plus controls; see +`RETROSPECTIVE.md` under "Early against late, same input". A test asserts only the +`files_changed_mismatch` pair; the other pairs rest on the probe. #### An early refusal records a different outcome from the late order for one input diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/LEARNINGS-pending.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/LEARNINGS-pending.md index 8e7adadb..c9b0d75c 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/LEARNINGS-pending.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/LEARNINGS-pending.md @@ -16,7 +16,9 @@ Licensed under the Apache License, Version 2.0. See LICENSE. check, the smoke-import check and the closing-deliverable guards. The plan named none. The amendment after the first close named one, and the re-close failed on the others. List every overtaken check, probe each one early against late, and put the whole list in one - follow-up; a "read in the code" aside does not reach the operator's decision. + follow-up; a "read in the code" aside does not reach the operator's decision. Prefer one general rule + over a list of named exceptions: here a list cost a second re-close. Also name what else the + order changes besides the label, such as whether the tree is kept or reset. - [FEAT-LOOP-2026-0251/T04] **A unit that adds a lint message must run every test module that lints, not only the ones its Verification section names.** Existing tests filtered diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md index 599ee91a..3723c57e 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md @@ -8,3 +8,5 @@ - note: Operator must decide whether a deliverable refusal takes precedence over files_changed_mismatch (see FOLLOW-UPS.md) and acknowledge the four consumer-visible changes. - **FEAT-LOOP-2026-0251/G1-CLOSE**: Re-ran the terminal close with advisory verdict not_met, because probes show the early deliverable refusal also yields a different outcome or failure class than the late order for smoke-import, blocked-verdict and closing-deliverable inputs, which the stated files_changed_mismatch precedence does not cover. - note: The operator must decide the one open FOLLOW-UPS.md entry (recommended: one general precedence rule in GATE-01.md, the close trigger and docs/methodology.md) and acknowledge the four consumer-visible changes; the re-run conditions for +- **FEAT-LOOP-2026-0251/G1-CLOSE**: Updated the gate 1 close files for the third close after a fresh early-versus-late probe, recorded advisory verdict met, and extended one existing changelog fragment. + - note: docs/methodology.md still says "What is refused does not change, only when", which is not true for a gate-written deliverable under the default (probe case Q). diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/RETROSPECTIVE.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/RETROSPECTIVE.md index b80406cb..cb8ab1ad 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/RETROSPECTIVE.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/RETROSPECTIVE.md @@ -4,16 +4,17 @@ ## Verdict -`not_met` (advisory; the judge concludes). This is the second close of the gate. The two -`not_met` findings of the first close (#3608, #3609) are settled by the operator's amendment -to the definition of done. The close unit's escalation trigger still fires on inputs the -amendment does not name: four probed inputs get a different early and late refusal outcome, -and none of them involves `files_changed_mismatch`. `FOLLOW-UPS.md` states the decision. +`met` (advisory; the judge concludes). This is the third close of the gate. #3608, #3609 and +#3610 are settled by the operator's two amendments to `GATE-01.md`. A fresh probe found no +early-against-late difference other than a deliverable refusal winning over a later check or +a verification gate. One limit of that reading: when a gate itself writes the declared file +(probe case Q), there is no late refusal at all. `PLAN.md` decision 6 designed the opt-out +for that case. Two wording gaps are listed under "Notes for the human reviewer". ## Measurements -All commands ran fresh in this session on the working tree. Runs that drive `loop.run()` used -`HOME` under `$TMPDIR`, because the sandbox blocks writes to the real session directory. +All commands ran fresh in this third close on the working tree. Runs that drive `loop.run()` +used `HOME` under `$TMPDIR`, because the sandbox blocks writes to the real session directory. ### feature_oracle: PASS @@ -25,62 +26,88 @@ of that file for `unittest.skip`, `skipIf`, `skipUnless`, `skipTest` and `@skip` | Check | Result | |---|---| -| `python3 -m unittest tests.test_dispatch_skeleton tests.test_gate_timings -b` | exit 0, 25 tests | +| `python3 -m unittest tests.test_dispatch_skeleton tests.test_gate_timings -b` | 25 tests, `OK` | | `python3 -m unittest tests.test_lint_plan -b` (named by T04) | **error: no such module** | -| the six `tests/test_lint_plan*.py` modules that do exist | exit 0, 46 tests | -| the ten changed pre-existing test modules | exit 0, 68 tests | +| the six `tests/test_lint_plan*.py` modules that do exist | 46 tests, `OK` | +| the ten changed pre-existing test modules | 68 tests, `OK` | | `.specfuse/scripts/lint_plan.py` over every feature folder with a `PLAN.md` | 97 linted, 0 non-zero exits | | `diff` of `verification.yml.example` against its packaged copy | exit 0, empty | | `diff docs/methodology.md specfuse/loop/data/docs/methodology.md` | exit 0, empty | | `python3 -m specfuse.loop.changelog_fragments check` | exit 0 | This session did not run the full suite or coverage. The driver's broad run recorded at -2026-11-26T13:59:19Z has `ok: true` and no failing gate. The newest tests log in -`work/gate-logs/` (stamp `20261126T135837`) shows `Ran 5144 tests`, `OK (skipped=4)`. The +2026-11-26T15:32:03Z has `ok: true` and no failing gate. Its tests log +(`work/gate-logs/`, stamp `20261126T153058`) shows `Ran 5144 tests`, `OK (skipped=4)`; the coverage log of the same run shows 92% total. -### Mutation control +### Controls: the oracle observes the feature -With `resolve_fail_fast_deliverables` forced to return `False`, 13 of the 30 oracle tests -fail, with no errors: `TestOptOut` (4, including the resolver's own default test), -`TestPresenceEarly` (3), `TestProducesNotInDiffEarly` (3), `TestTreeAndNote` (2) and -`TestEarlyRefusalRecovery` (1). So these classes observe the new order. -`TestArmTimeWarning` was not part of this control. No unit's "fails on HEAD" claim was -re-run against a pre-feature tree. +**Opt-out mutation.** With `resolve_fail_fast_deliverables` forced to return `False`, 13 of +the 30 oracle tests fail, with no errors: `TestOptOut` 4, `TestPresenceEarly` 3, +`TestProducesNotInDiffEarly` 3, `TestTreeAndNote` 2, `TestEarlyRefusalRecovery` 1. + +**Pre-feature driver.** A scratch copy of the current package and tests, with `loop.py` +replaced by the one in the pinned build `bd7e508` (cut before T01; it contains no +`fail_fast_deliverables`). This is not a full pre-feature tree. + +| Class | Tests run | Result on the old driver | +|---|---|---| +| `TestProducesNotInDiffEarly` | 6 | 6 errors: 5 unknown argument `untracked_before`, 1 missing `early_produces_refusal` | +| `TestPresenceEarly` | 3 | 3 errors: unknown argument `untracked_before` | +| `TestOptOut` | 4 | 3 assertion failures (`1 != 0`), 1 missing resolver | +| `TestTreeAndNote` | 6 | 7 assertion failures (subtests counted) | + +The errors in the first two rows show a missing interface, not wrong behaviour. The mutation +control above is the behaviour evidence for those two classes. For `TestArmTimeWarning`, +with `check_produces_mentioned` replaced by a no-op, 2 of 6 tests fail (the other four expect +silence). ### Early against late, same input A throwaway probe drove `loop.run()` over the oracle's fixture and read the first -`attempt_outcome` for T01, once with `fail_fast_deliverables` `true` and once `false`. -Verification is a stub. The unit declares `src/rule.py`. Unless the row says otherwise, the -attempt writes only `docs/notes.md`, the RESULT is plain and the stub passes. Each cell is -outcome / failure class. Every `true` run had `verify_seconds: 0`. - -| Case | `true` | `false` | Same | Named precedence | -|---|---|---|---|---| -| A: RESULT claims `src/rule.py` in `files_changed` | `produces_not_in_diff` / `produces_not_in_diff` | `files_changed_mismatch` / `files_changed_mismatch` | no | yes (#3608) | -| B: the verify stub fails | `produces_not_in_diff` / `produces_not_in_diff` | `failed` / `other` | no | no | -| C: control | `produces_not_in_diff` / `produces_not_in_diff` | same | yes | — | -| D: unit body has a failing smoke-import line | `produces_not_in_diff` / `produces_not_in_diff` | `smoke_import_failed` / `smoke_import_failed` | **no** | **no** | -| E: also declares `docs/report.md`; attempt writes it with a `BLOCKED` verdict heading | `produces_not_in_diff` / `produces_not_in_diff` | `failed` / `guard_refusal` | **no** | **no** | -| F: the same unit typed `close` | `produces_not_in_diff` / `produces_not_in_diff` | `closing_deliverable_missing` / `guard_refusal` | **no** | **no** | -| G: attempt empties `src/rule.py`; failing smoke-import line | `deliverable_missing` / `guard_refusal` | `smoke_import_failed` / `smoke_import_failed` | **no** | **no** | - -Positive controls with `fail_fast` `true` and every declared path changed: the D unit gets -`smoke_import_failed`, and the E unit gets `failed` / `guard_refusal`. So the second check -in D and E fires on its own. F has no separate control; its `false` run shows the closing -guard firing. F needs a `close` unit that declares `produces:`. - -A, D, E, F and G are each refused under both orders. Only the reported refusal differs. -B is not a second refusal guard: a gate that never runs cannot report a failure, which is -what the feature is for. D to G each trip two refusals. `GATE-01.md` limits clause 3 to -inputs that trip one, so clause 3 is not contradicted. The same file names a precedence only -over `files_changed_mismatch`, and the close unit's trigger exempts only that one. - -Read in `loop.py`, not measured: the late smoke-import and closing-deliverable refusals call -`reset_preserving_events` without consulting `retain_on_guard_refusal`. The early refusal -follows that key, which defaults to keeping the tree. So for D, F and G the tree handling -should differ too. +`attempt_outcome` for T01, once with fail-fast on and once off (the resolver patched). +Verification is a stub. The unit declares `src/rule.py`. "Untouched" means the attempt +writes only `docs/notes.md`. Each cell is outcome / failure class. Every early deliverable +refusal recorded `verify_seconds: 0`. + +| Case | fail-fast on | fail-fast off | Differs because | +|---|---|---|---| +| A: RESULT claims `src/rule.py` in `files_changed` | `produces_not_in_diff` | `files_changed_mismatch` | outranks a later guard | +| B: verify stub fails, untouched | `produces_not_in_diff` | `failed` / `tests` | outranks a gate | +| C: untouched, nothing else wrong | `produces_not_in_diff` | same | same | +| D: failing smoke-import line, untouched | `produces_not_in_diff` | `smoke_import_failed` | outranks a later guard | +| E: also declares `docs/report.md`, written with a `BLOCKED` verdict heading; untouched | `produces_not_in_diff` | `failed` / `guard_refusal` | outranks a later guard | +| F: unit typed `close`, untouched | `produces_not_in_diff` | `closing_deliverable_missing` / `guard_refusal` | outranks a later guard | +| G: failing smoke-import line, `src/rule.py` emptied | `deliverable_missing` / `guard_refusal` | `smoke_import_failed` | outranks a later guard | +| H: squash commit rejected (stub), untouched | `produces_not_in_diff` | `squash_commit_failed` | outranks a later check | +| I: failing smoke-import line, nothing written | `no_deliverable_files` / `guard_refusal` | `smoke_import_failed` | outranks a later guard | +| J: `close` unit, nothing written | `produces_not_in_diff` | `closing_deliverable_missing` / `guard_refusal` | outranks a later guard | +| K: verify stub fails, nothing written | `no_deliverable_files` / `guard_refusal` | `failed` / `tests` | outranks a gate | +| P: squash commit rejected (stub), `src/rule.py` emptied | `deliverable_missing` / `guard_refusal` | `squash_commit_failed` | outranks a later check | +| L: nothing written (two deliverable refusals apply) | `no_deliverable_files` / `guard_refusal` | same | same | +| M: only `src/rule.py` deleted (two apply) | `deliverable_missing` / `guard_refusal` | same | same | +| N: zero-token session, untouched | `zero_token_skip` | same | same | +| O: RESULT `status: blocked`, untouched | `blocked` | same | same | +| Q: verify stub writes `src/rule.py`; the attempt did not | `produces_not_in_diff` | `passed` | outranks a gate; no late refusal exists | + +Where a failure class is not shown, it equals the outcome name. With every declared path +changed and fail-fast on, the D, E, F and H units get the same record as with it off +(`smoke_import_failed`; `failed` / `guard_refusal`; `closing_deliverable_missing`; +`squash_commit_failed`). So each second check fires on its own. + +H and P are new in this close. In the first run of the probe, M and the retained-tree +deletion case raised `FileNotFoundError` in both orders: the probe's stub deleted an +already-deleted file on attempt 2. The stub was fixed and those rows rerun. + +### Tree handling, measured at the start of attempt 2 + +- **Early presence refusals** (`deliverable_missing` for an emptied and for a deleted file, + `no_deliverable_files` with nothing written): with `retain_on_guard_refusal` true, both + orders record `tree_retained: true`; where the attempt had changed something, the change + was still there. With it false, both record `tree_retained: false`, and for the two + `deliverable_missing` inputs the tree was reset. +- **Overtaken checks:** in D, E, F, G, H, P and B the fail-fast run kept the attempt's + `docs/notes.md`, and the other order had removed it. ### Per-criterion results @@ -89,17 +116,17 @@ because it is not one of this unit's permitted closing surfaces. | Criterion | Result | Evidence | |---|---|---| -| T01#1 | passes now | `TestProducesNotInDiffEarly`, in the oracle run; "fails on HEAD" not re-run | +| T01#1 | passes | `TestProducesNotInDiffEarly`; on the old driver errors only, behaviour shown by the mutation control | | T01#2 | passes | `test_early_record_equals_late_record` (plain RESULT, passing stub) | -| T01#3 | passes | 25 tests, exit 0 | -| T02#1 | passes now | `TestPresenceEarly`; "fails on HEAD" not re-run | -| T02#2 | passes now | `TestOptOut`; "fails on HEAD" not re-run | +| T01#3 | passes | 25 tests, `OK` | +| T02#1 | passes | `TestPresenceEarly`; on the old driver errors only, behaviour shown by the mutation control | +| T02#2 | passes | `TestOptOut`; 3 assertion failures on the old driver | | T02#3 | passes | empty diff | -| T03#1 | passes now | `TestTreeAndNote`; "fails on HEAD" not re-run | +| T03#1 | passes | `TestTreeAndNote`; assertion failures on the old driver | | T03#2 | passes | `test_list_is_capped_at_twenty` | -| T04#1 | passes now | `TestArmTimeWarning`; "fails on HEAD" not re-run | -| T04#2 | passes with the repository script | 97 folders, 0 non-zero exits; the installed `specfuse` command was not used | -| T04#3 | not observed | this session did not see T04's RESULT; the count is re-measured below | +| T04#1 | passes | `TestArmTimeWarning`; no-op control | +| T04#2 | passes with the repository script | 97 folders, 0 non-zero exits; the installed `specfuse` warns it is a different build | +| T04#3 | not observed | no close has seen T04's RESULT; the count is re-measured below | | T04#4 | passes | empty diff | | T04#5 | passes | prints `0` | @@ -111,11 +138,11 @@ carried forward: 0 criteria, re-measured: 13 |---|---|---| | 1. `produces_not_in_diff` early | Refused with 0 `verify_fn` calls, `verify_seconds` 0, no attempt-phase `gate_result`; a changed path verifies once and passes; a justified path still verifies; class, signature and summary equal the late site's | `TestProducesNotInDiffEarly` (6 tests) | | 2. Presence early | Absent, empty and bookkeeping-only diffs are refused with 0 calls | `TestPresenceEarly` (3) | -| 3. Opt-out | With the key `false`, each of the three cases verifies once; outcome, class, signature and summary equal the default's, for inputs that trip one refusal | `TestOptOut` (4), on plain-RESULT, passing-stub inputs | -| 4. Tree and note | Note says verification did not run and lists changed paths or says none; cap of 20 plus a count; tree kept or reset | `TestTreeAndNote` (6). The kept/reset assertions use `produces_not_in_diff` only; no test asserts tree handling for an early presence refusal | +| 3. Opt-out | With the key `false`, each of the three cases verifies once; outcome, class, signature and summary equal the default's, for inputs that trip one refusal | `TestOptOut` (4), on plain-RESULT, passing-stub inputs; probe cases C, L, M | +| 4. Tree and note | Note says verification did not run and lists changed paths or says none; cap of 20 plus a count; tree kept or reset | `TestTreeAndNote` (6). The kept/reset test assertions use `produces_not_in_diff` only. No test asserts tree handling for an early presence refusal; this close measured it by probe | | 5. Arm-time WARN | Warns on an unmentioned path; silent on full path, file name or parent directory, and on `done` / `abandoned`; `lint()` calls it | `TestArmTimeWarning` (6) | | 6. Nothing else changes | Holds as widened for #3609. See the list below | `diff -ru` of `tests/` against the recorded base; the ten modules pass | -| Precedence over `files_changed_mismatch` | Both sides asserted | `test_deliverable_refusal_outranks_files_changed_mismatch`; probe case A | +| Precedence over every later check | Holds on every probed pair. A test asserts only the `files_changed_mismatch` pair | `test_deliverable_refusal_outranks_files_changed_mismatch`; probe cases A, B, D to K, P | Three review fixes made before the first close, outside any work unit, are covered by `TestEarlyRefusalRecovery` (3: re-plan still fires; uncommitted tracked edits count as a @@ -123,6 +150,13 @@ moved tree; an untouched tree still halts) and `TestEarlyRetainedNoteWording` (2 ## Pre-existing tests changed +This third close ran no git command and did not repeat the tree comparison. Instead it +listed files under `tests/`, `specfuse/`, `scripts/` and `.specfuse/scripts/` modified after +the second close wrote this file. The only one is the packaged copy +`specfuse/loop/data/docs/methodology.md`. No test or Python source is newer, so the second +close's comparison, below, still describes the tree (a modification-time check, not a +content diff). The ten modules were rerun in this session. + Compared against the public tarball of `a89373d119f8e2d8003a8956dbd4bd27dde8057f`, the merge base recorded on the first close's `judged` event, and against public `main` as fetched in this session. No git command was run. Against `main`, besides the new oracle @@ -167,74 +201,97 @@ this unit. The first close had noted the other overtaken checks from reading the did not probe them or put them in a follow-up entry, so the amendment named only one. This close probed them (cases D to G). +The second close (2026-11-26T14:10Z) and the judge recorded `not_met`, and the driver filed +#3610. The operator replaced the single named exception with a general precedence rule in +`GATE-01.md`, the close unit's trigger and `docs/methodology.md`, and re-armed this unit. +No source or test change accompanied it. + T04 passed although its Verification section names `tests.test_lint_plan`, which does not exist. ## Cost analysis -Unit costs are from the `task_completed` events in `events.jsonl`. - -| Unit | Planned USD | Actual USD | Actual / planned | Attempts | -|---|---|---|---|---| -| T01 | 2.00 | 0.88 | 44% | 1 | -| T02 | 1.50 | 0.77 | 51% | 1 | -| T03 | 1.00 | 0.55 | 55% | 1 | -| T04 | 1.50 | 0.47 | 32% | 1 | -| Substantive total | 6.00 | 2.67 | 45% | 4 | -| G1-CLOSE, first close | 5.00 | 1.69 | 34% | 1 | -| G1-CLOSE, this re-close | (same plan line) | not yet recorded | — | in progress | - -Recorded unit spend is 4.37 USD. The first close's `judged` event also records a judge cost -of 0.44 USD; the events do not say whether the close's 1.69 includes it. The plan total is -11.00 and the gate budget 14.00. This session's cost and its judge's are written later. The -earlier `blocked_human` stop of this unit recorded 0.00. The review, its fixes and the -amendment happened outside the loop, so `events.jsonl` has no cost for them. +Unit costs are from the `task_completed` events in `events.jsonl`. For a close, the figure +includes its judge: `record_judge_cost_fold` adds the judge's usage to the attempt before +`attempt_outcome` is emitted. + +| Unit | Planned USD | Actual USD | Of which judge | Actual / planned | Attempts | +|---|---|---|---|---|---| +| T01 | 2.00 | 0.88 | — | 44% | 1 | +| T02 | 1.50 | 0.77 | — | 51% | 1 | +| T03 | 1.00 | 0.55 | — | 55% | 1 | +| T04 | 1.50 | 0.47 | — | 32% | 1 | +| Substantive total | 6.00 | 2.67 | — | 45% | 4 | +| G1-CLOSE, first close | 5.00 (one plan line for all closes) | 1.69 | 0.44 | 34% | 1 | +| G1-CLOSE, second close | (same line) | 1.49 | 0.48 | 30% | 1 | +| G1-CLOSE, third close | (same line) | not yet recorded | — | — | in progress | +| G1-CLOSE, two recorded closes | 5.00 | 3.18 | 0.92 | 64% | 2 | + +Recorded unit spend is 5.86 USD against a plan of 11.00 and a gate budget of 14.00. This +session's cost and its judge's are written later. The earlier `blocked_human` stop of this +unit recorded 0.00. The independent review, its fixes and both amendments happened outside +the loop, so `events.jsonl` has no cost for them. Two of the three closes were re-closes +forced by a precedence the plan had not stated. **T04's warning rate.** Re-measured this session over `done` units with `produces:`: the -shipped rule (path, file name or parent directory) would fire on 35 of 402, **8.7%** (same as the first close), under +shipped rule (path, file name or parent directory) would fire on 35 of 402, **8.7%**, under the 10% limit. Path or file name alone would fire on 81 of 402, 20.1%. T04 recorded 81 and 35 of 401 in the check's docstring; the population has since grown by one. T04's progress -note does not carry the count that its criterion 3 asked for in the RESULT notes, and this -session did not see that RESULT. The parent-directory match is a plain substring test, so a -short directory such as `tests` is satisfied by almost any body. The WARN is weak for such -paths. +note does not carry the count that its criterion 3 asked for in the RESULT notes. The +parent-directory match is a plain substring test, so a short directory such as `tests` is +satisfied by almost any body. The WARN is weak for such paths. ## Consumer-visible contract changes Pending human acknowledgment. Each has a `changelog.d/` fragment tracing to -`FEAT-LOOP-2026-0251`. This re-close added no fragment; it extended the first one in place -with the overtaken checks measured in cases D to G. +`FEAT-LOOP-2026-0251`. This close added no fragment; it extended the first one in place with +the rejected squash commit and the kept-tree effect. -1. **Changed:** the three deliverable refusals run before verification. An attempt that - would also have failed a gate, `files_changed_mismatch`, the smoke-import check, a - closing-deliverable guard or the blocked-verdict check is reported as the deliverable - refusal. +1. **Changed:** the three deliverable refusals run before verification. They take precedence + over every verification gate and later guard. An attempt that also would have failed one + is reported as the deliverable refusal. By default its tree is kept, including where the + old order reset it. 2. **Added:** `defaults.fail_fast_deliverables`, default `true`. 3. **Changed:** the retry note for the three refusals lists the changed paths, at most 20 plus a count. 4. **Added:** a `specfuse lint` WARN for a `produces:` path the unit's body never mentions. +## Notes for the human reviewer + +Neither note is a failed criterion. This unit may edit none of the files concerned. + +- **One sentence in `docs/methodology.md` is too strong.** It says "What is refused does not + change, only when." Probe case Q is an attempt that passes with the key `false` and is + refused with the default, because a gate writes the declared file. `PLAN.md` decision 6, + `verification.yml.example` and a changelog fragment describe the opt-out for this; that + paragraph of the methodology does not say when to set it. `PLAN.md` has the same sentence. +- **The side-effect list is incomplete.** `GATE-01.md` and `docs/methodology.md` name the + smoke-import and closing-deliverable refusals as ones that used to reset the tree. The + probe also saw the old order remove the attempt's file after a rejected squash commit, the + blocked-verdict check and a failed gate. The new behaviour follows clause 4 in each case. +- The rule's words "every check that runs after the agent session" mean, as `GATE-01.md` + goes on to say, the gates and later guards. A zero-token session and a `blocked` RESULT + are still decided first, in both orders (cases N and O). + ## What the loop did NOT verify - **A real project whose gates write a declared deliverable.** The opt-out is tested only - with stubs. With the default, such a unit is refused early on every attempt. + with stubs, probe case Q included. With the default, such a unit is refused early on every + attempt. - **Real refused attempts on the new build.** T01 to T04 ran on a build pinned before the - change (`bd7e508`). `events.jsonl` shows three later pins (`cddc418`, `eb30755`, - `b2513b4`), and both closes were dispatched after a later pin, so "every attempt ran on - the old build" holds for T01 to T04 and is not established for the closes. No event in - this feature shows a real early refusal, so no real saving in gate time is measured. -- Tree handling for early `deliverable_missing` and `no_deliverable_files` refusals. -- Tree handling in probe cases D, F and G; the difference stated above is from the code. -- The probe used a stubbed `verify`. `no_deliverable_files` was not paired with any - overtaken check. -- That cases A to G are the whole list of overtaken checks. The list comes from reading - `execute_unit_attempt()` and the post-squash guards in `run()`; a squash-commit failure, - for one, was not probed. -- Any unit's "fails on HEAD" claim, against a pre-feature tree. + change (`bd7e508`). Later pins exist and the closes were dispatched after them, but every + `attempt_outcome` in `events.jsonl` before this close is `passed`. No real early refusal + has happened, so no real saving in gate time is measured. +- The probe stubbed the agent session, `verify`, and (for H and P) the squash rejection. +- That cases A to Q are the whole list of overtaken checks. The list comes from reading + `execute_unit_attempt()` and the post-squash guards in `run()`. The general rule does not + depend on the list being complete; the claim that it holds rests on the early check running + before all of them. +- `learnings_not_staged` and the judge run after the three deliverable guards in the late + order too. This is read from the code, not probed. +- A full pre-feature tree: only the old `loop.py` was substituted. - Whether the pending-diff computation matches the squash diff for renames, submodules or - ignored files. Only the oracle's simple cases were run. + ignored files. +- The content of the pre-existing test edits was not compared again by this close. - `specfuse lint` as the installed command. The installed build differs from this tree, so the repository scripts were used. -- `docs/methodology.md` states the early order but names no precedence; this unit may not - edit it. Its line "What is refused does not change, only when" was not checked beyond - the probe cases. diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md index e7a572e1..6eb6a6a2 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md @@ -1,8 +1,9 @@ --- id: FEAT-LOOP-2026-0251/G1-CLOSE type: close -status: pending -attempts: 0 +status: done +verdict: met +attempts: 1 oracle_env: macos_local planned_cost_usd: 5.00 auto_close_disabled: true @@ -39,19 +40,19 @@ re_arm_history: prior_cost_usd: 1.489002 prior_duration_seconds: 259.427 reason: "1, go ahead" -cumulative_cost_usd: 1.69295 -cumulative_duration_seconds: 291.43 -cumulative_input_tokens: 70 -cumulative_output_tokens: 36654 -cumulative_attempts: 1 -cost_usd: 1.489002 -duration_seconds: 259.427 -input_tokens: 48 -output_tokens: 34844 -folded_through_re_arm: 2 +cumulative_cost_usd: 3.181952 +cumulative_duration_seconds: 550.857 +cumulative_input_tokens: 118 +cumulative_output_tokens: 71498 +cumulative_attempts: 2 +cost_usd: 1.161317 +duration_seconds: 379.569 +input_tokens: 40 +output_tokens: 34180 +folded_through_re_arm: 3 gate_set: plannext driver_version: 0.33.2 -started_at: 2026-11-26T13:59:19.394548+00:00 +started_at: 2026-11-26T15:32:04.468694+00:00 --- # G1-CLOSE — terminal close diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index c10bebac..a5e8455a 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -178,3 +178,5 @@ {"timestamp": "2026-11-26T15:32:03.990465+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "init-sh-shim-bats", "ok": true, "skipped": false, "duration_seconds": 1.328, "phase": "broad"}} {"timestamp": "2026-11-26T15:32:03.990471+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "init-skills-bats", "ok": true, "skipped": false, "duration_seconds": 0.239, "phase": "broad"}} {"timestamp": "2026-11-26T15:32:03.990472+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "hookspath-conflict-bats", "ok": true, "skipped": false, "duration_seconds": 1.02, "phase": "broad"}} +{"timestamp": "2026-11-26T15:32:04.195877+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "terminal_judge_editing_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "status": "clean", "reason": "acknowledged by operator: .specfuse/verification.yml.example, produces_driver_helper, specfuse/loop/data/verification.yml.example, specfuse/loop/lint_plan.py, specfuse/loop/loop.py"}} +{"timestamp": "2026-11-26T15:32:04.199854+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "terminal_judge_editing_acknowledged", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "close_unit": "FEAT-LOOP-2026-0251/G1-CLOSE", "paths": [".specfuse/verification.yml.example", "produces_driver_helper", "specfuse/loop/data/verification.yml.example", "specfuse/loop/lint_plan.py", "specfuse/loop/loop.py"], "reason": "Review fixes tested, full suite green, accept the generator risk"}} diff --git a/changelog.d/FEAT-LOOP-2026-0251-the-produces-not-in-diff-deliverable-mis.md b/changelog.d/FEAT-LOOP-2026-0251-the-produces-not-in-diff-deliverable-mis.md index a4dc88fa..eafea4e0 100644 --- a/changelog.d/FEAT-LOOP-2026-0251-the-produces-not-in-diff-deliverable-mis.md +++ b/changelog.d/FEAT-LOOP-2026-0251-the-produces-not-in-diff-deliverable-mis.md @@ -2,4 +2,4 @@ class: changed trace: FEAT-LOOP-2026-0251 --- -The `produces_not_in_diff`, `deliverable_missing` and `no_deliverable_files` refusals now run before the verification gates, so a refused attempt pays for no gate run. An attempt that also would have failed a gate, `files_changed_mismatch`, the smoke-import check, a closing-deliverable guard or the blocked-verdict check is now reported as the deliverable refusal instead +The `produces_not_in_diff`, `deliverable_missing` and `no_deliverable_files` refusals now run before the verification gates, so a refused attempt pays for no gate run. An attempt that also would have failed a gate, `files_changed_mismatch`, the smoke-import check, a closing-deliverable guard, the blocked-verdict check, the squash commit or any other check that runs after the agent session is now reported as the deliverable refusal instead. By default such an attempt keeps its working tree (`defaults.retain_on_guard_refusal`), even where the other refusal would have reset it From 9ce2791e4506a63ba9c005bfef7455ccfde00200 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 10:45:06 -0500 Subject: [PATCH 33/69] chore(loop): FEAT-LOOP-2026-0251/G1-CLOSE judge lowered verdict to not_met Feature: FEAT-LOOP-2026-0251/G1-CLOSE --- .../FOLLOW-UPS.md | 7 +++++++ .../WU-90-gate-1-close.md | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md index 925c1e22..9453ee2f 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md @@ -30,3 +30,10 @@ this session; the probe's case A agrees. 2026-11-26, covers edits forced by moving code into a shared helper and by new lint wording. The ten changed modules pass (68 tests, exit 0), and the two edits are named in `RETROSPECTIVE.md`. + +### T03#1 + +An attempt that changed nothing does not always say so. Under the default `retain_on_guard_refusal` (tree kept), attempt 1 writes `docs/notes.md` and is refused `produces_not_in_diff`. Attempt 2 writes nothing, yet its refusal note reads "Paths this attempt changed: - `docs/notes.md`" and not "this attempt changed no files". The list includes the retained edits of the earlier attempt, so definition-of-done clause 4 ("lists the paths this attempt changed, or says it changed none") does not hold. The same happens with `fail_fast_deliverables: false`. `test_attempt_that_changed_nothing_says_so` covers only a first attempt. + +- command: `HOME="$TMPDIR/judgehome" PYTHONPATH="$PWD:$TMPDIR/probe" python3 "$TMPDIR/probe/p.py"` (probe calls loop.run() with stubbed dispatch and verify, and prints each refusal note's path list; for both fail_fast True and False, attempt 2 printed `docs/notes.md`) +- exit: 0 diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md index 6eb6a6a2..78eea84c 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md @@ -2,7 +2,7 @@ id: FEAT-LOOP-2026-0251/G1-CLOSE type: close status: done -verdict: met +verdict: not_met attempts: 1 oracle_env: macos_local planned_cost_usd: 5.00 From 4f8d2d132df4647c7c342d7fdd4125ff10eefa36 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 10:45:06 -0500 Subject: [PATCH 34/69] chore(loop): FEAT-LOOP-2026-0251/G1-CLOSE judge cost fold Feature: FEAT-LOOP-2026-0251 --- .../WU-90-gate-1-close.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md index 78eea84c..6fffa6ef 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md @@ -45,10 +45,10 @@ cumulative_duration_seconds: 550.857 cumulative_input_tokens: 118 cumulative_output_tokens: 71498 cumulative_attempts: 2 -cost_usd: 1.161317 +cost_usd: 1.733084 duration_seconds: 379.569 -input_tokens: 40 -output_tokens: 34180 +input_tokens: 56 +output_tokens: 43124 folded_through_re_arm: 3 gate_set: plannext driver_version: 0.33.2 From 64e64bae12af70075d29477f59dba6e3173a9535 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 10:45:07 -0500 Subject: [PATCH 35/69] chore(loop): gate 1 awaiting_review Feature: FEAT-LOOP-2026-0251 --- .../GATE-01.md | 2 +- .../events.jsonl | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md index 04557652..a0290be8 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md @@ -1,6 +1,6 @@ --- gate: 1 -status: open +status: awaiting_review feature_oracle: "python3 -m unittest tests.test_fail_fast_deliverables -v -b" cost_budget_usd: 14.00 broad_run: diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index a5e8455a..5f95ae4a 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -180,3 +180,12 @@ {"timestamp": "2026-11-26T15:32:03.990472+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "hookspath-conflict-bats", "ok": true, "skipped": false, "duration_seconds": 1.02, "phase": "broad"}} {"timestamp": "2026-11-26T15:32:04.195877+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "terminal_judge_editing_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "status": "clean", "reason": "acknowledged by operator: .specfuse/verification.yml.example, produces_driver_helper, specfuse/loop/data/verification.yml.example, specfuse/loop/lint_plan.py, specfuse/loop/loop.py"}} {"timestamp": "2026-11-26T15:32:04.199854+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "terminal_judge_editing_acknowledged", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "close_unit": "FEAT-LOOP-2026-0251/G1-CLOSE", "paths": [".specfuse/verification.yml.example", "produces_driver_helper", "specfuse/loop/data/verification.yml.example", "specfuse/loop/lint_plan.py", "specfuse/loop/loop.py"], "reason": "Review fixes tested, full suite green, accept the generator risk"}} +{"timestamp": "2026-11-26T15:32:04.469750+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "task_started", "source": "driver", "source_version": "0.33.2", "payload": {"type": "close", "model": "sonnet", "re_arm_count": 3}} +{"timestamp": "2026-11-26T15:32:04.469767+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "re_arm_dispatched", "source": "driver", "source_version": "0.33.2", "payload": {"re_arm_count": 3, "reason": "1, go ahead"}} +{"timestamp": "2026-11-26T15:38:24.018279+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "plan-lint", "ok": true, "skipped": false, "duration_seconds": 0.131, "phase": "attempt"}} +{"timestamp": "2026-11-26T15:38:24.018307+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "feature_oracle", "ok": true, "skipped": false, "duration_seconds": 13.607, "phase": "attempt"}} +{"timestamp": "2026-11-26T15:45:06.916821+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "judged", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "close_verdict": "met", "close_model": "sonnet", "judge_verdict": "not_met", "verdict": "not_met", "lowered": true, "disagreed": true, "findings": 1, "reason": "judge lowered the verdict on 1 finding(s) (T03#1); the judge's own words are in features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md", "diff_base": "3bc8bef37e1903f18b2a48f78a44fb9a63600864", "diff_base_source": "merge-base of HEAD with main", "usage": {"cost_usd": 0.5717669000000001, "input_tokens": 16, "output_tokens": 8944, "cache_read_input_tokens": 631469, "cache_creation_input_tokens": 104787}, "findings_path": "features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md", "finding_criteria": ["T03#1"], "judge_cost_usd": 0.571767}} +{"timestamp": "2026-11-26T15:45:06.918509+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "attempt_outcome", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "outcome": "passed", "duration_seconds": 379.569, "agent_seconds": 365.70307041693013, "verify_seconds": 13.744761209003627, "cost_usd": 1.7330835000000002, "input_tokens": 56, "output_tokens": 43124, "cache_read_input_tokens": 2877115, "cache_creation_input_tokens": 253505, "model": "sonnet", "effort": "high", "failure_class": null, "failure_signature": null, "failure_excerpt": null, "files_touched": [".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md", ".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/LEARNINGS-pending.md", ".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/RETROSPECTIVE.md", ".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md", ".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl", "changelog.d/FEAT-LOOP-2026-0251-the-produces-not-in-diff-deliverable-mis.md"], "agent_status": "complete", "agent_blocked_reason": null, "re_arm_count": 0, "failing_tests": []}} +{"timestamp": "2026-11-26T15:45:06.918733+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "task_completed", "source": "driver", "source_version": "0.33.2", "payload": {"attempts": 1, "attempts_usage": [{"attempt": 1, "duration_seconds": 379.569, "cost_usd": 1.7330835000000002, "input_tokens": 56, "output_tokens": 43124, "cache_read_input_tokens": 2877115, "cache_creation_input_tokens": 253505, "agent_seconds": 365.70307041693013, "verify_seconds": 13.744761209003627}], "type": "close", "re_arm_count": 3, "cost_usd": 1.733084, "cumulative_cost_usd": 4.915036, "attempts_lifetime": 3, "planned_cost_usd": 5.0}} +{"timestamp": "2026-11-26T15:45:06.944080+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_reached", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1}} +{"timestamp": "2026-11-26T15:45:06.944069+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "arm_predicate_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "would_arm": true, "predicate_version": "v1", "classes": {"budget_projection": {"status": "clean", "reason": "projected spend $7.59 within 2.0x baseline planned total $11.00 (cap $22.00)"}, "judge_editing": {"status": "clean", "reason": "no drafted WU touches judge-path surfaces"}, "decision_class_paths": {"status": "clean", "reason": "no drafted WU touches a recognised dependency manifest (pyproject.toml, package.json, pom.xml, build.gradle, build.gradle.kts, Cargo.toml, go.mod, Gemfile, composer.json, requirements*.txt, *.csproj)"}, "retroactive_edits": {"status": "clean", "reason": "no passed-gate baseline WU altered or removed"}, "drift_caps": {"status": "clean", "reason": "added WUs and gates within drift caps"}, "missing_provenance": {"status": "clean", "reason": "no added WUs"}, "open_questions_human_only": {"status": "clean", "reason": "terminal gate: no drafted successor"}, "plan_next_lint": {"status": "clean", "reason": "plan-next lint: no findings"}}}} From f567393b82cd5694c8c5cde638a7958d04f057e2 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 10:45:10 -0500 Subject: [PATCH 36/69] =?UTF-8?q?chore(loop):=20FEAT-LOOP-2026-0251=20?= =?UTF-8?q?=E2=80=94=20record=20the=20follow-up=20issues=20the=20driver=20?= =?UTF-8?q?filed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md | 2 ++ .../FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl | 1 + 2 files changed, 3 insertions(+) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md index 9453ee2f..574f683b 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md @@ -33,6 +33,8 @@ The ten changed modules pass (68 tests, exit 0), and the two edits are named in ### T03#1 +**Tracked as #3612.** + An attempt that changed nothing does not always say so. Under the default `retain_on_guard_refusal` (tree kept), attempt 1 writes `docs/notes.md` and is refused `produces_not_in_diff`. Attempt 2 writes nothing, yet its refusal note reads "Paths this attempt changed: - `docs/notes.md`" and not "this attempt changed no files". The list includes the retained edits of the earlier attempt, so definition-of-done clause 4 ("lists the paths this attempt changed, or says it changed none") does not hold. The same happens with `fail_fast_deliverables: false`. `test_attempt_that_changed_nothing_says_so` covers only a first attempt. - command: `HOME="$TMPDIR/judgehome" PYTHONPATH="$PWD:$TMPDIR/probe" python3 "$TMPDIR/probe/p.py"` (probe calls loop.run() with stubbed dispatch and verify, and prints each refusal note's path list; for both fail_fast True and False, attempt 2 printed `docs/notes.md`) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index 5f95ae4a..b8466490 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -189,3 +189,4 @@ {"timestamp": "2026-11-26T15:45:06.918733+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "task_completed", "source": "driver", "source_version": "0.33.2", "payload": {"attempts": 1, "attempts_usage": [{"attempt": 1, "duration_seconds": 379.569, "cost_usd": 1.7330835000000002, "input_tokens": 56, "output_tokens": 43124, "cache_read_input_tokens": 2877115, "cache_creation_input_tokens": 253505, "agent_seconds": 365.70307041693013, "verify_seconds": 13.744761209003627}], "type": "close", "re_arm_count": 3, "cost_usd": 1.733084, "cumulative_cost_usd": 4.915036, "attempts_lifetime": 3, "planned_cost_usd": 5.0}} {"timestamp": "2026-11-26T15:45:06.944080+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_reached", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1}} {"timestamp": "2026-11-26T15:45:06.944069+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "arm_predicate_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "would_arm": true, "predicate_version": "v1", "classes": {"budget_projection": {"status": "clean", "reason": "projected spend $7.59 within 2.0x baseline planned total $11.00 (cap $22.00)"}, "judge_editing": {"status": "clean", "reason": "no drafted WU touches judge-path surfaces"}, "decision_class_paths": {"status": "clean", "reason": "no drafted WU touches a recognised dependency manifest (pyproject.toml, package.json, pom.xml, build.gradle, build.gradle.kts, Cargo.toml, go.mod, Gemfile, composer.json, requirements*.txt, *.csproj)"}, "retroactive_edits": {"status": "clean", "reason": "no passed-gate baseline WU altered or removed"}, "drift_caps": {"status": "clean", "reason": "added WUs and gates within drift caps"}, "missing_provenance": {"status": "clean", "reason": "no added WUs"}, "open_questions_human_only": {"status": "clean", "reason": "terminal gate: no drafted successor"}, "plan_next_lint": {"status": "clean", "reason": "plan-next lint: no findings"}}}} +{"timestamp": "2026-11-26T15:45:09.936641+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "followups_recorded", "source": "driver", "source_version": "0.33.2", "payload": {"filed": 1, "unfiled": 0, "already_tracked": 0, "issue_numbers": ["3612"], "written_back": ["FOLLOW-UPS.md"]}} From e61a5b9c43e5adbf55bbd55d46b3924ef27d12c9 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 10:56:23 -0500 Subject: [PATCH 37/69] fix(loop): retry note lists only the paths this attempt changed (#3612) With retain_on_guard_refusal keeping the tree, a later attempt's deliverable-refusal note listed the earlier attempt's kept edits as its own, so 'this attempt changed no files' never showed after attempt 1 (GATE-01 clause 4). The driver now snapshots the content digest of every already-dirty path at the start of each attempt (snapshot_dirty_tree) and the note lists only paths clean at that point or changed since (attempt_own_paths). The guards' diff and files_touched are unchanged. Co-Authored-By: Claude Opus 5.5 --- .../PLAN.md | 8 ++ specfuse/loop/loop.py | 64 ++++++++++++++-- tests/test_fail_fast_deliverables.py | 75 +++++++++++++++++++ 3 files changed, 141 insertions(+), 6 deletions(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PLAN.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PLAN.md index 2ed43679..fc611a5d 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PLAN.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PLAN.md @@ -130,3 +130,11 @@ gates: Accepted, not fixed: a deliverable that only a verification gate writes (a code generator, a formatter) is refused early on every attempt; `fail_fast_deliverables: false` is the remedy, and no in-loop test covers a gate-written deliverable. +- **Third-close follow-up (2026-11-26, #3612).** With the tree kept, a later attempt's retry note + listed the earlier attempt's kept edits as its own, so "this attempt changed no files" never + showed after the first attempt. The driver now snapshots the content of every already-dirty path + when each attempt starts (`snapshot_dirty_tree`) and the note lists only paths that were clean + then or have changed since (`attempt_own_paths`). The guards' own diff and the events' + `files_touched` are unchanged, so `detect_deterministic_refusal_repeat` is unaffected. Tested in + `TestTreeAndNote` (kept edits left out, nothing-changed stated, a re-edited kept file listed), + both with and without `fail_fast_deliverables`. diff --git a/specfuse/loop/loop.py b/specfuse/loop/loop.py index 2098ed3d..f7835e5f 100644 --- a/specfuse/loop/loop.py +++ b/specfuse/loop/loop.py @@ -3101,6 +3101,40 @@ def untracked_paths() -> set[str]: return {line.strip() for line in out.splitlines() if line.strip()} +def _path_digest(path: str) -> "str | None": + """SHA-256 of a file's bytes, or None when it is absent or unreadable.""" + try: + return hashlib.sha256(Path(path).read_bytes()).hexdigest() + except OSError: + return None + + +def snapshot_dirty_tree(head_before: str) -> "dict[str, str | None]": + """Content digest of every path that already differs from *head_before* + when an attempt starts (#3612). + + A refused attempt can keep its tree (`retain_on_guard_refusal`), so the + next attempt starts with the earlier attempt's edits on disk and the diff + its guards judge still names them. Taken before dispatch, this lets + `attempt_own_paths` tell those kept edits from what the attempt itself + changed. + """ + return {p: _path_digest(p) + for p in git_diff_names(head_before, "HEAD", worktree=True)} + + +def attempt_own_paths(changed: list, + tree_before: "dict[str, str | None] | None") -> list: + """*changed* without the paths an earlier, kept attempt left that this + attempt did not touch again (#3612). A path counts as this attempt's when + it was clean at the start of the attempt or its contents have changed + since. With no snapshot, *changed* is returned unchanged.""" + if not tree_before: + return list(changed) + return [p for p in changed + if p not in tree_before or _path_digest(p) != tree_before[p]] + + def ignored_paths() -> set[str]: """Repo-relative paths git reports as IGNORED, file by file. @@ -5235,7 +5269,8 @@ def persist_attempt_notes( CHANGED_PATHS_NOTE_CAP = 20 -def format_changed_paths(wu: "WorkUnit", changed: list) -> str: +def format_changed_paths(wu: "WorkUnit", changed: list, + tree_before: "dict | None" = None) -> str: """The retry-note listing of what a refused attempt changed (FEAT-LOOP-2026-0251/T03). @@ -5243,9 +5278,13 @@ def format_changed_paths(wu: "WorkUnit", changed: list) -> str: unit's file, `events.jsonl`, the progress note) is left out, as `assert_implementation_touched_files` leaves it out: the driver writes it on every attempt, so listing it would hide that the agent changed nothing. + + *tree_before* is the attempt-start snapshot (`snapshot_dirty_tree`): paths + a kept earlier attempt left, unchanged since, are not this attempt's and + are left out (#3612). """ paths = [ - t for t in changed + t for t in attempt_own_paths(changed, tree_before) if Path(t).name not in (wu.file.name, "events.jsonl", PROGRESS_FILENAME) ] if not paths: @@ -5259,6 +5298,7 @@ def format_changed_paths(wu: "WorkUnit", changed: list) -> str: def format_deliverable_missing_note( wu: "WorkUnit", summary: str, touched: "list | None", attempt: int, + tree_before: "dict | None" = None, ) -> str: """Compose the attempt note for a deliverable-presence refusal (#1412). @@ -5320,7 +5360,7 @@ def format_deliverable_missing_note( lines += ["", "## Files this attempt touched", ""] lines.append( "(unknown — git could not name this attempt's diff)" - if touched is None else format_changed_paths(wu, touched)) + if touched is None else format_changed_paths(wu, touched, tree_before)) lines.append("") return "\n".join(lines) @@ -11757,6 +11797,7 @@ def refuse_deliverable_missing( wu: WorkUnit, attempt: int, usage: dict, summary: str, touched: list[str], *, cfg: dict, head_before: str, events_path: Path, untracked_before, verification_ran: bool, changed: "list[str] | None", + tree_before: "dict | None" = None, ) -> "tuple[str, dict]": """Settle the tree and build the record of a `deliverable_missing` refusal for either call site. Returns ``(note, event)``. @@ -11767,7 +11808,8 @@ def refuse_deliverable_missing( # afterwards every declared path reads ABSENT and the note would lose the # one distinction it exists to record — which of the declared # deliverables the attempt did land (#1412). - note = format_deliverable_missing_note(wu, summary, changed, attempt) + note = format_deliverable_missing_note(wu, summary, changed, attempt, + tree_before=tree_before) if not verification_ran: note += _NOT_VERIFIED_NOTE note, retained = _resolve_guard_refusal_tree( @@ -11791,13 +11833,14 @@ def refuse_no_deliverable_files( wu: WorkUnit, attempt: int, usage: dict, summary: str, touched: list[str], *, cfg: dict, head_before: str, events_path: Path, untracked_before, verification_ran: bool, changed: "list[str] | None", + tree_before: "dict | None" = None, ) -> "tuple[str, dict]": """Settle the tree and build the record of a `no_deliverable_files` refusal for either call site. Returns ``(note, event)``.""" note = summary if changed is not None: note += ("\n\nPaths this attempt changed:\n" - + format_changed_paths(wu, changed)) + + format_changed_paths(wu, changed, tree_before)) if not verification_ran: note += _NOT_VERIFIED_NOTE note, retained = _resolve_guard_refusal_tree( @@ -11819,6 +11862,7 @@ def refuse_produces_not_in_diff( wu: WorkUnit, attempt: int, usage: dict, remaining: list[str], touched: list[str], *, cfg: dict, head_before: str, events_path: Path, untracked_before, verification_ran: bool, + tree_before: "dict | None" = None, ) -> "tuple[str, str, dict]": """Settle the tree and build the record of a `produces_not_in_diff` refusal for either call site. Returns ``(summary, note, event)``.""" @@ -11827,7 +11871,7 @@ def refuse_produces_not_in_diff( note += _NOT_VERIFIED_NOTE excerpt = extract_failure_excerpt(note) note += ("\n\nPaths this attempt changed:\n" - + format_changed_paths(wu, touched)) + + format_changed_paths(wu, touched, tree_before)) note, retained = _resolve_guard_refusal_tree( cfg, head_before, events_path, untracked_before, note, failure_class="produces_not_in_diff", @@ -13007,6 +13051,9 @@ def run( if attempt > 1 and failure_note: reason = failure_note.strip().splitlines()[0][:200] print(f" retry reason: {reason}") + # What a kept earlier attempt left on disk, so this + # attempt's retry note lists only its own changes (#3612). + tree_before = snapshot_dirty_tree(head_before) t0 = time.monotonic() wu.last_gate_results = [] outcome, payload, usage = execute_unit_attempt( @@ -13254,6 +13301,7 @@ def run( cfg=cfg, head_before=head_before, events_path=events_path, untracked_before=untracked_before, + tree_before=tree_before, verification_ran=False, )) wu_events.append(_prod_event) @@ -13280,6 +13328,7 @@ def run( cfg=cfg, head_before=head_before, events_path=events_path, untracked_before=untracked_before, + tree_before=tree_before, verification_ran=False, changed=payload["touched"], ) @@ -13498,6 +13547,7 @@ def run( cfg=cfg, head_before=head_before, events_path=events_path, untracked_before=untracked_before, + tree_before=tree_before, verification_ran=True, changed=(git_diff_names(head_before, sha) if sha else []), @@ -13537,6 +13587,7 @@ def run( cfg=cfg, head_before=head_before, events_path=events_path, untracked_before=untracked_before, + tree_before=tree_before, verification_ran=True, changed=touched, )) @@ -13579,6 +13630,7 @@ def run( cfg=cfg, head_before=head_before, events_path=events_path, untracked_before=untracked_before, + tree_before=tree_before, verification_ran=True, )) wu_events.append(_prod_event) diff --git a/tests/test_fail_fast_deliverables.py b/tests/test_fail_fast_deliverables.py index 19d09678..cb6cfd0e 100644 --- a/tests/test_fail_fast_deliverables.py +++ b/tests/test_fail_fast_deliverables.py @@ -437,6 +437,81 @@ def test_late_produces_refusal_lists_changed_paths(self): self.assertIn("- `docs/other.md`", note) self.assertNotIn("verification did not run", note) + def _second_attempt_note(self, second_act, fail_fast: bool = True) -> str: + """`loop.run()` with a kept tree: attempt 1 writes `docs/notes.md`, + attempt 2 runs *second_act*. Returns the note recorded for attempt 2 + (`work//attempt-2.md`, written when the unit halts).""" + _, fdir = self._workspace() + dispatched = [] + load = loop.load_verification + + def load_cfg(*args, **kwargs): + cfg = dict(load(*args, **kwargs)) + cfg["defaults"] = {"retain_on_guard_refusal": True, + "fail_fast_deliverables": fail_fast} + return cfg + + def dispatch(wu, note, cost_tracking=True): + if wu.body.startswith(loop._REPLAN_BRIEF_MARKER): + return "# T01\n\nRe-planned body.\n" + if wu.wu_id == T01: + dispatched.append(note) + if len(dispatched) == 1: + Path("docs").mkdir(exist_ok=True) + Path("docs/notes.md").write_text("notes\n") + elif len(dispatched) == 2: + second_act() + return _COMPLETE + + self._patch("load_verification", load_cfg) + self._patch("dispatch", dispatch) + self._patch("verify", lambda wu, fd, cfg=None: (True, "(stub)")) + self.assertEqual(loop.run(None, dry_run=False), 1) + for name, original in reversed(self._patches): + setattr(loop, name, original) + self._patches.clear() + return (fdir / "work" / T01.replace("/", "_") / + "attempt-2.md").read_text() + + @staticmethod + def _path_list(note: str) -> str: + """The note's "Paths this attempt changed" list, without the retained + diff that follows it.""" + return (note.split("Paths this attempt changed:\n", 1)[1] + .split("\n\n", 1)[0]) + + def test_kept_edits_of_an_earlier_attempt_are_not_listed(self): + # #3612: with the tree kept, the diff the guard judges still holds + # attempt 1's `docs/notes.md`; the note must list only what attempt 2 + # itself changed. + def write_second(): + Path("docs/second.md").write_text("second\n") + + for fail_fast in (True, False): + with self.subTest(fail_fast=fail_fast): + note = self._second_attempt_note(write_second, + fail_fast=fail_fast) + listed = self._path_list(note) + self.assertIn("- `docs/second.md`", listed) + self.assertNotIn("docs/notes.md", listed) + + def test_later_attempt_that_changed_nothing_says_so(self): + for fail_fast in (True, False): + with self.subTest(fail_fast=fail_fast): + note = self._second_attempt_note(lambda: None, + fail_fast=fail_fast) + listed = self._path_list(note) + self.assertIn("this attempt changed no files", listed) + self.assertNotIn("docs/notes.md", listed) + + def test_editing_a_kept_file_again_lists_it(self): + def rewrite_notes(): + Path("docs/notes.md").write_text("notes, revised\n") + + note = self._second_attempt_note(rewrite_notes) + listed = self._path_list(note) + self.assertIn("- `docs/notes.md`", listed) + def test_list_is_capped_at_twenty(self): def thirty(): Path("docs").mkdir(exist_ok=True) From 30f2552f8e483de13cab280d3f4cdd56cf48f525 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 11:08:13 -0500 Subject: [PATCH 38/69] =?UTF-8?q?chore(loop):=20FEAT-LOOP-2026-0251=20?= =?UTF-8?q?=E2=80=94=20re-arm=20the=20close=20after=20the=20#3612=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- .../GATE-01.md | 2 +- .../WU-90-gate-1-close.md | 20 +++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md index a0290be8..04557652 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md @@ -1,6 +1,6 @@ --- gate: 1 -status: awaiting_review +status: open feature_oracle: "python3 -m unittest tests.test_fail_fast_deliverables -v -b" cost_budget_usd: 14.00 broad_run: diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md index 6fffa6ef..3eb3cee2 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md @@ -1,9 +1,8 @@ --- id: FEAT-LOOP-2026-0251/G1-CLOSE type: close -status: done -verdict: not_met -attempts: 1 +status: pending +attempts: 0 oracle_env: macos_local planned_cost_usd: 5.00 auto_close_disabled: true @@ -17,7 +16,7 @@ judge_edit_acknowledged: - specfuse/loop/lint_plan.py - specfuse/loop/loop.py reason: "Review fixes tested, full suite green, accept the generator risk" -re_arm_count: 3 +re_arm_count: 4 re_arm_history: - timestamp: 2026-11-26T13:30:05+00:00 @@ -40,6 +39,13 @@ re_arm_history: prior_cost_usd: 1.489002 prior_duration_seconds: 259.427 reason: "1, go ahead" + - + timestamp: 2026-11-26T16:08:13+00:00 + prior_status: done + prior_attempts: 1 + prior_cost_usd: 1.733084 + prior_duration_seconds: 379.569 + reason: "Trying to fix the last issue" cumulative_cost_usd: 3.181952 cumulative_duration_seconds: 550.857 cumulative_input_tokens: 118 @@ -99,3 +105,9 @@ closing-deliverable checks). The operator chose to state one general precedence `GATE-01.md`, in the escalation trigger above and in `docs/methodology.md`, together with the kept-tree side effect. Update `RETROSPECTIVE.md`, `FOLLOW-UPS.md` and the other closing files in place as before, and say in `FOLLOW-UPS.md` whether #3610's re-run condition now holds. + +**Third re-close note (2026-11-26).** The third close's judge recorded `not_met` on #3612: with +the tree kept, a later attempt's retry note listed the earlier attempt's kept edits as its own +(clause 4). Fixed on the branch (`snapshot_dirty_tree`, `attempt_own_paths` in `loop.py`; tests +in `TestTreeAndNote`; see `PLAN.md` Notes). Update the closing files in place as before, and say +in `FOLLOW-UPS.md` whether #3612's re-run condition now holds. From 6e7cdab7cbba4a5ad6e004ebbb04b4663b49bbd9 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 11:08:15 -0500 Subject: [PATCH 39/69] chore(loop): FEAT-LOOP-2026-0251 build pin recorded Feature: FEAT-LOOP-2026-0251 --- .../FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl | 1 + 1 file changed, 1 insertion(+) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index b8466490..f21452f6 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -190,3 +190,4 @@ {"timestamp": "2026-11-26T15:45:06.944080+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_reached", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1}} {"timestamp": "2026-11-26T15:45:06.944069+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "arm_predicate_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "would_arm": true, "predicate_version": "v1", "classes": {"budget_projection": {"status": "clean", "reason": "projected spend $7.59 within 2.0x baseline planned total $11.00 (cap $22.00)"}, "judge_editing": {"status": "clean", "reason": "no drafted WU touches judge-path surfaces"}, "decision_class_paths": {"status": "clean", "reason": "no drafted WU touches a recognised dependency manifest (pyproject.toml, package.json, pom.xml, build.gradle, build.gradle.kts, Cargo.toml, go.mod, Gemfile, composer.json, requirements*.txt, *.csproj)"}, "retroactive_edits": {"status": "clean", "reason": "no passed-gate baseline WU altered or removed"}, "drift_caps": {"status": "clean", "reason": "added WUs and gates within drift caps"}, "missing_provenance": {"status": "clean", "reason": "no added WUs"}, "open_questions_human_only": {"status": "clean", "reason": "terminal gate: no drafted successor"}, "plan_next_lint": {"status": "clean", "reason": "plan-next lint: no findings"}}}} {"timestamp": "2026-11-26T15:45:09.936641+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "followups_recorded", "source": "driver", "source_version": "0.33.2", "payload": {"filed": 1, "unfiled": 0, "already_tracked": 0, "issue_numbers": ["3612"], "written_back": ["FOLLOW-UPS.md"]}} +{"timestamp": "2026-11-26T16:08:15.852478+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "driver_build_pinned", "source": "driver", "source_version": "0.33.2", "payload": {"tree": "ffb4d96678f486c0a32f6e79d42017df2eea2eef", "path": "/private/var/folders/zc/rgq11x850d78dx_kf1fd4vx80000gn/T/specfuse-pins/ffb4d96678f486c0a32f6e79d42017df2eea2eef/specfuse/loop"}} From 543b99f310a93027533664bbbc5295d5999e4eb2 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 11:17:14 -0500 Subject: [PATCH 40/69] chore(loop): gate 1 broad run clean Feature: FEAT-LOOP-2026-0251 --- .../GATE-01.md | 4 ++-- .../events.jsonl | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md index 04557652..70f337d3 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md @@ -4,8 +4,8 @@ status: open feature_oracle: "python3 -m unittest tests.test_fail_fast_deliverables -v -b" cost_budget_usd: 14.00 broad_run: - tree: 07bbf72d1e7af3c1a03af605f40e5563dc3a18db:0ec7c6da6e74f0b56753f09657b654a6d289b91b:12064a6191eeb830a9826d911a8543fbaba3da75:1a8258cf8dd2af85aa66b31c9d341781000b1229:27968248a450a842ccd187b7dce0fb0ded934866:287efde8f90320baffac08f5f3287b9456a65cb9:2e29b2f7e073a0cbe290f01d3b397e1cdd10c81c:42796ea0e0a6c03811b0e4bc9dbd3b5ee62dd2e4:4acc6dfc5e8cece358c167d876515eba4a39a500:56ae45adcc17a1292977c436fd195ef8c61cc9e4:5a3f321ad3cdb33ab16e1356d0f149be66301b74:834d9d9c16094a386cd9b5a6f9ced9a3a9b4e7fb:bbd1aea514612d76722a18c7aece7c767cf1a076:c23b62e87f1ae3890c6f9e3d8c7ca7ec9225ed81:cab62f76bd04445beb1bf0786c2ee8df617496bb:caffe2d63ceacde448842a91bc7a12c206a67523:d74b7d113b844e84f0009098f576fd28477f072d:e3b0de29b81a6c8e0abeacb3898519b98014b9ef:fa2f4f88657587b6e3b560977858810846b1d366 - ran_at: 2026-11-26T15:32:03.970343+00:00 + tree: 07bbf72d1e7af3c1a03af605f40e5563dc3a18db:0ec7c6da6e74f0b56753f09657b654a6d289b91b:12064a6191eeb830a9826d911a8543fbaba3da75:27968248a450a842ccd187b7dce0fb0ded934866:287efde8f90320baffac08f5f3287b9456a65cb9:2e29b2f7e073a0cbe290f01d3b397e1cdd10c81c:39af52f10c10bdafeeb3c29122f2cd7398be4e88:42796ea0e0a6c03811b0e4bc9dbd3b5ee62dd2e4:4acc6dfc5e8cece358c167d876515eba4a39a500:56ae45adcc17a1292977c436fd195ef8c61cc9e4:834d9d9c16094a386cd9b5a6f9ced9a3a9b4e7fb:9969252df1bf38a0eb154eff3019a39c7c2e20fa:bbd1aea514612d76722a18c7aece7c767cf1a076:c23b62e87f1ae3890c6f9e3d8c7ca7ec9225ed81:caffe2d63ceacde448842a91bc7a12c206a67523:d74b7d113b844e84f0009098f576fd28477f072d:e3b0de29b81a6c8e0abeacb3898519b98014b9ef:ee0bd0a3eced139daf2fde311af364799729b48d:fa2f4f88657587b6e3b560977858810846b1d366 + ran_at: 2026-11-26T16:17:14.521398+00:00 ok: true failing: [] --- diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index f21452f6..3c69425d 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -191,3 +191,22 @@ {"timestamp": "2026-11-26T15:45:06.944069+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "arm_predicate_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "would_arm": true, "predicate_version": "v1", "classes": {"budget_projection": {"status": "clean", "reason": "projected spend $7.59 within 2.0x baseline planned total $11.00 (cap $22.00)"}, "judge_editing": {"status": "clean", "reason": "no drafted WU touches judge-path surfaces"}, "decision_class_paths": {"status": "clean", "reason": "no drafted WU touches a recognised dependency manifest (pyproject.toml, package.json, pom.xml, build.gradle, build.gradle.kts, Cargo.toml, go.mod, Gemfile, composer.json, requirements*.txt, *.csproj)"}, "retroactive_edits": {"status": "clean", "reason": "no passed-gate baseline WU altered or removed"}, "drift_caps": {"status": "clean", "reason": "added WUs and gates within drift caps"}, "missing_provenance": {"status": "clean", "reason": "no added WUs"}, "open_questions_human_only": {"status": "clean", "reason": "terminal gate: no drafted successor"}, "plan_next_lint": {"status": "clean", "reason": "plan-next lint: no findings"}}}} {"timestamp": "2026-11-26T15:45:09.936641+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "followups_recorded", "source": "driver", "source_version": "0.33.2", "payload": {"filed": 1, "unfiled": 0, "already_tracked": 0, "issue_numbers": ["3612"], "written_back": ["FOLLOW-UPS.md"]}} {"timestamp": "2026-11-26T16:08:15.852478+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "driver_build_pinned", "source": "driver", "source_version": "0.33.2", "payload": {"tree": "ffb4d96678f486c0a32f6e79d42017df2eea2eef", "path": "/private/var/folders/zc/rgq11x850d78dx_kf1fd4vx80000gn/T/specfuse-pins/ffb4d96678f486c0a32f6e79d42017df2eea2eef/specfuse/loop"}} +{"timestamp": "2026-11-26T16:17:14.529321+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "broad_run_result", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "tree": "07bbf72d1e7af3c1a03af605f40e5563dc3a18db:0ec7c6da6e74f0b56753f09657b654a6d289b91b:12064a6191eeb830a9826d911a8543fbaba3da75:27968248a450a842ccd187b7dce0fb0ded934866:287efde8f90320baffac08f5f3287b9456a65cb9:2e29b2f7e073a0cbe290f01d3b397e1cdd10c81c:39af52f10c10bdafeeb3c29122f2cd7398be4e88:42796ea0e0a6c03811b0e4bc9dbd3b5ee62dd2e4:4acc6dfc5e8cece358c167d876515eba4a39a500:56ae45adcc17a1292977c436fd195ef8c61cc9e4:834d9d9c16094a386cd9b5a6f9ced9a3a9b4e7fb:9969252df1bf38a0eb154eff3019a39c7c2e20fa:bbd1aea514612d76722a18c7aece7c767cf1a076:c23b62e87f1ae3890c6f9e3d8c7ca7ec9225ed81:caffe2d63ceacde448842a91bc7a12c206a67523:d74b7d113b844e84f0009098f576fd28477f072d:e3b0de29b81a6c8e0abeacb3898519b98014b9ef:ee0bd0a3eced139daf2fde311af364799729b48d:fa2f4f88657587b6e3b560977858810846b1d366", "ok": true, "failing": []}} +{"timestamp": "2026-11-26T16:17:14.529434+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "tests", "ok": true, "skipped": false, "duration_seconds": 472.148, "phase": "broad"}} +{"timestamp": "2026-11-26T16:17:14.529441+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "lint", "ok": true, "skipped": false, "duration_seconds": 0.155, "phase": "broad"}} +{"timestamp": "2026-11-26T16:17:14.529444+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "security", "ok": true, "skipped": false, "duration_seconds": 2.785, "phase": "broad"}} +{"timestamp": "2026-11-26T16:17:14.529454+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "coverage", "ok": true, "skipped": false, "duration_seconds": 2.234, "phase": "broad"}} +{"timestamp": "2026-11-26T16:17:14.529457+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "leak-scan", "ok": true, "skipped": false, "duration_seconds": 32.726, "phase": "broad"}} +{"timestamp": "2026-11-26T16:17:14.529459+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "changelog-fragments", "ok": true, "skipped": false, "duration_seconds": 0.115, "phase": "broad"}} +{"timestamp": "2026-11-26T16:17:14.529463+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "agent-policy-example-lint", "ok": true, "skipped": false, "duration_seconds": 0.182, "phase": "broad"}} +{"timestamp": "2026-11-26T16:17:14.529465+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "event-type-gate", "ok": true, "skipped": false, "duration_seconds": 0.278, "phase": "broad"}} +{"timestamp": "2026-11-26T16:17:14.529470+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "roadmap-link-gate", "ok": true, "skipped": false, "duration_seconds": 0.119, "phase": "broad"}} +{"timestamp": "2026-11-26T16:17:14.529473+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "arm-sweep-gate", "ok": true, "skipped": false, "duration_seconds": 0.638, "phase": "broad"}} +{"timestamp": "2026-11-26T16:17:14.529475+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "monitoring-example-lint", "ok": true, "skipped": false, "duration_seconds": 0.074, "phase": "broad"}} +{"timestamp": "2026-11-26T16:17:14.529476+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "leak-scan-hook", "ok": true, "skipped": false, "duration_seconds": 1.419, "phase": "broad"}} +{"timestamp": "2026-11-26T16:17:14.529480+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "pre-push-hook", "ok": true, "skipped": false, "duration_seconds": 5.255, "phase": "broad"}} +{"timestamp": "2026-11-26T16:17:14.529482+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "sync-scaffold-bats", "ok": true, "skipped": false, "duration_seconds": 16.655, "phase": "broad"}} +{"timestamp": "2026-11-26T16:17:14.529483+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "sync-scaffold-symlinks-bats", "ok": true, "skipped": false, "duration_seconds": 2.045, "phase": "broad"}} +{"timestamp": "2026-11-26T16:17:14.529484+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "init-sh-shim-bats", "ok": true, "skipped": false, "duration_seconds": 0.897, "phase": "broad"}} +{"timestamp": "2026-11-26T16:17:14.529485+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "init-skills-bats", "ok": true, "skipped": false, "duration_seconds": 0.148, "phase": "broad"}} +{"timestamp": "2026-11-26T16:17:14.529487+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "hookspath-conflict-bats", "ok": true, "skipped": false, "duration_seconds": 0.615, "phase": "broad"}} From 506d033d5404bf73c6ee1b55cce562111cf9ffae Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 11:25:13 -0500 Subject: [PATCH 41/69] =?UTF-8?q?feat:=20G1-CLOSE=20=E2=80=94=20terminal?= =?UTF-8?q?=20close?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Feature: FEAT-LOOP-2026-0251/G1-CLOSE --- .../FOLLOW-UPS.md | 61 +++++- .../LEARNINGS-pending.md | 9 +- .../PROGRESS.md | 2 + .../RETROSPECTIVE.md | 188 ++++++++++-------- .../WU-90-gate-1-close.md | 27 +-- .../events.jsonl | 2 + ...he-retry-note-for-the-three-deliverable.md | 2 +- 7 files changed, 186 insertions(+), 105 deletions(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md index 574f683b..9affe4bb 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md @@ -1,11 +1,56 @@ # Follow-ups — FEAT-LOOP-2026-0251 -Third close, 2026-11-26. No entry is open. All three re-run conditions hold. Two wording -gaps that are not failed criteria are in `RETROSPECTIVE.md` under "Notes for the human -reviewer". +Fourth close, 2026-11-26. One entry is open, below. The re-run conditions of #3608, #3609, +#3610 and #3612 hold. + +### T03#1 — a kept file that an attempt deletes or reverts is missing from its retry note + +**Criterion** (`GATE-01.md`, clause 4): "**Tree and note.** An early refusal keeps or resets +the tree per `defaults.retain_on_guard_refusal`, as the late refusal does; its retry note +states that verification did not run and lists the paths this attempt changed (or says it +changed none)." + +**Evidence.** A probe drove `loop.run()` over the oracle's fixture with stubbed dispatch and +`verify` and a kept tree, with `fail_fast_deliverables` both true and false (same results). +It exited 0 and read the path list in the note for attempt 2: + +- attempt 1 writes `docs/notes.md`, attempt 2 deletes it: "(none — this attempt changed no + files)"; +- attempt 1 edits tracked `docs/tracked.md`, attempt 2 restores its old content: the same + "(none)" line; +- attempt 1 writes `docs/notes.md`, attempt 2 deletes it and writes `docs/second.md`: only + `docs/second.md`. + +`python3 -m unittest tests.test_fail_fast_deliverables -b` exits 0 (33 tests); no test +covers these cases. The cause is that `attempt_own_paths` filters the diff the guard judged, +and a removed or restored file has left that diff. The gap is not new with the #3612 fix: +by the code, the earlier listing used the same diff. + +**Re-run condition.** Either of these: + +- the note lists a kept file the attempt deleted or reverted, and does not say "changed no + files" in that case, shown by a test for each, with fail-fast on and off. A likely fix: + also take every path in the attempt-start snapshot that is no longer in the diff and whose + digest has changed; +- or the operator amends clause 4 to say the list covers only paths still in the diff, and + the note's "changed no files" wording is changed so that it does not claim more. + +The first is recommended: it is a small change, and the current line tells the next session +something false. ## Resolved +#### A later attempt's note listed the earlier attempt's kept edits as its own + +**Tracked as #3612.** **Re-run condition holds** for the case the entry describes. Attempt 2 +writing nothing now gets "this attempt changed no files", and attempt 2 writing another file +gets only that file, with fail-fast on and off +(`test_later_attempt_that_changed_nothing_says_so`, +`test_kept_edits_of_an_earlier_attempt_are_not_listed`, +`test_editing_a_kept_file_again_lists_it`; probe cases R0 and R3). With the filter removed in +a scratch copy, `TestTreeAndNote` gives 4 failures. The entry named no deletion or revert; +that is the open entry above. + #### The early refusal also outranks three other checks, and no precedence is stated for them **Tracked as #3610.** **Re-run condition holds** (first branch). `GATE-01.md` ("Precedence @@ -31,11 +76,5 @@ this session; the probe's case A agrees. The ten changed modules pass (68 tests, exit 0), and the two edits are named in `RETROSPECTIVE.md`. -### T03#1 - -**Tracked as #3612.** - -An attempt that changed nothing does not always say so. Under the default `retain_on_guard_refusal` (tree kept), attempt 1 writes `docs/notes.md` and is refused `produces_not_in_diff`. Attempt 2 writes nothing, yet its refusal note reads "Paths this attempt changed: - `docs/notes.md`" and not "this attempt changed no files". The list includes the retained edits of the earlier attempt, so definition-of-done clause 4 ("lists the paths this attempt changed, or says it changed none") does not hold. The same happens with `fail_fast_deliverables: false`. `test_attempt_that_changed_nothing_says_so` covers only a first attempt. - -- command: `HOME="$TMPDIR/judgehome" PYTHONPATH="$PWD:$TMPDIR/probe" python3 "$TMPDIR/probe/p.py"` (probe calls loop.run() with stubbed dispatch and verify, and prints each refusal note's path list; for both fail_fast True and False, attempt 2 printed `docs/notes.md`) -- exit: 0 +The fourth close reran the probes behind #3608 and #3610 and the tests behind #3609; all +three conditions still hold. diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/LEARNINGS-pending.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/LEARNINGS-pending.md index c9b0d75c..4734b6f9 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/LEARNINGS-pending.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/LEARNINGS-pending.md @@ -6,7 +6,7 @@ Licensed under the Apache License, Version 2.0. See LICENSE. # Lessons staged for promotion — FEAT-LOOP-2026-0251 `autonomy_default: auto`, so `FEAT-LOOP-2026-0251/G1-CLOSE` may not append to -`.specfuse/LEARNINGS.md` directly (`assert_learnings_staged_under_auto`). Two entries generalize. +`.specfuse/LEARNINGS.md` directly (`assert_learnings_staged_under_auto`). Three entries generalize. ## Entries @@ -25,3 +25,10 @@ Licensed under the Apache License, Version 2.0. See LICENSE. lint output on the word "directory"; the new WARN contained it, the narrow tier passed, and the gate's broad run went red. The named module (`tests.test_lint_plan`) did not exist, so check that each module a unit names can be imported before arming. + +- [FEAT-LOOP-2026-0251/T03] **A "what this attempt changed" list cannot be a filter over the + diff against HEAD.** On a kept tree, a file the attempt deletes or restores leaves that + diff, and the list then says nothing changed. Compare the attempt-start and attempt-end + states over the union of their paths. Test write, edit, delete and revert on a second + attempt; a "changed nothing" test on a first attempt proves none of them. + diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md index 3723c57e..d9b89469 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md @@ -10,3 +10,5 @@ - note: The operator must decide the one open FOLLOW-UPS.md entry (recommended: one general precedence rule in GATE-01.md, the close trigger and docs/methodology.md) and acknowledge the four consumer-visible changes; the re-run conditions for - **FEAT-LOOP-2026-0251/G1-CLOSE**: Updated the gate 1 close files for the third close after a fresh early-versus-late probe, recorded advisory verdict met, and extended one existing changelog fragment. - note: docs/methodology.md still says "What is refused does not change, only when", which is not true for a gate-written deliverable under the default (probe case Q). +- **FEAT-LOOP-2026-0251/G1-CLOSE**: Fourth close of gate 1 records not_met because the retry note omits a kept file that a later attempt deleted or reverted, and can then say the attempt changed no files (clause 4); closing files updated in place. + - note: Fix by also listing attempt-start snapshot paths that left the diff and whose digest changed, with delete and revert tests; separately, a non-ASCII changed filename on a kept tree crashes git add -N, which also happens on the pre-feature loop.py. diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/RETROSPECTIVE.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/RETROSPECTIVE.md index cb8ab1ad..68b82850 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/RETROSPECTIVE.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/RETROSPECTIVE.md @@ -4,23 +4,49 @@ ## Verdict -`met` (advisory; the judge concludes). This is the third close of the gate. #3608, #3609 and -#3610 are settled by the operator's two amendments to `GATE-01.md`. A fresh probe found no -early-against-late difference other than a deliverable refusal winning over a later check or -a verification gate. One limit of that reading: when a gate itself writes the declared file -(probe case Q), there is no late refusal at all. `PLAN.md` decision 6 designed the opt-out -for that case. Two wording gaps are listed under "Notes for the human reviewer". +`not_met` (advisory; the judge concludes). Definition-of-done clause 4 does not hold in one +case. With the tree kept, an attempt that deletes or reverts a file an earlier attempt left +is not told so: the note omits the path, and when that is all the attempt did, the note says +"this attempt changed no files" (probe cases R1, R2, R5 below). The #3612 case itself is +fixed. This is the fourth close of the gate. Follow-up: `FOLLOW-UPS.md`. ## Measurements -All commands ran fresh in this third close on the working tree. Runs that drive `loop.run()` -used `HOME` under `$TMPDIR`, because the sandbox blocks writes to the real session directory. +All commands ran fresh in this fourth close on the working tree, unless a line says +otherwise. Test runs and probes used `HOME` under `$TMPDIR` with a stub git identity. With +the real `HOME`, the sandbox blocks the driver's preflight write under the session +directory (`PermissionError ... .specfuse-preflight-probe`), and the oracle reported 21 +errors for that reason. ### feature_oracle: PASS -`python3 -m unittest tests.test_fail_fast_deliverables -v -b`: exit 0, `Ran 30 tests`, `OK`, +`python3 -m unittest tests.test_fail_fast_deliverables -v -b`: exit 0, `Ran 33 tests`, `OK`, no skips. `grep -c "unittest.skip" tests/test_fail_fast_deliverables.py` prints `0`. A search of that file for `unittest.skip`, `skipIf`, `skipUnless`, `skipTest` and `@skip` finds nothing. +The oracle passes and does not cover the clause 4 gap below. + +### Retry note on a kept tree (#3612 and beyond it) + +A throwaway probe drove `loop.run()` over the oracle's fixture with +`retain_on_guard_refusal: true`, stubbed agent session and `verify`, and read the path list +in the note recorded for attempt 2. Each case gave the same result with fail-fast on and off. + +| Case | Attempt 1 | Attempt 2 | Attempt 2's note lists | Correct | +|---|---|---|---|---| +| R0 | writes `docs/notes.md` | writes `docs/second.md` | `docs/second.md` | yes | +| R1 | writes `docs/notes.md` | deletes it | "(none — this attempt changed no files)" | **no** | +| R2 | edits tracked `docs/tracked.md` | restores its old content | "(none — this attempt changed no files)" | **no** | +| R3 | edits tracked `docs/tracked.md` | edits it again | `docs/tracked.md` | yes | +| R5 | writes `docs/notes.md` | deletes it, writes `docs/second.md` | `docs/second.md` only | **no** | + +Cause, from the code: `attempt_own_paths` only filters the diff the guard judged. A deleted +untracked file and a file restored to its old content are no longer in that diff, so the +filter never sees them, although the attempt-start snapshot holds both. + +A sixth case, R4 (a new file with a non-ASCII name, kept tree), did not produce a note: +`loop.run()` raised `CalledProcessError` from `git add -N` on the quoted path, in +`retain_tree_after_refusal`. The same probe on the pre-feature `loop.py` (pinned build +`bd7e508`) raises the same error from the same function, so this feature did not introduce it. ### Other oracles @@ -36,44 +62,39 @@ of that file for `unittest.skip`, `skipIf`, `skipUnless`, `skipTest` and `@skip` | `python3 -m specfuse.loop.changelog_fragments check` | exit 0 | This session did not run the full suite or coverage. The driver's broad run recorded at -2026-11-26T15:32:03Z has `ok: true` and no failing gate. Its tests log -(`work/gate-logs/`, stamp `20261126T153058`) shows `Ran 5144 tests`, `OK (skipped=4)`; the -coverage log of the same run shows 92% total. +2026-11-26T16:17:14Z has `ok: true` and no failing gate. Its tests log +(`work/gate-logs/`, stamp `20261126T161608`) shows `Ran 5147 tests`, `OK (skipped=4)`; the +latest coverage log shows 92% total. ### Controls: the oracle observes the feature -**Opt-out mutation.** With `resolve_fail_fast_deliverables` forced to return `False`, 13 of -the 30 oracle tests fail, with no errors: `TestOptOut` 4, `TestPresenceEarly` 3, -`TestProducesNotInDiffEarly` 3, `TestTreeAndNote` 2, `TestEarlyRefusalRecovery` 1. - -**Pre-feature driver.** A scratch copy of the current package and tests, with `loop.py` -replaced by the one in the pinned build `bd7e508` (cut before T01; it contains no -`fail_fast_deliverables`). This is not a full pre-feature tree. +Each mutation ran in a scratch copy of the package, tests and `.specfuse/` (without the +feature folders). The unmodified copy ran the 33 oracle tests: `OK`. -| Class | Tests run | Result on the old driver | -|---|---|---| -| `TestProducesNotInDiffEarly` | 6 | 6 errors: 5 unknown argument `untracked_before`, 1 missing `early_produces_refusal` | -| `TestPresenceEarly` | 3 | 3 errors: unknown argument `untracked_before` | -| `TestOptOut` | 4 | 3 assertion failures (`1 != 0`), 1 missing resolver | -| `TestTreeAndNote` | 6 | 7 assertion failures (subtests counted) | +| Mutation | Result | +|---|---| +| `resolve_fail_fast_deliverables` forced to return `False` | 13 failures, no errors: `TestOptOut` 4, `TestPresenceEarly` 3, `TestProducesNotInDiffEarly` 3, `TestTreeAndNote` 2, `TestEarlyRefusalRecovery` 1 | +| `attempt_own_paths` returns its input unfiltered (#3612 undone) | `TestTreeAndNote`, 9 tests: 4 failures, e.g. `'docs/notes.md' unexpectedly found` | +| `check_produces_mentioned` made a no-op | `TestArmTimeWarning`, 6 tests: 2 failures (the other four expect silence) | +| `loop.py` replaced by the pre-feature one (`bd7e508`, no `fail_fast_deliverables`) | 33 tests: 12 failures, 18 errors (subtests counted) | -The errors in the first two rows show a missing interface, not wrong behaviour. The mutation -control above is the behaviour evidence for those two classes. For `TestArmTimeWarning`, -with `check_produces_mentioned` replaced by a no-op, 2 of 6 tests fail (the other four expect -silence). +On the old driver, `TestProducesNotInDiffEarly` (6) and `TestPresenceEarly` (3) give only +errors, from a missing interface; the first mutation is the behaviour evidence for those two +classes. `TestOptOut` (3 failures, 1 error) and `TestTreeAndNote` (7 failures, 5 errors) +also fail on assertions. This is not a full pre-feature tree. ### Early against late, same input A throwaway probe drove `loop.run()` over the oracle's fixture and read the first -`attempt_outcome` for T01, once with fail-fast on and once off (the resolver patched). -Verification is a stub. The unit declares `src/rule.py`. "Untouched" means the attempt -writes only `docs/notes.md`. Each cell is outcome / failure class. Every early deliverable -refusal recorded `verify_seconds: 0`. +`attempt_outcome` for T01, once with fail-fast on and once off. Verification is a stub. The +unit declares `src/rule.py`. "Untouched" means the attempt writes only `docs/notes.md`. Each +cell is outcome / failure class. Every early deliverable refusal recorded +`verify_seconds: 0` and `tree_retained: true` under the default. | Case | fail-fast on | fail-fast off | Differs because | |---|---|---|---| | A: RESULT claims `src/rule.py` in `files_changed` | `produces_not_in_diff` | `files_changed_mismatch` | outranks a later guard | -| B: verify stub fails, untouched | `produces_not_in_diff` | `failed` / `tests` | outranks a gate | +| B: verify stub fails, untouched | `produces_not_in_diff` | `failed` / `other` | outranks a gate | | C: untouched, nothing else wrong | `produces_not_in_diff` | same | same | | D: failing smoke-import line, untouched | `produces_not_in_diff` | `smoke_import_failed` | outranks a later guard | | E: also declares `docs/report.md`, written with a `BLOCKED` verdict heading; untouched | `produces_not_in_diff` | `failed` / `guard_refusal` | outranks a later guard | @@ -82,32 +103,20 @@ refusal recorded `verify_seconds: 0`. | H: squash commit rejected (stub), untouched | `produces_not_in_diff` | `squash_commit_failed` | outranks a later check | | I: failing smoke-import line, nothing written | `no_deliverable_files` / `guard_refusal` | `smoke_import_failed` | outranks a later guard | | J: `close` unit, nothing written | `produces_not_in_diff` | `closing_deliverable_missing` / `guard_refusal` | outranks a later guard | -| K: verify stub fails, nothing written | `no_deliverable_files` / `guard_refusal` | `failed` / `tests` | outranks a gate | +| K: verify stub fails, nothing written | `no_deliverable_files` / `guard_refusal` | `failed` / `other` | outranks a gate | | P: squash commit rejected (stub), `src/rule.py` emptied | `deliverable_missing` / `guard_refusal` | `squash_commit_failed` | outranks a later check | | L: nothing written (two deliverable refusals apply) | `no_deliverable_files` / `guard_refusal` | same | same | | M: only `src/rule.py` deleted (two apply) | `deliverable_missing` / `guard_refusal` | same | same | -| N: zero-token session, untouched | `zero_token_skip` | same | same | | O: RESULT `status: blocked`, untouched | `blocked` | same | same | | Q: verify stub writes `src/rule.py`; the attempt did not | `produces_not_in_diff` | `passed` | outranks a gate; no late refusal exists | -Where a failure class is not shown, it equals the outcome name. With every declared path -changed and fail-fast on, the D, E, F and H units get the same record as with it off -(`smoke_import_failed`; `failed` / `guard_refusal`; `closing_deliverable_missing`; -`squash_commit_failed`). So each second check fires on its own. - -H and P are new in this close. In the first run of the probe, M and the retained-tree -deletion case raised `FileNotFoundError` in both orders: the probe's stub deleted an -already-deleted file on attempt 2. The stub was fixed and those rows rerun. +Where a failure class is not shown, it equals the outcome name. The failure class in B and K +depends on the stub's output. The first run of H and P with fail-fast off raised, because +the probe's stub threw the wrong exception type; both were rerun with `SquashCommitError`. -### Tree handling, measured at the start of attempt 2 - -- **Early presence refusals** (`deliverable_missing` for an emptied and for a deleted file, - `no_deliverable_files` with nothing written): with `retain_on_guard_refusal` true, both - orders record `tree_retained: true`; where the attempt had changed something, the change - was still there. With it false, both record `tree_retained: false`, and for the two - `deliverable_missing` inputs the tree was reset. -- **Overtaken checks:** in D, E, F, G, H, P and B the fail-fast run kept the attempt's - `docs/notes.md`, and the other order had removed it. +Not repeated in this close, and carried only as the earlier closes' observations: case N +(zero-token session), each second check firing alone when every declared path is changed, +and the probe of early presence refusals with `retain_on_guard_refusal: false`. ### Per-criterion results @@ -116,16 +125,16 @@ because it is not one of this unit's permitted closing surfaces. | Criterion | Result | Evidence | |---|---|---| -| T01#1 | passes | `TestProducesNotInDiffEarly`; on the old driver errors only, behaviour shown by the mutation control | +| T01#1 | passes | `TestProducesNotInDiffEarly`; on the old driver errors only, behaviour shown by the first mutation | | T01#2 | passes | `test_early_record_equals_late_record` (plain RESULT, passing stub) | | T01#3 | passes | 25 tests, `OK` | -| T02#1 | passes | `TestPresenceEarly`; on the old driver errors only, behaviour shown by the mutation control | -| T02#2 | passes | `TestOptOut`; 3 assertion failures on the old driver | +| T02#1 | passes | `TestPresenceEarly`; on the old driver errors only, behaviour shown by the first mutation | +| T02#2 | passes | `TestOptOut`; assertion failures on the old driver | | T02#3 | passes | empty diff | -| T03#1 | passes | `TestTreeAndNote`; assertion failures on the old driver | +| T03#1 | the listed assertions pass; clause 4, which the unit exists to turn green, **fails** | `TestTreeAndNote`; probe cases R1, R2, R5 | | T03#2 | passes | `test_list_is_capped_at_twenty` | | T04#1 | passes | `TestArmTimeWarning`; no-op control | -| T04#2 | passes with the repository script | 97 folders, 0 non-zero exits; the installed `specfuse` warns it is a different build | +| T04#2 | passes with the repository script | 97 folders, 0 non-zero exits | | T04#3 | not observed | no close has seen T04's RESULT; the count is re-measured below | | T04#4 | passes | empty diff | | T04#5 | passes | prints `0` | @@ -139,10 +148,10 @@ carried forward: 0 criteria, re-measured: 13 | 1. `produces_not_in_diff` early | Refused with 0 `verify_fn` calls, `verify_seconds` 0, no attempt-phase `gate_result`; a changed path verifies once and passes; a justified path still verifies; class, signature and summary equal the late site's | `TestProducesNotInDiffEarly` (6 tests) | | 2. Presence early | Absent, empty and bookkeeping-only diffs are refused with 0 calls | `TestPresenceEarly` (3) | | 3. Opt-out | With the key `false`, each of the three cases verifies once; outcome, class, signature and summary equal the default's, for inputs that trip one refusal | `TestOptOut` (4), on plain-RESULT, passing-stub inputs; probe cases C, L, M | -| 4. Tree and note | Note says verification did not run and lists changed paths or says none; cap of 20 plus a count; tree kept or reset | `TestTreeAndNote` (6). The kept/reset test assertions use `produces_not_in_diff` only. No test asserts tree handling for an early presence refusal; this close measured it by probe | +| 4. Tree and note | **Not proven.** The note says verification did not run, lists written and edited paths, leaves out untouched kept edits (#3612) and caps at 20; the tree is kept or reset. It omits a kept file the attempt deleted or reverted, and can then say the attempt changed nothing | `TestTreeAndNote` (9). Probe R1, R2, R5 fail. The kept/reset assertions use `produces_not_in_diff` only | | 5. Arm-time WARN | Warns on an unmentioned path; silent on full path, file name or parent directory, and on `done` / `abandoned`; `lint()` calls it | `TestArmTimeWarning` (6) | | 6. Nothing else changes | Holds as widened for #3609. See the list below | `diff -ru` of `tests/` against the recorded base; the ten modules pass | -| Precedence over every later check | Holds on every probed pair. A test asserts only the `files_changed_mismatch` pair | `test_deliverable_refusal_outranks_files_changed_mismatch`; probe cases A, B, D to K, P | +| Precedence over every later check | Holds on every probed pair. A test asserts only the `files_changed_mismatch` pair | `test_deliverable_refusal_outranks_files_changed_mismatch`; probe cases A, B, D to K, P, Q | Three review fixes made before the first close, outside any work unit, are covered by `TestEarlyRefusalRecovery` (3: re-plan still fires; uncommitted tracked edits count as a @@ -150,12 +159,14 @@ moved tree; an untouched tree still halts) and `TestEarlyRetainedNoteWording` (2 ## Pre-existing tests changed -This third close ran no git command and did not repeat the tree comparison. Instead it -listed files under `tests/`, `specfuse/`, `scripts/` and `.specfuse/scripts/` modified after -the second close wrote this file. The only one is the packaged copy -`specfuse/loop/data/docs/methodology.md`. No test or Python source is newer, so the second -close's comparison, below, still describes the tree (a modification-time check, not a -content diff). The ten modules were rerun in this session. +This fourth close ran no git command and did not repeat the tree comparison. It listed the +files under `tests/`, `specfuse/`, `scripts/`, `.specfuse/scripts/` and `docs/` modified +after the third close last wrote this file: only `specfuse/loop/loop.py` and the feature's +own `tests/test_fail_fast_deliverables.py` (the #3612 fix and its three tests). No +pre-existing test is newer. The third close did the same kind of check against the second +close's comparison, below. This is a modification-time check, not a content diff. The ten +modules were rerun in this session. In the comparison text, "this session" means the second +close. Compared against the public tarball of `a89373d119f8e2d8003a8956dbd4bd27dde8057f`, the merge base recorded on the first close's `judged` event, and against public `main` as @@ -198,7 +209,7 @@ The first close (2026-11-26T13:42Z) and the judge both recorded `not_met`, and t filed #3608 and #3609. The operator amended `GATE-01.md` for both (precedence over `files_changed_mismatch`; a wider clause 6), added a test for the precedence, and re-armed this unit. The first close had noted the other overtaken checks from reading the code but -did not probe them or put them in a follow-up entry, so the amendment named only one. This +did not probe them or put them in a follow-up entry, so the amendment named only one. The second close probed them (cases D to G). The second close (2026-11-26T14:10Z) and the judge recorded `not_met`, and the driver filed @@ -206,6 +217,13 @@ The second close (2026-11-26T14:10Z) and the judge recorded `not_met`, and the d `GATE-01.md`, the close unit's trigger and `docs/methodology.md`, and re-armed this unit. No source or test change accompanied it. +The third close (2026-11-26T15:45Z) recorded `met`. The judge lowered it to `not_met` on +clause 4, and the driver filed #3612: the note listed an earlier attempt's kept edits as the +later attempt's own. That close, like the two before it, tested "changed nothing" only on a +first attempt. The fix (`snapshot_dirty_tree`, `attempt_own_paths`, three tests) was made on +the branch outside any work unit, and the operator re-armed this unit. This fourth close +probed removals on a kept tree and found the gap in the Verdict. + T04 passed although its Verification section names `tests.test_lint_plan`, which does not exist. @@ -224,14 +242,16 @@ includes its judge: `record_judge_cost_fold` adds the judge's usage to the attem | Substantive total | 6.00 | 2.67 | — | 45% | 4 | | G1-CLOSE, first close | 5.00 (one plan line for all closes) | 1.69 | 0.44 | 34% | 1 | | G1-CLOSE, second close | (same line) | 1.49 | 0.48 | 30% | 1 | -| G1-CLOSE, third close | (same line) | not yet recorded | — | — | in progress | -| G1-CLOSE, two recorded closes | 5.00 | 3.18 | 0.92 | 64% | 2 | +| G1-CLOSE, third close | (same line) | 1.73 | 0.57 | 35% | 1 | +| G1-CLOSE, fourth close | (same line) | not yet recorded | — | — | in progress | +| G1-CLOSE, three recorded closes | 5.00 | 4.92 | 1.49 | 98% | 3 | -Recorded unit spend is 5.86 USD against a plan of 11.00 and a gate budget of 14.00. This -session's cost and its judge's are written later. The earlier `blocked_human` stop of this -unit recorded 0.00. The independent review, its fixes and both amendments happened outside -the loop, so `events.jsonl` has no cost for them. Two of the three closes were re-closes -forced by a precedence the plan had not stated. +Recorded unit spend is 7.59 USD against a plan of 11.00 and a gate budget of 14.00. This +session's cost and its judge's are written later; any non-trivial amount takes the close +line past its 5.00 plan. The earlier `blocked_human` stop of this unit recorded 0.00. The +independent review, its fixes, both amendments and the #3612 fix happened outside the loop, +so `events.jsonl` has no cost for them. All three re-closes cost money for questions the +plan or the oracle had left open: two for an unstated precedence, one for the #3612 defect. **T04's warning rate.** Re-measured this session over `done` units with `produces:`: the shipped rule (path, file name or parent directory) would fire on 35 of 402, **8.7%**, under @@ -244,8 +264,8 @@ satisfied by almost any body. The WARN is weak for such paths. ## Consumer-visible contract changes Pending human acknowledgment. Each has a `changelog.d/` fragment tracing to -`FEAT-LOOP-2026-0251`. This close added no fragment; it extended the first one in place with -the rejected squash commit and the kept-tree effect. +`FEAT-LOOP-2026-0251`. This close added no fragment; it extended the retry-note one in place +with the kept-tree behaviour and its known limit. 1. **Changed:** the three deliverable refusals run before verification. They take precedence over every verification gate and later guard. An attempt that also would have failed one @@ -253,12 +273,19 @@ the rejected squash commit and the kept-tree effect. old order reset it. 2. **Added:** `defaults.fail_fast_deliverables`, default `true`. 3. **Changed:** the retry note for the three refusals lists the changed paths, at most 20 - plus a count. + plus a count. Untouched edits kept from an earlier attempt are left out. Known limit: a + kept file the attempt deleted or reverted is not listed. 4. **Added:** a `specfuse lint` WARN for a `produces:` path the unit's body never mentions. ## Notes for the human reviewer -Neither note is a failed criterion. This unit may edit none of the files concerned. +None of these is a failed criterion. This unit may edit none of the files concerned. + +- **Older defect, worth its own bug.** A refused attempt that keeps its tree and has a + changed file with a non-ASCII name stops the driver with `CalledProcessError`: + `git_diff_names` returns git's quoted form and `git add -N` rejects it (probe R4). The + pre-feature `loop.py` does the same. `attempt_own_paths` reads the same names, so a fix + should cover both. This close filed no issue for it. - **One sentence in `docs/methodology.md` is too strong.** It says "What is refused does not change, only when." Probe case Q is an attempt that passes with the key `false` and is @@ -282,7 +309,10 @@ Neither note is a failed criterion. This unit may edit none of the files concern change (`bd7e508`). Later pins exist and the closes were dispatched after them, but every `attempt_outcome` in `events.jsonl` before this close is `passed`. No real early refusal has happened, so no real saving in gate time is measured. -- The probe stubbed the agent session, `verify`, and (for H and P) the squash rejection. +- The probes stubbed the agent session, `verify`, and (for H and P) the squash rejection. +- The three observations listed after the early-against-late table as not repeated. +- Other ways to change a kept file that the note might miss, such as a mode-only change or a + rename. The digest covers file content only; this is read from the code, not probed. - That cases A to Q are the whole list of overtaken checks. The list comes from reading `execute_unit_attempt()` and the post-squash guards in `run()`. The general rule does not depend on the list being complete; the claim that it holds rests on the early check running diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md index 3eb3cee2..4c87795d 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md @@ -1,8 +1,8 @@ --- id: FEAT-LOOP-2026-0251/G1-CLOSE type: close -status: pending -attempts: 0 +status: done +attempts: 1 oracle_env: macos_local planned_cost_usd: 5.00 auto_close_disabled: true @@ -46,19 +46,20 @@ re_arm_history: prior_cost_usd: 1.733084 prior_duration_seconds: 379.569 reason: "Trying to fix the last issue" -cumulative_cost_usd: 3.181952 -cumulative_duration_seconds: 550.857 -cumulative_input_tokens: 118 -cumulative_output_tokens: 71498 -cumulative_attempts: 2 -cost_usd: 1.733084 -duration_seconds: 379.569 -input_tokens: 56 -output_tokens: 43124 -folded_through_re_arm: 3 +cumulative_cost_usd: 4.915036 +cumulative_duration_seconds: 930.426 +cumulative_input_tokens: 174 +cumulative_output_tokens: 114622 +cumulative_attempts: 3 +cost_usd: 1.079358 +duration_seconds: 478.949 +input_tokens: 48 +output_tokens: 30212 +folded_through_re_arm: 4 +verdict: not_met gate_set: plannext driver_version: 0.33.2 -started_at: 2026-11-26T15:32:04.468694+00:00 +started_at: 2026-11-26T16:17:14.747069+00:00 --- # G1-CLOSE — terminal close diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index 3c69425d..ed94a4a9 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -210,3 +210,5 @@ {"timestamp": "2026-11-26T16:17:14.529484+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "init-sh-shim-bats", "ok": true, "skipped": false, "duration_seconds": 0.897, "phase": "broad"}} {"timestamp": "2026-11-26T16:17:14.529485+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "init-skills-bats", "ok": true, "skipped": false, "duration_seconds": 0.148, "phase": "broad"}} {"timestamp": "2026-11-26T16:17:14.529487+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "hookspath-conflict-bats", "ok": true, "skipped": false, "duration_seconds": 0.615, "phase": "broad"}} +{"timestamp": "2026-11-26T16:17:14.636298+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "terminal_judge_editing_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "status": "clean", "reason": "acknowledged by operator: .specfuse/verification.yml.example, produces_driver_helper, specfuse/loop/data/verification.yml.example, specfuse/loop/lint_plan.py, specfuse/loop/loop.py"}} +{"timestamp": "2026-11-26T16:17:14.640024+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "terminal_judge_editing_acknowledged", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "close_unit": "FEAT-LOOP-2026-0251/G1-CLOSE", "paths": [".specfuse/verification.yml.example", "produces_driver_helper", "specfuse/loop/data/verification.yml.example", "specfuse/loop/lint_plan.py", "specfuse/loop/loop.py"], "reason": "Review fixes tested, full suite green, accept the generator risk"}} diff --git a/changelog.d/FEAT-LOOP-2026-0251-the-retry-note-for-the-three-deliverable.md b/changelog.d/FEAT-LOOP-2026-0251-the-retry-note-for-the-three-deliverable.md index 2b8655ec..47c90236 100644 --- a/changelog.d/FEAT-LOOP-2026-0251-the-retry-note-for-the-three-deliverable.md +++ b/changelog.d/FEAT-LOOP-2026-0251-the-retry-note-for-the-three-deliverable.md @@ -2,4 +2,4 @@ class: changed trace: FEAT-LOOP-2026-0251 --- -The retry note for the three deliverable refusals now lists the paths the attempt changed (at most 20, plus a count of the rest), or says it changed none +The retry note for the three deliverable refusals now lists the paths the attempt changed (at most 20, plus a count of the rest), or says it changed none. Edits kept from an earlier attempt that this attempt did not touch are not listed. Known limit: a kept file that this attempt deleted or reverted is not listed either, so the note can say it changed none From 7de6fc87e0af6d4c5eb25345f5cf1f63bd64890f Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 11:28:24 -0500 Subject: [PATCH 42/69] chore(loop): FEAT-LOOP-2026-0251/G1-CLOSE judge cost fold Feature: FEAT-LOOP-2026-0251 --- .../WU-90-gate-1-close.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md index 4c87795d..51bd4931 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md @@ -51,10 +51,10 @@ cumulative_duration_seconds: 930.426 cumulative_input_tokens: 174 cumulative_output_tokens: 114622 cumulative_attempts: 3 -cost_usd: 1.079358 +cost_usd: 1.435437 duration_seconds: 478.949 -input_tokens: 48 -output_tokens: 30212 +input_tokens: 62 +output_tokens: 35593 folded_through_re_arm: 4 verdict: not_met gate_set: plannext From 94ad43fa420e923bfd869cbc8128206af4e070ec Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 11:28:24 -0500 Subject: [PATCH 43/69] chore(loop): gate 1 awaiting_review Feature: FEAT-LOOP-2026-0251 --- .../GATE-01.md | 2 +- .../events.jsonl | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md index 70f337d3..a5a215c7 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md @@ -1,6 +1,6 @@ --- gate: 1 -status: open +status: awaiting_review feature_oracle: "python3 -m unittest tests.test_fail_fast_deliverables -v -b" cost_budget_usd: 14.00 broad_run: diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index ed94a4a9..d670782f 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -212,3 +212,12 @@ {"timestamp": "2026-11-26T16:17:14.529487+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "hookspath-conflict-bats", "ok": true, "skipped": false, "duration_seconds": 0.615, "phase": "broad"}} {"timestamp": "2026-11-26T16:17:14.636298+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "terminal_judge_editing_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "status": "clean", "reason": "acknowledged by operator: .specfuse/verification.yml.example, produces_driver_helper, specfuse/loop/data/verification.yml.example, specfuse/loop/lint_plan.py, specfuse/loop/loop.py"}} {"timestamp": "2026-11-26T16:17:14.640024+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "terminal_judge_editing_acknowledged", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "close_unit": "FEAT-LOOP-2026-0251/G1-CLOSE", "paths": [".specfuse/verification.yml.example", "produces_driver_helper", "specfuse/loop/data/verification.yml.example", "specfuse/loop/lint_plan.py", "specfuse/loop/loop.py"], "reason": "Review fixes tested, full suite green, accept the generator risk"}} +{"timestamp": "2026-11-26T16:17:14.747481+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "task_started", "source": "driver", "source_version": "0.33.2", "payload": {"type": "close", "model": "sonnet", "re_arm_count": 4}} +{"timestamp": "2026-11-26T16:17:14.747494+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "re_arm_dispatched", "source": "driver", "source_version": "0.33.2", "payload": {"re_arm_count": 4, "reason": "Trying to fix the last issue"}} +{"timestamp": "2026-11-26T16:25:13.721635+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "plan-lint", "ok": true, "skipped": false, "duration_seconds": 0.098, "phase": "attempt"}} +{"timestamp": "2026-11-26T16:25:13.721756+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "feature_oracle", "ok": true, "skipped": false, "duration_seconds": 34.01, "phase": "attempt"}} +{"timestamp": "2026-11-26T16:28:24.161713+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "judged", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "close_verdict": "not_met", "close_model": "sonnet", "judge_verdict": "not_met", "verdict": "not_met", "lowered": false, "disagreed": false, "findings": 2, "reason": null, "diff_base": "3bc8bef37e1903f18b2a48f78a44fb9a63600864", "diff_base_source": "merge-base of HEAD with main", "usage": {"cost_usd": 0.3560795, "input_tokens": 14, "output_tokens": 5381, "cache_read_input_tokens": 409895, "cache_creation_input_tokens": 65313}, "judge_cost_usd": 0.356079}} +{"timestamp": "2026-11-26T16:28:24.163557+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "attempt_outcome", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "outcome": "passed", "duration_seconds": 478.949, "agent_seconds": 444.6934201249387, "verify_seconds": 34.12231654196512, "cost_usd": 1.4354375, "input_tokens": 62, "output_tokens": 35593, "cache_read_input_tokens": 2919635, "cache_creation_input_tokens": 196855, "model": "sonnet", "effort": "high", "failure_class": null, "failure_signature": null, "failure_excerpt": null, "files_touched": [".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md", ".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/LEARNINGS-pending.md", ".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/RETROSPECTIVE.md", ".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md", ".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl", "changelog.d/FEAT-LOOP-2026-0251-the-retry-note-for-the-three-deliverable.md"], "agent_status": "complete", "agent_blocked_reason": null, "re_arm_count": 0, "failing_tests": []}} +{"timestamp": "2026-11-26T16:28:24.163798+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "task_completed", "source": "driver", "source_version": "0.33.2", "payload": {"attempts": 1, "attempts_usage": [{"attempt": 1, "duration_seconds": 478.949, "cost_usd": 1.4354375, "input_tokens": 62, "output_tokens": 35593, "cache_read_input_tokens": 2919635, "cache_creation_input_tokens": 196855, "agent_seconds": 444.6934201249387, "verify_seconds": 34.12231654196512}], "type": "close", "re_arm_count": 4, "cost_usd": 1.435437, "cumulative_cost_usd": 6.350473, "attempts_lifetime": 4, "planned_cost_usd": 5.0}} +{"timestamp": "2026-11-26T16:28:24.189676+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_reached", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1}} +{"timestamp": "2026-11-26T16:28:24.189660+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "arm_predicate_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "would_arm": true, "predicate_version": "v1", "classes": {"budget_projection": {"status": "clean", "reason": "projected spend $9.03 within 2.0x baseline planned total $11.00 (cap $22.00)"}, "judge_editing": {"status": "clean", "reason": "no drafted WU touches judge-path surfaces"}, "decision_class_paths": {"status": "clean", "reason": "no drafted WU touches a recognised dependency manifest (pyproject.toml, package.json, pom.xml, build.gradle, build.gradle.kts, Cargo.toml, go.mod, Gemfile, composer.json, requirements*.txt, *.csproj)"}, "retroactive_edits": {"status": "clean", "reason": "no passed-gate baseline WU altered or removed"}, "drift_caps": {"status": "clean", "reason": "added WUs and gates within drift caps"}, "missing_provenance": {"status": "clean", "reason": "no added WUs"}, "open_questions_human_only": {"status": "clean", "reason": "terminal gate: no drafted successor"}, "plan_next_lint": {"status": "clean", "reason": "plan-next lint: no findings"}}}} From f6602615589522ae07b0eed5b6c9b579df649a53 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 11:28:27 -0500 Subject: [PATCH 44/69] =?UTF-8?q?chore(loop):=20FEAT-LOOP-2026-0251=20?= =?UTF-8?q?=E2=80=94=20record=20the=20follow-up=20issues=20the=20driver=20?= =?UTF-8?q?filed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md | 2 ++ .../FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl | 1 + 2 files changed, 3 insertions(+) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md index 9affe4bb..9d02b4d0 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md @@ -5,6 +5,8 @@ Fourth close, 2026-11-26. One entry is open, below. The re-run conditions of #36 ### T03#1 — a kept file that an attempt deletes or reverts is missing from its retry note +**Tracked as #3613.** + **Criterion** (`GATE-01.md`, clause 4): "**Tree and note.** An early refusal keeps or resets the tree per `defaults.retain_on_guard_refusal`, as the late refusal does; its retry note states that verification did not run and lists the paths this attempt changed (or says it diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index d670782f..88291e0a 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -221,3 +221,4 @@ {"timestamp": "2026-11-26T16:28:24.163798+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "task_completed", "source": "driver", "source_version": "0.33.2", "payload": {"attempts": 1, "attempts_usage": [{"attempt": 1, "duration_seconds": 478.949, "cost_usd": 1.4354375, "input_tokens": 62, "output_tokens": 35593, "cache_read_input_tokens": 2919635, "cache_creation_input_tokens": 196855, "agent_seconds": 444.6934201249387, "verify_seconds": 34.12231654196512}], "type": "close", "re_arm_count": 4, "cost_usd": 1.435437, "cumulative_cost_usd": 6.350473, "attempts_lifetime": 4, "planned_cost_usd": 5.0}} {"timestamp": "2026-11-26T16:28:24.189676+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_reached", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1}} {"timestamp": "2026-11-26T16:28:24.189660+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "arm_predicate_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "would_arm": true, "predicate_version": "v1", "classes": {"budget_projection": {"status": "clean", "reason": "projected spend $9.03 within 2.0x baseline planned total $11.00 (cap $22.00)"}, "judge_editing": {"status": "clean", "reason": "no drafted WU touches judge-path surfaces"}, "decision_class_paths": {"status": "clean", "reason": "no drafted WU touches a recognised dependency manifest (pyproject.toml, package.json, pom.xml, build.gradle, build.gradle.kts, Cargo.toml, go.mod, Gemfile, composer.json, requirements*.txt, *.csproj)"}, "retroactive_edits": {"status": "clean", "reason": "no passed-gate baseline WU altered or removed"}, "drift_caps": {"status": "clean", "reason": "added WUs and gates within drift caps"}, "missing_provenance": {"status": "clean", "reason": "no added WUs"}, "open_questions_human_only": {"status": "clean", "reason": "terminal gate: no drafted successor"}, "plan_next_lint": {"status": "clean", "reason": "plan-next lint: no findings"}}}} +{"timestamp": "2026-11-26T16:28:27.526095+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "followups_recorded", "source": "driver", "source_version": "0.33.2", "payload": {"filed": 1, "unfiled": 0, "already_tracked": 0, "issue_numbers": ["3613"], "written_back": ["FOLLOW-UPS.md"]}} From e6ba5e5c08df26fdc87767a3ecf48d1a718eb8dd Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 11:36:30 -0500 Subject: [PATCH 45/69] fix(loop): retry note lists kept files the attempt deleted or reverted (#3613) A file an earlier, kept attempt left that this attempt deleted, or reverted to its committed content, is no longer in the diff the guard judged, so the note missed it and could claim 'this attempt changed no files'. attempt_own_paths now also lists every attempt-start snapshot path that has left the diff and whose content has changed. Co-Authored-By: Claude Opus 5.5 --- .../PLAN.md | 5 ++ specfuse/loop/loop.py | 22 +++++-- tests/test_fail_fast_deliverables.py | 66 +++++++++++++++++-- 3 files changed, 80 insertions(+), 13 deletions(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PLAN.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PLAN.md index fc611a5d..b2e325e6 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PLAN.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PLAN.md @@ -138,3 +138,8 @@ gates: `files_touched` are unchanged, so `detect_deterministic_refusal_repeat` is unaffected. Tested in `TestTreeAndNote` (kept edits left out, nothing-changed stated, a re-edited kept file listed), both with and without `fail_fast_deliverables`. +- **Fourth-close follow-up (2026-11-26, #3613).** A kept file the attempt deleted, or reverted to + its committed content, had left the diff the guard judged, so the note missed it and could say + "changed no files". `attempt_own_paths` now also lists every attempt-start snapshot path that + is no longer in that diff and whose content has changed. Tested in `TestTreeAndNote` (deleted, + reverted tracked edit, deleted plus a new file), with and without `fail_fast_deliverables`. diff --git a/specfuse/loop/loop.py b/specfuse/loop/loop.py index f7835e5f..929eaa7d 100644 --- a/specfuse/loop/loop.py +++ b/specfuse/loop/loop.py @@ -3125,14 +3125,24 @@ def snapshot_dirty_tree(head_before: str) -> "dict[str, str | None]": def attempt_own_paths(changed: list, tree_before: "dict[str, str | None] | None") -> list: - """*changed* without the paths an earlier, kept attempt left that this - attempt did not touch again (#3612). A path counts as this attempt's when - it was clean at the start of the attempt or its contents have changed - since. With no snapshot, *changed* is returned unchanged.""" + """The paths this attempt changed, given *changed* (the diff the guard + judged) and the attempt-start snapshot (#3612). + + A path in *changed* counts when it was clean at the start of the attempt + or its contents have changed since; an earlier, kept attempt's edit the + attempt did not touch again is left out. A snapshot path that has left + *changed* because the attempt deleted it or reverted it to the committed + content counts too (#3613): it is not in the diff any more, but this + attempt changed it. With no snapshot, *changed* is returned unchanged. + """ if not tree_before: return list(changed) - return [p for p in changed - if p not in tree_before or _path_digest(p) != tree_before[p]] + in_diff = set(changed) + own = [p for p in changed + if p not in tree_before or _path_digest(p) != tree_before[p]] + own += [p for p, digest in tree_before.items() + if p not in in_diff and _path_digest(p) != digest] + return own def ignored_paths() -> set[str]: diff --git a/tests/test_fail_fast_deliverables.py b/tests/test_fail_fast_deliverables.py index cb6cfd0e..8925293d 100644 --- a/tests/test_fail_fast_deliverables.py +++ b/tests/test_fail_fast_deliverables.py @@ -437,11 +437,27 @@ def test_late_produces_refusal_lists_changed_paths(self): self.assertIn("- `docs/other.md`", note) self.assertNotIn("verification did not run", note) - def _second_attempt_note(self, second_act, fail_fast: bool = True) -> str: - """`loop.run()` with a kept tree: attempt 1 writes `docs/notes.md`, - attempt 2 runs *second_act*. Returns the note recorded for attempt 2 - (`work//attempt-2.md`, written when the unit halts).""" - _, fdir = self._workspace() + @staticmethod + def _write_notes(): + Path("docs").mkdir(exist_ok=True) + Path("docs/notes.md").write_text("notes\n") + + def _second_attempt_note(self, second_act, fail_fast: bool = True, + first_act=None, tracked=None) -> str: + """`loop.run()` with a kept tree: attempt 1 runs *first_act* (default: + write `docs/notes.md`), attempt 2 runs *second_act*. *tracked* maps + paths to content committed before the run. Returns the note recorded + for attempt 2 (`work//attempt-2.md`, written when the unit + halts).""" + root, fdir = self._workspace() + first_act = first_act or self._write_notes + for rel, text in (tracked or {}).items(): + (root / rel).parent.mkdir(parents=True, exist_ok=True) + (root / rel).write_text(text) + subprocess.run(["git", "add", rel], check=True) + if tracked: + subprocess.run(["git", "commit", "-q", "-m", "tracked fixture"], + check=True) dispatched = [] load = loop.load_verification @@ -457,8 +473,7 @@ def dispatch(wu, note, cost_tracking=True): if wu.wu_id == T01: dispatched.append(note) if len(dispatched) == 1: - Path("docs").mkdir(exist_ok=True) - Path("docs/notes.md").write_text("notes\n") + first_act() elif len(dispatched) == 2: second_act() return _COMPLETE @@ -512,6 +527,43 @@ def rewrite_notes(): listed = self._path_list(note) self.assertIn("- `docs/notes.md`", listed) + def test_deleting_a_kept_file_lists_it(self): + # #3613: a deleted kept file has left the diff the guard judged. + for fail_fast in (True, False): + with self.subTest(fail_fast=fail_fast): + listed = self._path_list(self._second_attempt_note( + lambda: Path("docs/notes.md").unlink(), + fail_fast=fail_fast)) + self.assertIn("- `docs/notes.md`", listed) + self.assertNotIn("changed no files", listed) + + def test_reverting_a_kept_tracked_edit_lists_it(self): + def edit(): + Path("docs/tracked.md").write_text("edited\n") + + def revert(): + Path("docs/tracked.md").write_text("original\n") + + for fail_fast in (True, False): + with self.subTest(fail_fast=fail_fast): + listed = self._path_list(self._second_attempt_note( + revert, fail_fast=fail_fast, first_act=edit, + tracked={"docs/tracked.md": "original\n"})) + self.assertIn("- `docs/tracked.md`", listed) + self.assertNotIn("changed no files", listed) + + def test_deleting_a_kept_file_and_writing_another_lists_both(self): + def swap(): + Path("docs/notes.md").unlink() + Path("docs/second.md").write_text("second\n") + + for fail_fast in (True, False): + with self.subTest(fail_fast=fail_fast): + listed = self._path_list( + self._second_attempt_note(swap, fail_fast=fail_fast)) + self.assertIn("- `docs/notes.md`", listed) + self.assertIn("- `docs/second.md`", listed) + def test_list_is_capped_at_twenty(self): def thirty(): Path("docs").mkdir(exist_ok=True) From aa946bb1c61d80f886386d536bacaf1683b0156d Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 11:44:22 -0500 Subject: [PATCH 46/69] =?UTF-8?q?chore(loop):=20FEAT-LOOP-2026-0251=20?= =?UTF-8?q?=E2=80=94=20re-arm=20the=20close=20after=20the=20#3613=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- .../GATE-01.md | 2 +- .../WU-90-gate-1-close.md | 20 +++++++++++++++---- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md index a5a215c7..70f337d3 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md @@ -1,6 +1,6 @@ --- gate: 1 -status: awaiting_review +status: open feature_oracle: "python3 -m unittest tests.test_fail_fast_deliverables -v -b" cost_budget_usd: 14.00 broad_run: diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md index 51bd4931..759a2b37 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md @@ -1,8 +1,8 @@ --- id: FEAT-LOOP-2026-0251/G1-CLOSE type: close -status: done -attempts: 1 +status: pending +attempts: 0 oracle_env: macos_local planned_cost_usd: 5.00 auto_close_disabled: true @@ -16,7 +16,7 @@ judge_edit_acknowledged: - specfuse/loop/lint_plan.py - specfuse/loop/loop.py reason: "Review fixes tested, full suite green, accept the generator risk" -re_arm_count: 4 +re_arm_count: 5 re_arm_history: - timestamp: 2026-11-26T13:30:05+00:00 @@ -46,6 +46,13 @@ re_arm_history: prior_cost_usd: 1.733084 prior_duration_seconds: 379.569 reason: "Trying to fix the last issue" + - + timestamp: 2026-11-26T16:44:22+00:00 + prior_status: done + prior_attempts: 1 + prior_cost_usd: 1.435437 + prior_duration_seconds: 478.949 + reason: "Fixed the deleted-file edge case, re-close it" cumulative_cost_usd: 4.915036 cumulative_duration_seconds: 930.426 cumulative_input_tokens: 174 @@ -56,7 +63,6 @@ duration_seconds: 478.949 input_tokens: 62 output_tokens: 35593 folded_through_re_arm: 4 -verdict: not_met gate_set: plannext driver_version: 0.33.2 started_at: 2026-11-26T16:17:14.747069+00:00 @@ -112,3 +118,9 @@ the tree kept, a later attempt's retry note listed the earlier attempt's kept ed (clause 4). Fixed on the branch (`snapshot_dirty_tree`, `attempt_own_paths` in `loop.py`; tests in `TestTreeAndNote`; see `PLAN.md` Notes). Update the closing files in place as before, and say in `FOLLOW-UPS.md` whether #3612's re-run condition now holds. + +**Fourth re-close note (2026-11-26).** The fourth close recorded `not_met` on #3613: a kept file +the attempt deleted or reverted was missing from its retry note. Fixed on the branch +(`attempt_own_paths` in `loop.py`; tests in `TestTreeAndNote`; see `PLAN.md` Notes). Update the +closing files in place as before, and say in `FOLLOW-UPS.md` whether #3613's re-run condition +now holds. From 1ebf159ded88298f7c965c41210ade5121540808 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 11:44:24 -0500 Subject: [PATCH 47/69] chore(loop): FEAT-LOOP-2026-0251 build pin recorded Feature: FEAT-LOOP-2026-0251 --- .../FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl | 1 + 1 file changed, 1 insertion(+) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index 88291e0a..af819f7a 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -222,3 +222,4 @@ {"timestamp": "2026-11-26T16:28:24.189676+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_reached", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1}} {"timestamp": "2026-11-26T16:28:24.189660+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "arm_predicate_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "would_arm": true, "predicate_version": "v1", "classes": {"budget_projection": {"status": "clean", "reason": "projected spend $9.03 within 2.0x baseline planned total $11.00 (cap $22.00)"}, "judge_editing": {"status": "clean", "reason": "no drafted WU touches judge-path surfaces"}, "decision_class_paths": {"status": "clean", "reason": "no drafted WU touches a recognised dependency manifest (pyproject.toml, package.json, pom.xml, build.gradle, build.gradle.kts, Cargo.toml, go.mod, Gemfile, composer.json, requirements*.txt, *.csproj)"}, "retroactive_edits": {"status": "clean", "reason": "no passed-gate baseline WU altered or removed"}, "drift_caps": {"status": "clean", "reason": "added WUs and gates within drift caps"}, "missing_provenance": {"status": "clean", "reason": "no added WUs"}, "open_questions_human_only": {"status": "clean", "reason": "terminal gate: no drafted successor"}, "plan_next_lint": {"status": "clean", "reason": "plan-next lint: no findings"}}}} {"timestamp": "2026-11-26T16:28:27.526095+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "followups_recorded", "source": "driver", "source_version": "0.33.2", "payload": {"filed": 1, "unfiled": 0, "already_tracked": 0, "issue_numbers": ["3613"], "written_back": ["FOLLOW-UPS.md"]}} +{"timestamp": "2026-11-26T16:44:24.283766+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "driver_build_pinned", "source": "driver", "source_version": "0.33.2", "payload": {"tree": "5295bce9df8476766d94353c24b2f4b209ca8a38", "path": "/private/var/folders/zc/rgq11x850d78dx_kf1fd4vx80000gn/T/specfuse-pins/5295bce9df8476766d94353c24b2f4b209ca8a38/specfuse/loop"}} From 308a5fd3cf88e331ff965fffce52e1d0fd0fd3e2 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 11:51:24 -0500 Subject: [PATCH 48/69] chore(loop): gate 1 broad run clean Feature: FEAT-LOOP-2026-0251 --- .../GATE-01.md | 4 ++-- .../events.jsonl | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md index 70f337d3..58fa9d5b 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md @@ -4,8 +4,8 @@ status: open feature_oracle: "python3 -m unittest tests.test_fail_fast_deliverables -v -b" cost_budget_usd: 14.00 broad_run: - tree: 07bbf72d1e7af3c1a03af605f40e5563dc3a18db:0ec7c6da6e74f0b56753f09657b654a6d289b91b:12064a6191eeb830a9826d911a8543fbaba3da75:27968248a450a842ccd187b7dce0fb0ded934866:287efde8f90320baffac08f5f3287b9456a65cb9:2e29b2f7e073a0cbe290f01d3b397e1cdd10c81c:39af52f10c10bdafeeb3c29122f2cd7398be4e88:42796ea0e0a6c03811b0e4bc9dbd3b5ee62dd2e4:4acc6dfc5e8cece358c167d876515eba4a39a500:56ae45adcc17a1292977c436fd195ef8c61cc9e4:834d9d9c16094a386cd9b5a6f9ced9a3a9b4e7fb:9969252df1bf38a0eb154eff3019a39c7c2e20fa:bbd1aea514612d76722a18c7aece7c767cf1a076:c23b62e87f1ae3890c6f9e3d8c7ca7ec9225ed81:caffe2d63ceacde448842a91bc7a12c206a67523:d74b7d113b844e84f0009098f576fd28477f072d:e3b0de29b81a6c8e0abeacb3898519b98014b9ef:ee0bd0a3eced139daf2fde311af364799729b48d:fa2f4f88657587b6e3b560977858810846b1d366 - ran_at: 2026-11-26T16:17:14.521398+00:00 + tree: 07bbf72d1e7af3c1a03af605f40e5563dc3a18db:0ec7c6da6e74f0b56753f09657b654a6d289b91b:12064a6191eeb830a9826d911a8543fbaba3da75:1335b4a33bdabb0f79b5cefbbb3a895f1a6070d9:20d5146c893abcac47015a30987b44b2a3dc7c03:27968248a450a842ccd187b7dce0fb0ded934866:287efde8f90320baffac08f5f3287b9456a65cb9:2e29b2f7e073a0cbe290f01d3b397e1cdd10c81c:42796ea0e0a6c03811b0e4bc9dbd3b5ee62dd2e4:4acc6dfc5e8cece358c167d876515eba4a39a500:56ae45adcc17a1292977c436fd195ef8c61cc9e4:834d9d9c16094a386cd9b5a6f9ced9a3a9b4e7fb:91772e5b1214def7917a34e770c1485cd953efe3:bbd1aea514612d76722a18c7aece7c767cf1a076:c23b62e87f1ae3890c6f9e3d8c7ca7ec9225ed81:caffe2d63ceacde448842a91bc7a12c206a67523:d74b7d113b844e84f0009098f576fd28477f072d:e3b0de29b81a6c8e0abeacb3898519b98014b9ef:fa2f4f88657587b6e3b560977858810846b1d366 + ran_at: 2026-11-26T16:51:24.463202+00:00 ok: true failing: [] --- diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index af819f7a..750c2b03 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -223,3 +223,22 @@ {"timestamp": "2026-11-26T16:28:24.189660+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "arm_predicate_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "would_arm": true, "predicate_version": "v1", "classes": {"budget_projection": {"status": "clean", "reason": "projected spend $9.03 within 2.0x baseline planned total $11.00 (cap $22.00)"}, "judge_editing": {"status": "clean", "reason": "no drafted WU touches judge-path surfaces"}, "decision_class_paths": {"status": "clean", "reason": "no drafted WU touches a recognised dependency manifest (pyproject.toml, package.json, pom.xml, build.gradle, build.gradle.kts, Cargo.toml, go.mod, Gemfile, composer.json, requirements*.txt, *.csproj)"}, "retroactive_edits": {"status": "clean", "reason": "no passed-gate baseline WU altered or removed"}, "drift_caps": {"status": "clean", "reason": "added WUs and gates within drift caps"}, "missing_provenance": {"status": "clean", "reason": "no added WUs"}, "open_questions_human_only": {"status": "clean", "reason": "terminal gate: no drafted successor"}, "plan_next_lint": {"status": "clean", "reason": "plan-next lint: no findings"}}}} {"timestamp": "2026-11-26T16:28:27.526095+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "followups_recorded", "source": "driver", "source_version": "0.33.2", "payload": {"filed": 1, "unfiled": 0, "already_tracked": 0, "issue_numbers": ["3613"], "written_back": ["FOLLOW-UPS.md"]}} {"timestamp": "2026-11-26T16:44:24.283766+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "driver_build_pinned", "source": "driver", "source_version": "0.33.2", "payload": {"tree": "5295bce9df8476766d94353c24b2f4b209ca8a38", "path": "/private/var/folders/zc/rgq11x850d78dx_kf1fd4vx80000gn/T/specfuse-pins/5295bce9df8476766d94353c24b2f4b209ca8a38/specfuse/loop"}} +{"timestamp": "2026-11-26T16:51:24.472683+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "broad_run_result", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "tree": "07bbf72d1e7af3c1a03af605f40e5563dc3a18db:0ec7c6da6e74f0b56753f09657b654a6d289b91b:12064a6191eeb830a9826d911a8543fbaba3da75:1335b4a33bdabb0f79b5cefbbb3a895f1a6070d9:20d5146c893abcac47015a30987b44b2a3dc7c03:27968248a450a842ccd187b7dce0fb0ded934866:287efde8f90320baffac08f5f3287b9456a65cb9:2e29b2f7e073a0cbe290f01d3b397e1cdd10c81c:42796ea0e0a6c03811b0e4bc9dbd3b5ee62dd2e4:4acc6dfc5e8cece358c167d876515eba4a39a500:56ae45adcc17a1292977c436fd195ef8c61cc9e4:834d9d9c16094a386cd9b5a6f9ced9a3a9b4e7fb:91772e5b1214def7917a34e770c1485cd953efe3:bbd1aea514612d76722a18c7aece7c767cf1a076:c23b62e87f1ae3890c6f9e3d8c7ca7ec9225ed81:caffe2d63ceacde448842a91bc7a12c206a67523:d74b7d113b844e84f0009098f576fd28477f072d:e3b0de29b81a6c8e0abeacb3898519b98014b9ef:fa2f4f88657587b6e3b560977858810846b1d366", "ok": true, "failing": []}} +{"timestamp": "2026-11-26T16:51:24.472715+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "tests", "ok": true, "skipped": false, "duration_seconds": 376.235, "phase": "broad"}} +{"timestamp": "2026-11-26T16:51:24.472720+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "lint", "ok": true, "skipped": false, "duration_seconds": 0.06, "phase": "broad"}} +{"timestamp": "2026-11-26T16:51:24.472723+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "security", "ok": true, "skipped": false, "duration_seconds": 1.686, "phase": "broad"}} +{"timestamp": "2026-11-26T16:51:24.472727+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "coverage", "ok": true, "skipped": false, "duration_seconds": 1.314, "phase": "broad"}} +{"timestamp": "2026-11-26T16:51:24.472730+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "leak-scan", "ok": true, "skipped": false, "duration_seconds": 18.675, "phase": "broad"}} +{"timestamp": "2026-11-26T16:51:24.472733+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "changelog-fragments", "ok": true, "skipped": false, "duration_seconds": 0.063, "phase": "broad"}} +{"timestamp": "2026-11-26T16:51:24.472736+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "agent-policy-example-lint", "ok": true, "skipped": false, "duration_seconds": 0.121, "phase": "broad"}} +{"timestamp": "2026-11-26T16:51:24.472739+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "event-type-gate", "ok": true, "skipped": false, "duration_seconds": 0.176, "phase": "broad"}} +{"timestamp": "2026-11-26T16:51:24.472741+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "roadmap-link-gate", "ok": true, "skipped": false, "duration_seconds": 0.058, "phase": "broad"}} +{"timestamp": "2026-11-26T16:51:24.472742+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "arm-sweep-gate", "ok": true, "skipped": false, "duration_seconds": 0.412, "phase": "broad"}} +{"timestamp": "2026-11-26T16:51:24.472745+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "monitoring-example-lint", "ok": true, "skipped": false, "duration_seconds": 0.05, "phase": "broad"}} +{"timestamp": "2026-11-26T16:51:24.472749+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "leak-scan-hook", "ok": true, "skipped": false, "duration_seconds": 0.863, "phase": "broad"}} +{"timestamp": "2026-11-26T16:51:24.472751+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "pre-push-hook", "ok": true, "skipped": false, "duration_seconds": 3.712, "phase": "broad"}} +{"timestamp": "2026-11-26T16:51:24.472752+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "sync-scaffold-bats", "ok": true, "skipped": false, "duration_seconds": 12.785, "phase": "broad"}} +{"timestamp": "2026-11-26T16:51:24.472753+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "sync-scaffold-symlinks-bats", "ok": true, "skipped": false, "duration_seconds": 2.106, "phase": "broad"}} +{"timestamp": "2026-11-26T16:51:24.472754+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "init-sh-shim-bats", "ok": true, "skipped": false, "duration_seconds": 0.906, "phase": "broad"}} +{"timestamp": "2026-11-26T16:51:24.472756+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "init-skills-bats", "ok": true, "skipped": false, "duration_seconds": 0.146, "phase": "broad"}} +{"timestamp": "2026-11-26T16:51:24.472758+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "hookspath-conflict-bats", "ok": true, "skipped": false, "duration_seconds": 0.617, "phase": "broad"}} From 976d5339a39bff713775823df1c23ee507843f21 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 12:01:41 -0500 Subject: [PATCH 49/69] =?UTF-8?q?feat:=20G1-CLOSE=20=E2=80=94=20terminal?= =?UTF-8?q?=20close?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Feature: FEAT-LOOP-2026-0251/G1-CLOSE --- .../FOLLOW-UPS.md | 97 +++++--- .../LEARNINGS-pending.md | 13 +- .../PROGRESS.md | 2 + .../RETROSPECTIVE.md | 218 +++++++++++------- .../WU-90-gate-1-close.md | 27 +-- .../events.jsonl | 2 + ...he-retry-note-for-the-three-deliverable.md | 2 +- 7 files changed, 222 insertions(+), 139 deletions(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md index 9d02b4d0..1a55827f 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md @@ -1,47 +1,78 @@ # Follow-ups — FEAT-LOOP-2026-0251 -Fourth close, 2026-11-26. One entry is open, below. The re-run conditions of #3608, #3609, -#3610 and #3612 hold. +Fifth close, 2026-11-26. One entry is open, below. The re-run conditions of #3608, #3609, +#3610, #3612 and #3613 hold. -### T03#1 — a kept file that an attempt deletes or reverts is missing from its retry note - -**Tracked as #3613.** +### T03#1 — the retry note's path list still misses renames, non-ASCII names and mode changes **Criterion** (`GATE-01.md`, clause 4): "**Tree and note.** An early refusal keeps or resets the tree per `defaults.retain_on_guard_refusal`, as the late refusal does; its retry note states that verification did not run and lists the paths this attempt changed (or says it changed none)." -**Evidence.** A probe drove `loop.run()` over the oracle's fixture with stubbed dispatch and -`verify` and a kept tree, with `fail_fast_deliverables` both true and false (same results). -It exited 0 and read the path list in the note for attempt 2: - -- attempt 1 writes `docs/notes.md`, attempt 2 deletes it: "(none — this attempt changed no - files)"; -- attempt 1 edits tracked `docs/tracked.md`, attempt 2 restores its old content: the same - "(none)" line; -- attempt 1 writes `docs/notes.md`, attempt 2 deletes it and writes `docs/second.md`: only - `docs/second.md`. - -`python3 -m unittest tests.test_fail_fast_deliverables -b` exits 0 (33 tests); no test -covers these cases. The cause is that `attempt_own_paths` filters the diff the guard judged, -and a removed or restored file has left that diff. The gap is not new with the #3612 fix: -by the code, the earlier listing used the same diff. +**In plain words.** After a refused attempt, the next session is told which files the last +one changed. For some kinds of change that list is incomplete, and sometimes it says +nothing changed when something did. Which attempts are refused is not affected. + +**Evidence.** A probe drove `loop.run()` through the oracle's `_second_attempt_note` helper +(kept tree, stubbed dispatch and `verify`), with fail-fast on and off (same results), and +read the path list in the note for attempt 2: + +- R9: attempt 2 renames a tracked file: only the new name is listed. A first attempt with a + reset tree does the same. +- R10: attempt 1 renames a tracked file, attempt 2 writes the old name back: "(none — this + attempt changed no files)". +- R11: attempt 2 only makes a kept new file executable: the same "(none)" line. +- R13: attempts 1 and 2 both edit tracked `docs/café.md`: "(none)". +- R15: attempt 2 restores that file: "(none)". + +`python3 -m unittest tests.test_fail_fast_deliverables -b` exits 0 (36 tests); no test +covers these cases. With `attempt_own_paths` returning its input unchanged, R10, R11 and +R13 list a path, so the filter added for #3612 drops them. Causes: git's rename detection +reports only the new name; git returns non-ASCII names quoted, so `_path_digest` returns +`None` both times; the digest covers content only. The same quoted names make +`git add -N` crash the driver on a new non-ASCII file in a kept tree (probe R4; the fourth +close saw the pre-feature driver do the same). + +**Why the loop did not fix it.** This close may not edit source files. + +**Options.** + +1. Fix the way the list is built. Record each path's state (content and mode) at the start + and end of the attempt, with names read by `git diff --no-renames --name-only -z` and + `git ls-files -z`, and list every path in either set whose state differs. + For: covers all five cases at once, and the same `-z` reading can fix the crash. + Against: more code on a judge surface, and another re-close (the four recorded closes + cost 6.35 USD). +2. Amend clause 4 to say the list is best-effort and name these limits, and change the + "this attempt changed no files" line so that it does not claim certainty. + For: small; the list only informs the next session. Against: the definition of done is + narrowed a third time on this gate, the wording change is still a source edit, and the + crash stays. + +**Recommendation:** option 1. The last two fixes each covered only the cases named so far; +comparing start and end states removes the dependence on the filtered diff. **Re-run condition.** Either of these: -- the note lists a kept file the attempt deleted or reverted, and does not say "changed no - files" in that case, shown by a test for each, with fail-fast on and off. A likely fix: - also take every path in the attempt-start snapshot that is no longer in the diff and whose - digest has changed; -- or the operator amends clause 4 to say the list covers only paths still in the diff, and - the note's "changed no files" wording is changed so that it does not claim more. - -The first is recommended: it is a small change, and the current line tells the next session -something false. +- the note lists the right paths in R9 (both names), R10, R11, R13 and R15, each shown by a + test with fail-fast on and off, and R7 and R14 still say nothing changed; +- or the operator amends clause 4 as in option 2 and the "changed no files" wording is + changed to match. ## Resolved +#### A kept file that an attempt deletes or reverts is missing from its retry note + +**Tracked as #3613.** **Re-run condition holds** (first branch). The note lists a deleted +kept file, a reverted tracked edit, and a deleted file plus a new one, with fail-fast on and +off (`test_deleting_a_kept_file_lists_it`, +`test_reverting_a_kept_tracked_edit_lists_it`, +`test_deleting_a_kept_file_and_writing_another_lists_both`; probe cases R1, R2, R5). With +the removed-path branch disabled in a scratch copy, `TestTreeAndNote` gives 6 failures. The +condition covers deletes and reverts of ordinary names; other kinds of change are the open +entry above. + #### A later attempt's note listed the earlier attempt's kept edits as its own **Tracked as #3612.** **Re-run condition holds** for the case the entry describes. Attempt 2 @@ -51,7 +82,7 @@ gets only that file, with fail-fast on and off `test_kept_edits_of_an_earlier_attempt_are_not_listed`, `test_editing_a_kept_file_again_lists_it`; probe cases R0 and R3). With the filter removed in a scratch copy, `TestTreeAndNote` gives 4 failures. The entry named no deletion or revert; -that is the open entry above. +that was #3613, below. #### The early refusal also outranks three other checks, and no precedence is stated for them @@ -78,5 +109,7 @@ this session; the probe's case A agrees. The ten changed modules pass (68 tests, exit 0), and the two edits are named in `RETROSPECTIVE.md`. -The fourth close reran the probes behind #3608 and #3610 and the tests behind #3609; all -three conditions still hold. +This fifth close reran the oracle (which holds the #3608 and #3612 tests), the ten modules +behind #3609 (68 tests, `OK`) and the removed-filter control. For #3610 the condition is the +wording in `GATE-01.md`, the close unit and `docs/methodology.md`, which is present; probe +cases D to G were not run again. diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/LEARNINGS-pending.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/LEARNINGS-pending.md index 4734b6f9..793f219c 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/LEARNINGS-pending.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/LEARNINGS-pending.md @@ -26,9 +26,10 @@ Licensed under the Apache License, Version 2.0. See LICENSE. and the gate's broad run went red. The named module (`tests.test_lint_plan`) did not exist, so check that each module a unit names can be imported before arming. -- [FEAT-LOOP-2026-0251/T03] **A "what this attempt changed" list cannot be a filter over the - diff against HEAD.** On a kept tree, a file the attempt deletes or restores leaves that - diff, and the list then says nothing changed. Compare the attempt-start and attempt-end - states over the union of their paths. Test write, edit, delete and revert on a second - attempt; a "changed nothing" test on a first attempt proves none of them. - +- [FEAT-LOOP-2026-0251/T03] **A "what this attempt changed" list cannot be a filter over a + name-only diff.** On a kept tree it missed deletes and reverts, which leave the diff, and + after that fix it still missed a renamed file's old name (rename detection), later edits + to a non-ASCII name (git quotes it, so the file cannot be opened) and mode changes. + Compare attempt-start and attempt-end states over the union of their paths, read with + `--no-renames -z`. Test write, edit, delete, revert, rename and a non-ASCII name on a + second attempt, and probe the whole matrix before the first fix, not one case per close. diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md index d9b89469..3a6d4bea 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md @@ -12,3 +12,5 @@ - note: docs/methodology.md still says "What is refused does not change, only when", which is not true for a gate-written deliverable under the default (probe case Q). - **FEAT-LOOP-2026-0251/G1-CLOSE**: Fourth close of gate 1 records not_met because the retry note omits a kept file that a later attempt deleted or reverted, and can then say the attempt changed no files (clause 4); closing files updated in place. - note: Fix by also listing attempt-start snapshot paths that left the diff and whose digest changed, with delete and revert tests; separately, a non-ASCII changed filename on a kept tree crashes git add -N, which also happens on the pre-feature loop.py. +- **FEAT-LOOP-2026-0251/G1-CLOSE**: Updated the gate 1 close files in place for the fifth close, with advisory verdict not_met because the retry note's path list still misses a renamed file's old name, later changes to kept non-ASCII-named files, a restore after an earlier rename, and mode-only changes (clause 4). + - note: Build the retry note's list by comparing attempt-start and attempt-end path states (content and mode, read with --no-renames -z), and reuse the -z reading for the git add -N crash on non-ASCII names. diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/RETROSPECTIVE.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/RETROSPECTIVE.md index 68b82850..5e1c4777 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/RETROSPECTIVE.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/RETROSPECTIVE.md @@ -4,49 +4,73 @@ ## Verdict -`not_met` (advisory; the judge concludes). Definition-of-done clause 4 does not hold in one -case. With the tree kept, an attempt that deletes or reverts a file an earlier attempt left -is not told so: the note omits the path, and when that is all the attempt did, the note says -"this attempt changed no files" (probe cases R1, R2, R5 below). The #3612 case itself is -fixed. This is the fourth close of the gate. Follow-up: `FOLLOW-UPS.md`. +`not_met` (advisory; the judge concludes). The #3613 cases are fixed: a kept file that the +attempt deletes or reverts is now listed. Definition-of-done clause 4 still does not hold. +The path list leaves out the old name of a renamed tracked file, and it says "this attempt +changed no files" after some later attempts that did change a file: a second edit or a +revert of a kept tracked file with a non-ASCII name, a restore of the old name of a file +an earlier attempt renamed, and a mode-only change (probe cases R9, R10, R11, R13, R15 +below). This is the fifth close of the gate. Follow-up: `FOLLOW-UPS.md`. ## Measurements -All commands ran fresh in this fourth close on the working tree, unless a line says -otherwise. Test runs and probes used `HOME` under `$TMPDIR` with a stub git identity. With -the real `HOME`, the sandbox blocks the driver's preflight write under the session -directory (`PermissionError ... .specfuse-preflight-probe`), and the oracle reported 21 -errors for that reason. +All commands ran fresh in this fifth close on the working tree, unless a line says +otherwise. Test runs and probes used `HOME` under `$TMPDIR` with a stub git identity, +because with the real `HOME` the sandbox blocks the driver's preflight write (observed in +the fourth close). git version 2.53.0. ### feature_oracle: PASS -`python3 -m unittest tests.test_fail_fast_deliverables -v -b`: exit 0, `Ran 33 tests`, `OK`, +`python3 -m unittest tests.test_fail_fast_deliverables -v -b`: exit 0, `Ran 36 tests`, `OK`, no skips. `grep -c "unittest.skip" tests/test_fail_fast_deliverables.py` prints `0`. A search of that file for `unittest.skip`, `skipIf`, `skipUnless`, `skipTest` and `@skip` finds nothing. -The oracle passes and does not cover the clause 4 gap below. +The oracle passes and does not cover the clause 4 gaps below. -### Retry note on a kept tree (#3612 and beyond it) +### Retry note on a kept tree (#3613 and beyond it) -A throwaway probe drove `loop.run()` over the oracle's fixture with -`retain_on_guard_refusal: true`, stubbed agent session and `verify`, and read the path list -in the note recorded for attempt 2. Each case gave the same result with fail-fast on and off. +A throwaway probe drove `loop.run()` through the oracle's own helper +(`_second_attempt_note`, kept tree, stubbed agent session and `verify`) and read the path +list in the note recorded for attempt 2. Each case gave the same result with fail-fast on +and off. The last column repeats the case with `attempt_own_paths` replaced by a function +that returns its input, which is the listing without the #3612 and #3613 logic. A dash +means the case was not repeated that way. -| Case | Attempt 1 | Attempt 2 | Attempt 2's note lists | Correct | -|---|---|---|---|---| -| R0 | writes `docs/notes.md` | writes `docs/second.md` | `docs/second.md` | yes | -| R1 | writes `docs/notes.md` | deletes it | "(none — this attempt changed no files)" | **no** | -| R2 | edits tracked `docs/tracked.md` | restores its old content | "(none — this attempt changed no files)" | **no** | -| R3 | edits tracked `docs/tracked.md` | edits it again | `docs/tracked.md` | yes | -| R5 | writes `docs/notes.md` | deletes it, writes `docs/second.md` | `docs/second.md` only | **no** | - -Cause, from the code: `attempt_own_paths` only filters the diff the guard judged. A deleted -untracked file and a file restored to its old content are no longer in that diff, so the -filter never sees them, although the attempt-start snapshot holds both. - -A sixth case, R4 (a new file with a non-ASCII name, kept tree), did not produce a note: -`loop.run()` raised `CalledProcessError` from `git add -N` on the quoted path, in -`retain_tree_after_refusal`. The same probe on the pre-feature `loop.py` (pinned build -`bd7e508`) raises the same error from the same function, so this feature did not introduce it. +| Case | Attempt 1 | Attempt 2 | Attempt 2's note lists | Correct | Without the filter | +|---|---|---|---|---|---| +| R0 | writes a new file | writes another | the second file | yes | — | +| R1 | writes a new file | deletes it | that file | yes | — | +| R2 | edits a tracked file | restores it | that file | yes | — | +| R3 | edits a tracked file | edits it again | that file | yes | — | +| R5 | writes a new file | deletes it, writes another | both | yes | — | +| R6 | deletes a tracked file | restores it | that file | yes | — | +| R7 | deletes a tracked file | nothing | "changed no files" | yes | — | +| R8 | writes a new file | renames it | both names | yes | — | +| R12 | writes a file with a space in its name | edits it | that file | yes | — | +| R9 | writes `docs/x.md` | renames tracked `docs/tracked.md` to `docs/moved.md` | `docs/moved.md` only | **no** | `moved.md`, `x.md`; old name still missing | +| R10 | renames tracked `docs/tracked.md` | writes the old name back, same content | "changed no files" | **no** | `docs/moved.md` | +| R11 | writes a new file | makes it executable | "changed no files" | **no** | that file | +| R13 | edits tracked `docs/café.md` | edits it again | "changed no files" | **no** | the file, in git's quoted form | +| R14 | edits tracked `docs/café.md` | nothing | "changed no files" | yes | lists it (the #3612 defect) | +| R15 | edits tracked `docs/café.md` | restores it | "changed no files" | **no** | "changed no files" | + +A separate probe renamed a tracked file on a first attempt with a reset tree. The note +listed only the new name, with fail-fast on and off. So the missing old name does not need +a kept tree. + +Causes, from the code together with the table: + +- `git_diff_names` and `pending_squash_names` call `git diff --name-only` with git's + default rename detection, which reports a rename under the new name only. The old name + is then in neither the guard's diff nor the attempt-start snapshot (R9, R10). +- Both return git's quoted form for a non-ASCII name. `_path_digest` cannot open that + string, so it returns `None` before and after, and the path never counts as changed + (R13, R15). R13 is caused by the filter added for #3612. +- `_path_digest` hashes file content only (R11). + +R4 (a new file with a non-ASCII name, kept tree): `loop.run()` raised +`CalledProcessError` from `git add -N` on the quoted path. The fourth close saw the +pre-feature `loop.py` raise the same error from the same function; that comparison was not +repeated. ### Other oracles @@ -54,7 +78,7 @@ A sixth case, R4 (a new file with a non-ASCII name, kept tree), did not produce |---|---| | `python3 -m unittest tests.test_dispatch_skeleton tests.test_gate_timings -b` | 25 tests, `OK` | | `python3 -m unittest tests.test_lint_plan -b` (named by T04) | **error: no such module** | -| the six `tests/test_lint_plan*.py` modules that do exist | 46 tests, `OK` | +| the `tests/test_lint_plan*.py` modules that do exist | 46 tests, `OK` | | the ten changed pre-existing test modules | 68 tests, `OK` | | `.specfuse/scripts/lint_plan.py` over every feature folder with a `PLAN.md` | 97 linted, 0 non-zero exits | | `diff` of `verification.yml.example` against its packaged copy | exit 0, empty | @@ -62,25 +86,26 @@ A sixth case, R4 (a new file with a non-ASCII name, kept tree), did not produce | `python3 -m specfuse.loop.changelog_fragments check` | exit 0 | This session did not run the full suite or coverage. The driver's broad run recorded at -2026-11-26T16:17:14Z has `ok: true` and no failing gate. Its tests log -(`work/gate-logs/`, stamp `20261126T161608`) shows `Ran 5147 tests`, `OK (skipped=4)`; the -latest coverage log shows 92% total. +2026-11-26T16:51:24Z has `ok: true` and no failing gate. Its tests log +(`work/gate-logs/`, stamp `20261126T165040`) shows `Ran 5150 tests`, `OK (skipped=4)`; its +coverage log shows 92% total. ### Controls: the oracle observes the feature Each mutation ran in a scratch copy of the package, tests and `.specfuse/` (without the -feature folders). The unmodified copy ran the 33 oracle tests: `OK`. +feature folders). The unmodified copy ran the 36 oracle tests: `OK`. | Mutation | Result | |---|---| | `resolve_fail_fast_deliverables` forced to return `False` | 13 failures, no errors: `TestOptOut` 4, `TestPresenceEarly` 3, `TestProducesNotInDiffEarly` 3, `TestTreeAndNote` 2, `TestEarlyRefusalRecovery` 1 | -| `attempt_own_paths` returns its input unfiltered (#3612 undone) | `TestTreeAndNote`, 9 tests: 4 failures, e.g. `'docs/notes.md' unexpectedly found` | +| `attempt_own_paths` returns its input unfiltered (#3612 undone) | `TestTreeAndNote`, 12 tests: 10 failures (subtests counted) | +| only the removed-path branch disabled (#3613 undone) | `TestTreeAndNote`, 12 tests: 6 failures (subtests counted) | | `check_produces_mentioned` made a no-op | `TestArmTimeWarning`, 6 tests: 2 failures (the other four expect silence) | -| `loop.py` replaced by the pre-feature one (`bd7e508`, no `fail_fast_deliverables`) | 33 tests: 12 failures, 18 errors (subtests counted) | +| `loop.py` replaced by the pre-feature one (`bd7e508`, no `fail_fast_deliverables`) | 36 tests: 12 failures, 24 errors (subtests counted) | On the old driver, `TestProducesNotInDiffEarly` (6) and `TestPresenceEarly` (3) give only errors, from a missing interface; the first mutation is the behaviour evidence for those two -classes. `TestOptOut` (3 failures, 1 error) and `TestTreeAndNote` (7 failures, 5 errors) +classes. `TestOptOut` (3 failures, 1 error) and `TestTreeAndNote` (7 failures, 11 errors) also fail on assertions. This is not a full pre-feature tree. ### Early against late, same input @@ -88,39 +113,44 @@ also fail on assertions. This is not a full pre-feature tree. A throwaway probe drove `loop.run()` over the oracle's fixture and read the first `attempt_outcome` for T01, once with fail-fast on and once off. Verification is a stub. The unit declares `src/rule.py`. "Untouched" means the attempt writes only `docs/notes.md`. Each -cell is outcome / failure class. Every early deliverable refusal recorded -`verify_seconds: 0` and `tree_retained: true` under the default. +cell is outcome / failure class. Where one name is shown, both are equal. Every early +deliverable refusal recorded `verify_seconds: 0` and `tree_retained: true`. + +Run again in this close: | Case | fail-fast on | fail-fast off | Differs because | |---|---|---|---| | A: RESULT claims `src/rule.py` in `files_changed` | `produces_not_in_diff` | `files_changed_mismatch` | outranks a later guard | | B: verify stub fails, untouched | `produces_not_in_diff` | `failed` / `other` | outranks a gate | | C: untouched, nothing else wrong | `produces_not_in_diff` | same | same | -| D: failing smoke-import line, untouched | `produces_not_in_diff` | `smoke_import_failed` | outranks a later guard | -| E: also declares `docs/report.md`, written with a `BLOCKED` verdict heading; untouched | `produces_not_in_diff` | `failed` / `guard_refusal` | outranks a later guard | -| F: unit typed `close`, untouched | `produces_not_in_diff` | `closing_deliverable_missing` / `guard_refusal` | outranks a later guard | -| G: failing smoke-import line, `src/rule.py` emptied | `deliverable_missing` / `guard_refusal` | `smoke_import_failed` | outranks a later guard | -| H: squash commit rejected (stub), untouched | `produces_not_in_diff` | `squash_commit_failed` | outranks a later check | -| I: failing smoke-import line, nothing written | `no_deliverable_files` / `guard_refusal` | `smoke_import_failed` | outranks a later guard | -| J: `close` unit, nothing written | `produces_not_in_diff` | `closing_deliverable_missing` / `guard_refusal` | outranks a later guard | +| G without the smoke-import line: `src/rule.py` emptied | `deliverable_missing` / `guard_refusal` | same | same | | K: verify stub fails, nothing written | `no_deliverable_files` / `guard_refusal` | `failed` / `other` | outranks a gate | -| P: squash commit rejected (stub), `src/rule.py` emptied | `deliverable_missing` / `guard_refusal` | `squash_commit_failed` | outranks a later check | | L: nothing written (two deliverable refusals apply) | `no_deliverable_files` / `guard_refusal` | same | same | | M: only `src/rule.py` deleted (two apply) | `deliverable_missing` / `guard_refusal` | same | same | -| O: RESULT `status: blocked`, untouched | `blocked` | same | same | -| Q: verify stub writes `src/rule.py`; the attempt did not | `produces_not_in_diff` | `passed` | outranks a gate; no late refusal exists | +| O: RESULT `status: blocked`, untouched | `blocked`, no failure class | same | same | -Where a failure class is not shown, it equals the outcome name. The failure class in B and K -depends on the stub's output. The first run of H and P with fail-fast off raised, because -the probe's stub threw the wrong exception type; both were rerun with `SquashCommitError`. +Not run again, and carried only as the fourth close's observations. The only source change +named since then is in `attempt_own_paths`, which builds note text. -Not repeated in this close, and carried only as the earlier closes' observations: case N -(zero-token session), each second check firing alone when every declared path is changed, -and the probe of early presence refusals with `retain_on_guard_refusal: false`. +| Case | fail-fast on | fail-fast off | +|---|---|---| +| D: failing smoke-import line, untouched | `produces_not_in_diff` | `smoke_import_failed` | +| E: also declares a report written with a `BLOCKED` verdict heading; untouched | `produces_not_in_diff` | `failed` / `guard_refusal` | +| F: unit typed `close`, untouched | `produces_not_in_diff` | `closing_deliverable_missing` / `guard_refusal` | +| G: failing smoke-import line, `src/rule.py` emptied | `deliverable_missing` / `guard_refusal` | `smoke_import_failed` | +| H: squash commit rejected (stub), untouched | `produces_not_in_diff` | `squash_commit_failed` | +| I: failing smoke-import line, nothing written | `no_deliverable_files` / `guard_refusal` | `smoke_import_failed` | +| J: `close` unit, nothing written | `produces_not_in_diff` | `closing_deliverable_missing` / `guard_refusal` | +| P: squash commit rejected (stub), `src/rule.py` emptied | `deliverable_missing` / `guard_refusal` | `squash_commit_failed` | +| Q: verify stub writes `src/rule.py`; the attempt did not | `produces_not_in_diff` | `passed` | + +Also not repeated, from earlier closes: case N (zero-token session), each second check +firing alone when every declared path is changed, and early presence refusals with +`retain_on_guard_refusal: false`. ### Per-criterion results -All 13 criteria were re-measured. `GATE-01-CRITERIA.md` is left as the driver seeded it, +All 13 criteria were looked at again. `GATE-01-CRITERIA.md` is left as the driver seeded it, because it is not one of this unit's permitted closing surfaces. | Criterion | Result | Evidence | @@ -131,7 +161,7 @@ because it is not one of this unit's permitted closing surfaces. | T02#1 | passes | `TestPresenceEarly`; on the old driver errors only, behaviour shown by the first mutation | | T02#2 | passes | `TestOptOut`; assertion failures on the old driver | | T02#3 | passes | empty diff | -| T03#1 | the listed assertions pass; clause 4, which the unit exists to turn green, **fails** | `TestTreeAndNote`; probe cases R1, R2, R5 | +| T03#1 | the listed assertions pass; clause 4, which the unit exists to turn green, **fails** | `TestTreeAndNote`; probe cases R9, R10, R11, R13, R15 | | T03#2 | passes | `test_list_is_capped_at_twenty` | | T04#1 | passes | `TestArmTimeWarning`; no-op control | | T04#2 | passes with the repository script | 97 folders, 0 non-zero exits | @@ -148,10 +178,10 @@ carried forward: 0 criteria, re-measured: 13 | 1. `produces_not_in_diff` early | Refused with 0 `verify_fn` calls, `verify_seconds` 0, no attempt-phase `gate_result`; a changed path verifies once and passes; a justified path still verifies; class, signature and summary equal the late site's | `TestProducesNotInDiffEarly` (6 tests) | | 2. Presence early | Absent, empty and bookkeeping-only diffs are refused with 0 calls | `TestPresenceEarly` (3) | | 3. Opt-out | With the key `false`, each of the three cases verifies once; outcome, class, signature and summary equal the default's, for inputs that trip one refusal | `TestOptOut` (4), on plain-RESULT, passing-stub inputs; probe cases C, L, M | -| 4. Tree and note | **Not proven.** The note says verification did not run, lists written and edited paths, leaves out untouched kept edits (#3612) and caps at 20; the tree is kept or reset. It omits a kept file the attempt deleted or reverted, and can then say the attempt changed nothing | `TestTreeAndNote` (9). Probe R1, R2, R5 fail. The kept/reset assertions use `produces_not_in_diff` only | +| 4. Tree and note | **Not proven.** The note says verification did not run; lists written, edited, deleted (#3613) and reverted (#3613) paths with ordinary names; leaves out untouched kept edits (#3612); caps at 20; the tree is kept or reset. The list still omits the changes in probe cases R9, R10, R11, R13 and R15 | `TestTreeAndNote` (12). The kept/reset assertions use `produces_not_in_diff` only | | 5. Arm-time WARN | Warns on an unmentioned path; silent on full path, file name or parent directory, and on `done` / `abandoned`; `lint()` calls it | `TestArmTimeWarning` (6) | | 6. Nothing else changes | Holds as widened for #3609. See the list below | `diff -ru` of `tests/` against the recorded base; the ten modules pass | -| Precedence over every later check | Holds on every probed pair. A test asserts only the `files_changed_mismatch` pair | `test_deliverable_refusal_outranks_files_changed_mismatch`; probe cases A, B, D to K, P, Q | +| Precedence over every later check | Holds on every probed pair. A test asserts only the `files_changed_mismatch` pair | `test_deliverable_refusal_outranks_files_changed_mismatch`; probe cases A, B and K run again; D to J, P and Q carried from the fourth close | Three review fixes made before the first close, outside any work unit, are covered by `TestEarlyRefusalRecovery` (3: re-plan still fires; uncommitted tracked edits count as a @@ -159,14 +189,14 @@ moved tree; an untouched tree still halts) and `TestEarlyRetainedNoteWording` (2 ## Pre-existing tests changed -This fourth close ran no git command and did not repeat the tree comparison. It listed the +This fifth close ran no git command and did not repeat the tree comparison. It listed the files under `tests/`, `specfuse/`, `scripts/`, `.specfuse/scripts/` and `docs/` modified -after the third close last wrote this file: only `specfuse/loop/loop.py` and the feature's -own `tests/test_fail_fast_deliverables.py` (the #3612 fix and its three tests). No -pre-existing test is newer. The third close did the same kind of check against the second -close's comparison, below. This is a modification-time check, not a content diff. The ten -modules were rerun in this session. In the comparison text, "this session" means the second -close. +after the fourth close last wrote `LEARNINGS-pending.md`: only `specfuse/loop/loop.py` and +the feature's own `tests/test_fail_fast_deliverables.py` (the #3613 fix and its three +tests). No pre-existing test is newer. The third and fourth closes did the same kind of +check, each against the close before, back to the second close's comparison, below. These +are modification-time checks, not content diffs. The ten modules were rerun in this +session. In the comparison text, "this session" means the second close. Compared against the public tarball of `a89373d119f8e2d8003a8956dbd4bd27dde8057f`, the merge base recorded on the first close's `judged` event, and against public `main` as @@ -222,7 +252,14 @@ clause 4, and the driver filed #3612: the note listed an earlier attempt's kept later attempt's own. That close, like the two before it, tested "changed nothing" only on a first attempt. The fix (`snapshot_dirty_tree`, `attempt_own_paths`, three tests) was made on the branch outside any work unit, and the operator re-armed this unit. This fourth close -probed removals on a kept tree and found the gap in the Verdict. +probed removals on a kept tree and found that deleted and reverted files were missing. + +The fourth close (2026-11-26T16:28Z) and the judge recorded `not_met`, and the driver filed +#3613. The fix to `attempt_own_paths` and three tests were made on the branch outside any +work unit, and the operator re-armed this unit. This fifth close confirmed that fix and +probed renames, non-ASCII names and a mode change. #3612, #3613 and the gaps now open are +all in one list, built by filtering a name-only diff; each fix so far covered the cases the +previous close had named. T04 passed although its Verification section names `tests.test_lint_plan`, which does not exist. @@ -243,15 +280,17 @@ includes its judge: `record_judge_cost_fold` adds the judge's usage to the attem | G1-CLOSE, first close | 5.00 (one plan line for all closes) | 1.69 | 0.44 | 34% | 1 | | G1-CLOSE, second close | (same line) | 1.49 | 0.48 | 30% | 1 | | G1-CLOSE, third close | (same line) | 1.73 | 0.57 | 35% | 1 | -| G1-CLOSE, fourth close | (same line) | not yet recorded | — | — | in progress | -| G1-CLOSE, three recorded closes | 5.00 | 4.92 | 1.49 | 98% | 3 | - -Recorded unit spend is 7.59 USD against a plan of 11.00 and a gate budget of 14.00. This -session's cost and its judge's are written later; any non-trivial amount takes the close -line past its 5.00 plan. The earlier `blocked_human` stop of this unit recorded 0.00. The -independent review, its fixes, both amendments and the #3612 fix happened outside the loop, -so `events.jsonl` has no cost for them. All three re-closes cost money for questions the -plan or the oracle had left open: two for an unstated precedence, one for the #3612 defect. +| G1-CLOSE, fourth close | (same line) | 1.44 | 0.36 | 29% | 1 | +| G1-CLOSE, fifth close | (same line) | not yet recorded | — | — | in progress | +| G1-CLOSE, four recorded closes | 5.00 | 6.35 | 1.84 | 127% | 4 | + +Recorded unit spend is 9.03 USD against a plan of 11.00 and a gate budget of 14.00. The +close line is already past its 5.00 plan, and this session's cost and its judge's are +written later. The earlier `blocked_human` stop of this unit recorded 0.00. The independent +review, its fixes, both amendments and the #3612 and #3613 fixes happened outside the loop, +so `events.jsonl` has no cost for them. All four re-closes cost money for questions the +plan or the oracle had left open: two for an unstated precedence, one for the #3612 defect +and this one for #3613. **T04's warning rate.** Re-measured this session over `done` units with `produces:`: the shipped rule (path, file name or parent directory) would fire on 35 of 402, **8.7%**, under @@ -265,7 +304,7 @@ satisfied by almost any body. The WARN is weak for such paths. Pending human acknowledgment. Each has a `changelog.d/` fragment tracing to `FEAT-LOOP-2026-0251`. This close added no fragment; it extended the retry-note one in place -with the kept-tree behaviour and its known limit. +with the kept-tree behaviour and its known limits. 1. **Changed:** the three deliverable refusals run before verification. They take precedence over every verification gate and later guard. An attempt that also would have failed one @@ -273,8 +312,10 @@ with the kept-tree behaviour and its known limit. old order reset it. 2. **Added:** `defaults.fail_fast_deliverables`, default `true`. 3. **Changed:** the retry note for the three refusals lists the changed paths, at most 20 - plus a count. Untouched edits kept from an earlier attempt are left out. Known limit: a - kept file the attempt deleted or reverted is not listed. + plus a count. Untouched edits kept from an earlier attempt are left out; kept files the + attempt deleted or reverted are listed. Known limits: a renamed tracked file appears + under its new name only; later changes to a kept non-ASCII-named file and mode-only + changes to a kept file are not listed. 4. **Added:** a `specfuse lint` WARN for a `produces:` path the unit's body never mentions. ## Notes for the human reviewer @@ -284,8 +325,9 @@ None of these is a failed criterion. This unit may edit none of the files concer - **Older defect, worth its own bug.** A refused attempt that keeps its tree and has a changed file with a non-ASCII name stops the driver with `CalledProcessError`: `git_diff_names` returns git's quoted form and `git add -N` rejects it (probe R4). The - pre-feature `loop.py` does the same. `attempt_own_paths` reads the same names, so a fix - should cover both. This close filed no issue for it. + fourth close saw the pre-feature `loop.py` do the same. `attempt_own_paths` reads the + same names (cases R13, R15), so one fix should cover both. This close filed no issue for + the crash itself; the follow-up entry mentions it. - **One sentence in `docs/methodology.md` is too strong.** It says "What is refused does not change, only when." Probe case Q is an attempt that passes with the key `false` and is @@ -310,9 +352,11 @@ None of these is a failed criterion. This unit may edit none of the files concer `attempt_outcome` in `events.jsonl` before this close is `passed`. No real early refusal has happened, so no real saving in gate time is measured. - The probes stubbed the agent session, `verify`, and (for H and P) the squash rejection. -- The three observations listed after the early-against-late table as not repeated. -- Other ways to change a kept file that the note might miss, such as a mode-only change or a - rename. The digest covers file content only; this is read from the code, not probed. +- Early-against-late cases D to J (with the smoke-import line or `close` type), P, Q and N, + and the other observations listed as not run again. +- Other ways to change a file that the note might miss, such as symlinks (the digest follows + the link), submodules, a rename under a non-default `diff.renames` setting, or a name + containing a quote or newline. None was probed. - That cases A to Q are the whole list of overtaken checks. The list comes from reading `execute_unit_attempt()` and the post-squash guards in `run()`. The general rule does not depend on the list being complete; the claim that it holds rests on the early check running diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md index 759a2b37..0d9e7e23 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md @@ -1,8 +1,8 @@ --- id: FEAT-LOOP-2026-0251/G1-CLOSE type: close -status: pending -attempts: 0 +status: done +attempts: 1 oracle_env: macos_local planned_cost_usd: 5.00 auto_close_disabled: true @@ -53,19 +53,20 @@ re_arm_history: prior_cost_usd: 1.435437 prior_duration_seconds: 478.949 reason: "Fixed the deleted-file edge case, re-close it" -cumulative_cost_usd: 4.915036 -cumulative_duration_seconds: 930.426 -cumulative_input_tokens: 174 -cumulative_output_tokens: 114622 -cumulative_attempts: 3 -cost_usd: 1.435437 -duration_seconds: 478.949 -input_tokens: 62 -output_tokens: 35593 -folded_through_re_arm: 4 +cumulative_cost_usd: 6.350473 +cumulative_duration_seconds: 1409.375 +cumulative_input_tokens: 236 +cumulative_output_tokens: 150215 +cumulative_attempts: 4 +cost_usd: 0.872732 +duration_seconds: 616.642 +input_tokens: 30 +output_tokens: 26181 +folded_through_re_arm: 5 gate_set: plannext driver_version: 0.33.2 -started_at: 2026-11-26T16:17:14.747069+00:00 +started_at: 2026-11-26T16:51:24.709873+00:00 +verdict: not_met --- # G1-CLOSE — terminal close diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index 750c2b03..564a40d4 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -242,3 +242,5 @@ {"timestamp": "2026-11-26T16:51:24.472754+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "init-sh-shim-bats", "ok": true, "skipped": false, "duration_seconds": 0.906, "phase": "broad"}} {"timestamp": "2026-11-26T16:51:24.472756+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "init-skills-bats", "ok": true, "skipped": false, "duration_seconds": 0.146, "phase": "broad"}} {"timestamp": "2026-11-26T16:51:24.472758+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "hookspath-conflict-bats", "ok": true, "skipped": false, "duration_seconds": 0.617, "phase": "broad"}} +{"timestamp": "2026-11-26T16:51:24.597739+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "terminal_judge_editing_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "status": "clean", "reason": "acknowledged by operator: .specfuse/verification.yml.example, produces_driver_helper, specfuse/loop/data/verification.yml.example, specfuse/loop/lint_plan.py, specfuse/loop/loop.py"}} +{"timestamp": "2026-11-26T16:51:24.601972+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "terminal_judge_editing_acknowledged", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "close_unit": "FEAT-LOOP-2026-0251/G1-CLOSE", "paths": [".specfuse/verification.yml.example", "produces_driver_helper", "specfuse/loop/data/verification.yml.example", "specfuse/loop/lint_plan.py", "specfuse/loop/loop.py"], "reason": "Review fixes tested, full suite green, accept the generator risk"}} diff --git a/changelog.d/FEAT-LOOP-2026-0251-the-retry-note-for-the-three-deliverable.md b/changelog.d/FEAT-LOOP-2026-0251-the-retry-note-for-the-three-deliverable.md index 47c90236..6294753c 100644 --- a/changelog.d/FEAT-LOOP-2026-0251-the-retry-note-for-the-three-deliverable.md +++ b/changelog.d/FEAT-LOOP-2026-0251-the-retry-note-for-the-three-deliverable.md @@ -2,4 +2,4 @@ class: changed trace: FEAT-LOOP-2026-0251 --- -The retry note for the three deliverable refusals now lists the paths the attempt changed (at most 20, plus a count of the rest), or says it changed none. Edits kept from an earlier attempt that this attempt did not touch are not listed. Known limit: a kept file that this attempt deleted or reverted is not listed either, so the note can say it changed none +The retry note for the three deliverable refusals now lists the paths the attempt changed (at most 20, plus a count of the rest), or says it changed none. Edits kept from an earlier attempt that this attempt did not touch are not listed; kept files that this attempt deleted or reverted are. Known limits: a renamed tracked file is listed under its new name only, and later changes to a kept file with a non-ASCII name, or a mode-only change to a kept file, are not listed, so the note can say it changed none From db173886c5659db1f5ac0928b8d8b10adb482b49 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 12:03:17 -0500 Subject: [PATCH 50/69] chore(loop): FEAT-LOOP-2026-0251/G1-CLOSE judge cost fold Feature: FEAT-LOOP-2026-0251 --- .../WU-90-gate-1-close.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md index 0d9e7e23..24c25f90 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md @@ -58,10 +58,10 @@ cumulative_duration_seconds: 1409.375 cumulative_input_tokens: 236 cumulative_output_tokens: 150215 cumulative_attempts: 4 -cost_usd: 0.872732 +cost_usd: 1.347591 duration_seconds: 616.642 -input_tokens: 30 -output_tokens: 26181 +input_tokens: 44 +output_tokens: 31539 folded_through_re_arm: 5 gate_set: plannext driver_version: 0.33.2 From 73c6efca7700fb840a381c30908e0af20d9d68e7 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 12:03:17 -0500 Subject: [PATCH 51/69] chore(loop): gate 1 awaiting_review Feature: FEAT-LOOP-2026-0251 --- .../GATE-01.md | 2 +- .../events.jsonl | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md index 58fa9d5b..04b596db 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md @@ -1,6 +1,6 @@ --- gate: 1 -status: open +status: awaiting_review feature_oracle: "python3 -m unittest tests.test_fail_fast_deliverables -v -b" cost_budget_usd: 14.00 broad_run: diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index 564a40d4..c839509d 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -244,3 +244,12 @@ {"timestamp": "2026-11-26T16:51:24.472758+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "hookspath-conflict-bats", "ok": true, "skipped": false, "duration_seconds": 0.617, "phase": "broad"}} {"timestamp": "2026-11-26T16:51:24.597739+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "terminal_judge_editing_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "status": "clean", "reason": "acknowledged by operator: .specfuse/verification.yml.example, produces_driver_helper, specfuse/loop/data/verification.yml.example, specfuse/loop/lint_plan.py, specfuse/loop/loop.py"}} {"timestamp": "2026-11-26T16:51:24.601972+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "terminal_judge_editing_acknowledged", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "close_unit": "FEAT-LOOP-2026-0251/G1-CLOSE", "paths": [".specfuse/verification.yml.example", "produces_driver_helper", "specfuse/loop/data/verification.yml.example", "specfuse/loop/lint_plan.py", "specfuse/loop/loop.py"], "reason": "Review fixes tested, full suite green, accept the generator risk"}} +{"timestamp": "2026-11-26T16:51:24.710228+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "task_started", "source": "driver", "source_version": "0.33.2", "payload": {"type": "close", "model": "sonnet", "re_arm_count": 5}} +{"timestamp": "2026-11-26T16:51:24.710233+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "re_arm_dispatched", "source": "driver", "source_version": "0.33.2", "payload": {"re_arm_count": 5, "reason": "Fixed the deleted-file edge case, re-close it"}} +{"timestamp": "2026-11-26T17:01:41.389812+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "plan-lint", "ok": true, "skipped": false, "duration_seconds": 0.113, "phase": "attempt"}} +{"timestamp": "2026-11-26T17:01:41.389891+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "feature_oracle", "ok": true, "skipped": false, "duration_seconds": 40.919, "phase": "attempt"}} +{"timestamp": "2026-11-26T17:03:17.123709+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "judged", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "close_verdict": "not_met", "close_model": "sonnet", "judge_verdict": "not_met", "verdict": "not_met", "lowered": false, "disagreed": false, "findings": 2, "reason": null, "diff_base": "3bc8bef37e1903f18b2a48f78a44fb9a63600864", "diff_base_source": "merge-base of HEAD with main", "usage": {"cost_usd": 0.47485830000000007, "input_tokens": 14, "output_tokens": 5358, "cache_read_input_tokens": 525903, "cache_creation_input_tokens": 92165}, "judge_cost_usd": 0.474858}} +{"timestamp": "2026-11-26T17:03:17.125461+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "attempt_outcome", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "outcome": "passed", "duration_seconds": 616.642, "agent_seconds": 575.434865709045, "verify_seconds": 41.05921195796691, "cost_usd": 1.3475906, "input_tokens": 44, "output_tokens": 31539, "cache_read_input_tokens": 1981046, "cache_creation_input_tokens": 208502, "model": "sonnet", "effort": "high", "failure_class": null, "failure_signature": null, "failure_excerpt": null, "files_touched": [".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md", ".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/LEARNINGS-pending.md", ".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/RETROSPECTIVE.md", ".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md", ".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl", "changelog.d/FEAT-LOOP-2026-0251-the-retry-note-for-the-three-deliverable.md"], "agent_status": "complete", "agent_blocked_reason": null, "re_arm_count": 0, "failing_tests": []}} +{"timestamp": "2026-11-26T17:03:17.125721+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "task_completed", "source": "driver", "source_version": "0.33.2", "payload": {"attempts": 1, "attempts_usage": [{"attempt": 1, "duration_seconds": 616.642, "cost_usd": 1.3475906, "input_tokens": 44, "output_tokens": 31539, "cache_read_input_tokens": 1981046, "cache_creation_input_tokens": 208502, "agent_seconds": 575.434865709045, "verify_seconds": 41.05921195796691}], "type": "close", "re_arm_count": 5, "cost_usd": 1.347591, "cumulative_cost_usd": 7.698064, "attempts_lifetime": 5, "planned_cost_usd": 5.0}} +{"timestamp": "2026-11-26T17:03:17.147926+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_reached", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1}} +{"timestamp": "2026-11-26T17:03:17.147918+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "arm_predicate_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "would_arm": true, "predicate_version": "v1", "classes": {"budget_projection": {"status": "clean", "reason": "projected spend $10.37 within 2.0x baseline planned total $11.00 (cap $22.00)"}, "judge_editing": {"status": "clean", "reason": "no drafted WU touches judge-path surfaces"}, "decision_class_paths": {"status": "clean", "reason": "no drafted WU touches a recognised dependency manifest (pyproject.toml, package.json, pom.xml, build.gradle, build.gradle.kts, Cargo.toml, go.mod, Gemfile, composer.json, requirements*.txt, *.csproj)"}, "retroactive_edits": {"status": "clean", "reason": "no passed-gate baseline WU altered or removed"}, "drift_caps": {"status": "clean", "reason": "added WUs and gates within drift caps"}, "missing_provenance": {"status": "clean", "reason": "no added WUs"}, "open_questions_human_only": {"status": "clean", "reason": "terminal gate: no drafted successor"}, "plan_next_lint": {"status": "clean", "reason": "plan-next lint: no findings"}}}} From 7699a78a76265f942c85888b88734341d65d4629 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 12:03:19 -0500 Subject: [PATCH 52/69] =?UTF-8?q?chore(loop):=20FEAT-LOOP-2026-0251=20?= =?UTF-8?q?=E2=80=94=20record=20the=20follow-up=20issues=20the=20driver=20?= =?UTF-8?q?filed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md | 2 ++ .../FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl | 1 + 2 files changed, 3 insertions(+) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md index 1a55827f..1513692d 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md @@ -5,6 +5,8 @@ Fifth close, 2026-11-26. One entry is open, below. The re-run conditions of #360 ### T03#1 — the retry note's path list still misses renames, non-ASCII names and mode changes +**Tracked as #3614.** + **Criterion** (`GATE-01.md`, clause 4): "**Tree and note.** An early refusal keeps or resets the tree per `defaults.retain_on_guard_refusal`, as the late refusal does; its retry note states that verification did not run and lists the paths this attempt changed (or says it diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index c839509d..ecd9a722 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -253,3 +253,4 @@ {"timestamp": "2026-11-26T17:03:17.125721+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "task_completed", "source": "driver", "source_version": "0.33.2", "payload": {"attempts": 1, "attempts_usage": [{"attempt": 1, "duration_seconds": 616.642, "cost_usd": 1.3475906, "input_tokens": 44, "output_tokens": 31539, "cache_read_input_tokens": 1981046, "cache_creation_input_tokens": 208502, "agent_seconds": 575.434865709045, "verify_seconds": 41.05921195796691}], "type": "close", "re_arm_count": 5, "cost_usd": 1.347591, "cumulative_cost_usd": 7.698064, "attempts_lifetime": 5, "planned_cost_usd": 5.0}} {"timestamp": "2026-11-26T17:03:17.147926+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_reached", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1}} {"timestamp": "2026-11-26T17:03:17.147918+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "arm_predicate_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "would_arm": true, "predicate_version": "v1", "classes": {"budget_projection": {"status": "clean", "reason": "projected spend $10.37 within 2.0x baseline planned total $11.00 (cap $22.00)"}, "judge_editing": {"status": "clean", "reason": "no drafted WU touches judge-path surfaces"}, "decision_class_paths": {"status": "clean", "reason": "no drafted WU touches a recognised dependency manifest (pyproject.toml, package.json, pom.xml, build.gradle, build.gradle.kts, Cargo.toml, go.mod, Gemfile, composer.json, requirements*.txt, *.csproj)"}, "retroactive_edits": {"status": "clean", "reason": "no passed-gate baseline WU altered or removed"}, "drift_caps": {"status": "clean", "reason": "added WUs and gates within drift caps"}, "missing_provenance": {"status": "clean", "reason": "no added WUs"}, "open_questions_human_only": {"status": "clean", "reason": "terminal gate: no drafted successor"}, "plan_next_lint": {"status": "clean", "reason": "plan-next lint: no findings"}}}} +{"timestamp": "2026-11-26T17:03:19.675099+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "followups_recorded", "source": "driver", "source_version": "0.33.2", "payload": {"filed": 1, "unfiled": 0, "already_tracked": 0, "issue_numbers": ["3614"], "written_back": ["FOLLOW-UPS.md"]}} From 645995979481fee86a6fb013b541eefe62173947 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 12:11:56 -0500 Subject: [PATCH 53/69] fix(loop): build the retry note's path list by comparing tree state (#3614) Each earlier fix filtered the diff the guard judged, so renames (only the new name), mode-only changes and non-ASCII names (quoted by git) were still missed or reported as 'changed no files'. The list is now built by comparison: every path that differs from the attempt's starting commit at its start or at the refusal (git diff --no-renames -z plus untracked, NUL-separated) is compared by state (file type, executable bits, content digest) across the attempt. Co-Authored-By: Claude Opus 5.5 --- .../PLAN.md | 8 ++ specfuse/loop/loop.py | 105 ++++++++++++------ tests/test_fail_fast_deliverables.py | 68 ++++++++++++ 3 files changed, 147 insertions(+), 34 deletions(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PLAN.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PLAN.md index b2e325e6..40670f3a 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PLAN.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PLAN.md @@ -143,3 +143,11 @@ gates: "changed no files". `attempt_own_paths` now also lists every attempt-start snapshot path that is no longer in that diff and whose content has changed. Tested in `TestTreeAndNote` (deleted, reverted tracked edit, deleted plus a new file), with and without `fail_fast_deliverables`. +- **Fifth-close follow-up (2026-11-26, #3614).** The list still missed renames, mode-only changes + and non-ASCII names, because each earlier fix filtered the guard's diff. It is now built by + comparison: every path that differs from the attempt's starting commit at its start or at the + refusal (`git diff --no-renames -z` plus untracked, read NUL-separated) is compared by state + (file type, executable bits, content digest) across the attempt. Tested in `TestTreeAndNote` + for each case, with and without `fail_fast_deliverables`; a non-ASCII kept edit left alone + still reads "changed no files". The driver crash on `git add -N` for a new non-ASCII file is a + separate, pre-existing defect (it predates this feature) and is not fixed here. diff --git a/specfuse/loop/loop.py b/specfuse/loop/loop.py index 929eaa7d..1ff1b646 100644 --- a/specfuse/loop/loop.py +++ b/specfuse/loop/loop.py @@ -52,6 +52,7 @@ import re import shutil import signal +import stat import subprocess import sys import tempfile @@ -3101,48 +3102,84 @@ def untracked_paths() -> set[str]: return {line.strip() for line in out.splitlines() if line.strip()} -def _path_digest(path: str) -> "str | None": - """SHA-256 of a file's bytes, or None when it is absent or unreadable.""" +def _path_state(path: str) -> "tuple[int, str] | None": + """What a file is on disk, for telling whether an attempt changed it: + its type and executable bits (what git records of the mode) and a digest + of its bytes, or of its target for a symlink. None when it is absent or + unreadable.""" try: - return hashlib.sha256(Path(path).read_bytes()).hexdigest() + st = os.lstat(path) + if stat.S_ISLNK(st.st_mode): + data = os.readlink(path).encode() + else: + data = Path(path).read_bytes() except OSError: return None + return (stat.S_IFMT(st.st_mode) | (st.st_mode & 0o111), + hashlib.sha256(data).hexdigest()) + + +def _paths_differing_from(head: str) -> "set[str] | None": + """Every path whose working-tree state differs from *head*: tracked + changes, staged or not, by both their old and new names (no rename + pairing), plus untracked files. Names are read NUL-separated, so git + does not quote non-ASCII ones. None on any git error.""" + try: + tracked = subprocess.run( + ["git", "diff", "--no-renames", "--name-only", "-z", head], + capture_output=True, text=True, check=True).stdout + untracked = subprocess.run( + ["git", "ls-files", "--others", "--exclude-standard", "-z"], + capture_output=True, text=True, check=True).stdout + except (OSError, subprocess.CalledProcessError): + return None + return {p for p in (tracked + untracked).split("\0") if p} + + +@dataclass(frozen=True) +class AttemptStart: + """The working tree as an attempt found it (#3612, #3614): the commit it + started from and the state of every path that already differed from it.""" + head: str + states: dict -def snapshot_dirty_tree(head_before: str) -> "dict[str, str | None]": - """Content digest of every path that already differs from *head_before* - when an attempt starts (#3612). +def snapshot_dirty_tree(head_before: str) -> "AttemptStart | None": + """Record the tree before an attempt is dispatched. A refused attempt can keep its tree (`retain_on_guard_refusal`), so the next attempt starts with the earlier attempt's edits on disk and the diff - its guards judge still names them. Taken before dispatch, this lets - `attempt_own_paths` tell those kept edits from what the attempt itself - changed. + its guards judge still names them. `attempt_own_paths` compares this + record with the tree at the refusal to name what the attempt itself + changed. None when git cannot list the tree. """ - return {p: _path_digest(p) - for p in git_diff_names(head_before, "HEAD", worktree=True)} + paths = _paths_differing_from(head_before) + if paths is None: + return None + return AttemptStart(head_before, {p: _path_state(p) for p in paths}) def attempt_own_paths(changed: list, - tree_before: "dict[str, str | None] | None") -> list: - """The paths this attempt changed, given *changed* (the diff the guard - judged) and the attempt-start snapshot (#3612). - - A path in *changed* counts when it was clean at the start of the attempt - or its contents have changed since; an earlier, kept attempt's edit the - attempt did not touch again is left out. A snapshot path that has left - *changed* because the attempt deleted it or reverted it to the committed - content counts too (#3613): it is not in the diff any more, but this - attempt changed it. With no snapshot, *changed* is returned unchanged. - """ - if not tree_before: + tree_before: "AttemptStart | None") -> list: + """The paths this attempt changed. + + Every path that differs from the attempt's starting commit now, or did + when the attempt started, is compared by state (`_path_state`) across the + attempt; a path clean at the start and dirty now changed in it. That + covers a kept earlier edit left alone (not listed, #3612), a kept file + deleted or reverted (listed, #3613), both names of a rename, a mode-only + change and non-ASCII names (#3614). *changed*, the diff the guard + judged, is used as is only when there is no snapshot or git cannot list + the tree now. + """ + if tree_before is None: + return list(changed) + now = _paths_differing_from(tree_before.head) + if now is None: return list(changed) - in_diff = set(changed) - own = [p for p in changed - if p not in tree_before or _path_digest(p) != tree_before[p]] - own += [p for p, digest in tree_before.items() - if p not in in_diff and _path_digest(p) != digest] - return own + before = tree_before.states + return [p for p in sorted(now | set(before)) + if p not in before or _path_state(p) != before[p]] def ignored_paths() -> set[str]: @@ -5280,7 +5317,7 @@ def persist_attempt_notes( def format_changed_paths(wu: "WorkUnit", changed: list, - tree_before: "dict | None" = None) -> str: + tree_before: "AttemptStart | None" = None) -> str: """The retry-note listing of what a refused attempt changed (FEAT-LOOP-2026-0251/T03). @@ -5308,7 +5345,7 @@ def format_changed_paths(wu: "WorkUnit", changed: list, def format_deliverable_missing_note( wu: "WorkUnit", summary: str, touched: "list | None", attempt: int, - tree_before: "dict | None" = None, + tree_before: "AttemptStart | None" = None, ) -> str: """Compose the attempt note for a deliverable-presence refusal (#1412). @@ -11807,7 +11844,7 @@ def refuse_deliverable_missing( wu: WorkUnit, attempt: int, usage: dict, summary: str, touched: list[str], *, cfg: dict, head_before: str, events_path: Path, untracked_before, verification_ran: bool, changed: "list[str] | None", - tree_before: "dict | None" = None, + tree_before: "AttemptStart | None" = None, ) -> "tuple[str, dict]": """Settle the tree and build the record of a `deliverable_missing` refusal for either call site. Returns ``(note, event)``. @@ -11843,7 +11880,7 @@ def refuse_no_deliverable_files( wu: WorkUnit, attempt: int, usage: dict, summary: str, touched: list[str], *, cfg: dict, head_before: str, events_path: Path, untracked_before, verification_ran: bool, changed: "list[str] | None", - tree_before: "dict | None" = None, + tree_before: "AttemptStart | None" = None, ) -> "tuple[str, dict]": """Settle the tree and build the record of a `no_deliverable_files` refusal for either call site. Returns ``(note, event)``.""" @@ -11872,7 +11909,7 @@ def refuse_produces_not_in_diff( wu: WorkUnit, attempt: int, usage: dict, remaining: list[str], touched: list[str], *, cfg: dict, head_before: str, events_path: Path, untracked_before, verification_ran: bool, - tree_before: "dict | None" = None, + tree_before: "AttemptStart | None" = None, ) -> "tuple[str, str, dict]": """Settle the tree and build the record of a `produces_not_in_diff` refusal for either call site. Returns ``(summary, note, event)``.""" diff --git a/tests/test_fail_fast_deliverables.py b/tests/test_fail_fast_deliverables.py index 8925293d..d851fc32 100644 --- a/tests/test_fail_fast_deliverables.py +++ b/tests/test_fail_fast_deliverables.py @@ -564,6 +564,74 @@ def swap(): self.assertIn("- `docs/notes.md`", listed) self.assertIn("- `docs/second.md`", listed) + # #3614: the list compares each path's state (content and mode) at the + # start and end of the attempt, reading git's names unquoted, so renames, + # mode-only changes and non-ASCII names are listed too. + CAFE = "docs/caf\u00e9.md" + + def _listed(self, second_act, **kwargs) -> dict: + """The path list for attempt 2, per fail-fast setting.""" + return {ff: self._path_list(self._second_attempt_note( + second_act, fail_fast=ff, **kwargs)) + for ff in (True, False)} + + def test_rename_lists_both_names(self): + def rename(): + os.rename("docs/old.md", "docs/new.md") + + for ff, listed in self._listed( + rename, tracked={"docs/old.md": "old\n"}).items(): + with self.subTest(fail_fast=ff): + self.assertIn("- `docs/old.md`", listed) + self.assertIn("- `docs/new.md`", listed) + + def test_writing_back_a_renamed_file_lists_it(self): + def rename(): + os.rename("docs/old.md", "docs/new.md") + + def write_back(): + Path("docs/old.md").write_text("old\n") + + for ff, listed in self._listed( + write_back, first_act=rename, + tracked={"docs/old.md": "old\n"}).items(): + with self.subTest(fail_fast=ff): + self.assertIn("- `docs/old.md`", listed) + self.assertNotIn("docs/new.md", listed) + + def test_mode_only_change_lists_it(self): + def make_executable(): + os.chmod("docs/notes.md", 0o755) + + for ff, listed in self._listed(make_executable).items(): + with self.subTest(fail_fast=ff): + self.assertIn("- `docs/notes.md`", listed) + + def _edit_cafe(self, text): + return lambda: Path(self.CAFE).write_text(text) + + def test_non_ascii_name_edited_again_is_listed(self): + for ff, listed in self._listed( + self._edit_cafe("second\n"), first_act=self._edit_cafe("first\n"), + tracked={self.CAFE: "original\n"}).items(): + with self.subTest(fail_fast=ff): + self.assertIn(f"- `{self.CAFE}`", listed) + + def test_non_ascii_name_restored_is_listed(self): + for ff, listed in self._listed( + self._edit_cafe("original\n"), + first_act=self._edit_cafe("first\n"), + tracked={self.CAFE: "original\n"}).items(): + with self.subTest(fail_fast=ff): + self.assertIn(f"- `{self.CAFE}`", listed) + + def test_non_ascii_name_left_alone_is_not_listed(self): + for ff, listed in self._listed( + lambda: None, first_act=self._edit_cafe("first\n"), + tracked={self.CAFE: "original\n"}).items(): + with self.subTest(fail_fast=ff): + self.assertIn("this attempt changed no files", listed) + def test_list_is_capped_at_twenty(self): def thirty(): Path("docs").mkdir(exist_ok=True) From b63fdbcde004e234fb2f1ede908a9561612163a9 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 12:35:20 -0500 Subject: [PATCH 54/69] =?UTF-8?q?chore(loop):=20FEAT-LOOP-2026-0251=20?= =?UTF-8?q?=E2=80=94=20re-arm=20the=20close=20after=20the=20#3614=20fix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- .../GATE-01.md | 2 +- .../WU-90-gate-1-close.md | 21 ++++++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md index 04b596db..58fa9d5b 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md @@ -1,6 +1,6 @@ --- gate: 1 -status: awaiting_review +status: open feature_oracle: "python3 -m unittest tests.test_fail_fast_deliverables -v -b" cost_budget_usd: 14.00 broad_run: diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md index 24c25f90..2baa05c9 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md @@ -1,8 +1,8 @@ --- id: FEAT-LOOP-2026-0251/G1-CLOSE type: close -status: done -attempts: 1 +status: pending +attempts: 0 oracle_env: macos_local planned_cost_usd: 5.00 auto_close_disabled: true @@ -16,7 +16,7 @@ judge_edit_acknowledged: - specfuse/loop/lint_plan.py - specfuse/loop/loop.py reason: "Review fixes tested, full suite green, accept the generator risk" -re_arm_count: 5 +re_arm_count: 6 re_arm_history: - timestamp: 2026-11-26T13:30:05+00:00 @@ -53,6 +53,13 @@ re_arm_history: prior_cost_usd: 1.435437 prior_duration_seconds: 478.949 reason: "Fixed the deleted-file edge case, re-close it" + - + timestamp: 2026-11-26T17:35:20+00:00 + prior_status: done + prior_attempts: 1 + prior_cost_usd: 1.347591 + prior_duration_seconds: 616.642 + reason: "Fixed renames, modes and non-ASCII names, re-close it" cumulative_cost_usd: 6.350473 cumulative_duration_seconds: 1409.375 cumulative_input_tokens: 236 @@ -125,3 +132,11 @@ the attempt deleted or reverted was missing from its retry note. Fixed on the br (`attempt_own_paths` in `loop.py`; tests in `TestTreeAndNote`; see `PLAN.md` Notes). Update the closing files in place as before, and say in `FOLLOW-UPS.md` whether #3613's re-run condition now holds. + +**Fifth re-close note (2026-11-26).** The fifth close recorded `not_met` on #3614: the retry +note's path list missed renames, mode-only changes and non-ASCII names. Fixed on the branch by +comparing each path's state at the start and end of the attempt (`snapshot_dirty_tree`, +`attempt_own_paths` in `loop.py`; tests in `TestTreeAndNote`; see `PLAN.md` Notes). The +`git add -N` crash on a new non-ASCII file predates this feature and is outside clause 4. Update +the closing files in place as before, and say in `FOLLOW-UPS.md` whether #3614's re-run +condition now holds. From 10e229c3b88c8659aa8a1f0bd02409c3873c6747 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 12:35:21 -0500 Subject: [PATCH 55/69] chore(loop): FEAT-LOOP-2026-0251 build pin recorded Feature: FEAT-LOOP-2026-0251 --- .../FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl | 1 + 1 file changed, 1 insertion(+) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index ecd9a722..d9a87cb8 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -254,3 +254,4 @@ {"timestamp": "2026-11-26T17:03:17.147926+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_reached", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1}} {"timestamp": "2026-11-26T17:03:17.147918+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "arm_predicate_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "would_arm": true, "predicate_version": "v1", "classes": {"budget_projection": {"status": "clean", "reason": "projected spend $10.37 within 2.0x baseline planned total $11.00 (cap $22.00)"}, "judge_editing": {"status": "clean", "reason": "no drafted WU touches judge-path surfaces"}, "decision_class_paths": {"status": "clean", "reason": "no drafted WU touches a recognised dependency manifest (pyproject.toml, package.json, pom.xml, build.gradle, build.gradle.kts, Cargo.toml, go.mod, Gemfile, composer.json, requirements*.txt, *.csproj)"}, "retroactive_edits": {"status": "clean", "reason": "no passed-gate baseline WU altered or removed"}, "drift_caps": {"status": "clean", "reason": "added WUs and gates within drift caps"}, "missing_provenance": {"status": "clean", "reason": "no added WUs"}, "open_questions_human_only": {"status": "clean", "reason": "terminal gate: no drafted successor"}, "plan_next_lint": {"status": "clean", "reason": "plan-next lint: no findings"}}}} {"timestamp": "2026-11-26T17:03:19.675099+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "followups_recorded", "source": "driver", "source_version": "0.33.2", "payload": {"filed": 1, "unfiled": 0, "already_tracked": 0, "issue_numbers": ["3614"], "written_back": ["FOLLOW-UPS.md"]}} +{"timestamp": "2026-11-26T17:35:21.790435+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "driver_build_pinned", "source": "driver", "source_version": "0.33.2", "payload": {"tree": "1bdd0e12c81a2f327e7579030a998cd23273552f", "path": "/private/var/folders/zc/rgq11x850d78dx_kf1fd4vx80000gn/T/specfuse-pins/1bdd0e12c81a2f327e7579030a998cd23273552f/specfuse/loop"}} From 1029fa7c3dcce52e93a7420d939b257edfac44cb Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 12:43:13 -0500 Subject: [PATCH 56/69] chore(loop): gate 1 broad run clean Feature: FEAT-LOOP-2026-0251 --- .../GATE-01.md | 4 ++-- .../events.jsonl | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md index 58fa9d5b..98326dd7 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md @@ -4,8 +4,8 @@ status: open feature_oracle: "python3 -m unittest tests.test_fail_fast_deliverables -v -b" cost_budget_usd: 14.00 broad_run: - tree: 07bbf72d1e7af3c1a03af605f40e5563dc3a18db:0ec7c6da6e74f0b56753f09657b654a6d289b91b:12064a6191eeb830a9826d911a8543fbaba3da75:1335b4a33bdabb0f79b5cefbbb3a895f1a6070d9:20d5146c893abcac47015a30987b44b2a3dc7c03:27968248a450a842ccd187b7dce0fb0ded934866:287efde8f90320baffac08f5f3287b9456a65cb9:2e29b2f7e073a0cbe290f01d3b397e1cdd10c81c:42796ea0e0a6c03811b0e4bc9dbd3b5ee62dd2e4:4acc6dfc5e8cece358c167d876515eba4a39a500:56ae45adcc17a1292977c436fd195ef8c61cc9e4:834d9d9c16094a386cd9b5a6f9ced9a3a9b4e7fb:91772e5b1214def7917a34e770c1485cd953efe3:bbd1aea514612d76722a18c7aece7c767cf1a076:c23b62e87f1ae3890c6f9e3d8c7ca7ec9225ed81:caffe2d63ceacde448842a91bc7a12c206a67523:d74b7d113b844e84f0009098f576fd28477f072d:e3b0de29b81a6c8e0abeacb3898519b98014b9ef:fa2f4f88657587b6e3b560977858810846b1d366 - ran_at: 2026-11-26T16:51:24.463202+00:00 + tree: 07bbf72d1e7af3c1a03af605f40e5563dc3a18db:0ec7c6da6e74f0b56753f09657b654a6d289b91b:12064a6191eeb830a9826d911a8543fbaba3da75:27968248a450a842ccd187b7dce0fb0ded934866:287efde8f90320baffac08f5f3287b9456a65cb9:2e29b2f7e073a0cbe290f01d3b397e1cdd10c81c:42796ea0e0a6c03811b0e4bc9dbd3b5ee62dd2e4:4acc6dfc5e8cece358c167d876515eba4a39a500:56ae45adcc17a1292977c436fd195ef8c61cc9e4:6b5c76ebbf025cbc351b8e53befb9eb1cd766d7d:730293495f0527afe574261e3a399a7ee4e1b8dc:834d9d9c16094a386cd9b5a6f9ced9a3a9b4e7fb:bbd1aea514612d76722a18c7aece7c767cf1a076:bf5328ea194a219488f840fd7688ba65e41b9b9e:c23b62e87f1ae3890c6f9e3d8c7ca7ec9225ed81:caffe2d63ceacde448842a91bc7a12c206a67523:d74b7d113b844e84f0009098f576fd28477f072d:e3b0de29b81a6c8e0abeacb3898519b98014b9ef:fa2f4f88657587b6e3b560977858810846b1d366 + ran_at: 2026-11-26T17:43:13.106354+00:00 ok: true failing: [] --- diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index d9a87cb8..f290e266 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -255,3 +255,22 @@ {"timestamp": "2026-11-26T17:03:17.147918+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "arm_predicate_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "would_arm": true, "predicate_version": "v1", "classes": {"budget_projection": {"status": "clean", "reason": "projected spend $10.37 within 2.0x baseline planned total $11.00 (cap $22.00)"}, "judge_editing": {"status": "clean", "reason": "no drafted WU touches judge-path surfaces"}, "decision_class_paths": {"status": "clean", "reason": "no drafted WU touches a recognised dependency manifest (pyproject.toml, package.json, pom.xml, build.gradle, build.gradle.kts, Cargo.toml, go.mod, Gemfile, composer.json, requirements*.txt, *.csproj)"}, "retroactive_edits": {"status": "clean", "reason": "no passed-gate baseline WU altered or removed"}, "drift_caps": {"status": "clean", "reason": "added WUs and gates within drift caps"}, "missing_provenance": {"status": "clean", "reason": "no added WUs"}, "open_questions_human_only": {"status": "clean", "reason": "terminal gate: no drafted successor"}, "plan_next_lint": {"status": "clean", "reason": "plan-next lint: no findings"}}}} {"timestamp": "2026-11-26T17:03:19.675099+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "followups_recorded", "source": "driver", "source_version": "0.33.2", "payload": {"filed": 1, "unfiled": 0, "already_tracked": 0, "issue_numbers": ["3614"], "written_back": ["FOLLOW-UPS.md"]}} {"timestamp": "2026-11-26T17:35:21.790435+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "driver_build_pinned", "source": "driver", "source_version": "0.33.2", "payload": {"tree": "1bdd0e12c81a2f327e7579030a998cd23273552f", "path": "/private/var/folders/zc/rgq11x850d78dx_kf1fd4vx80000gn/T/specfuse-pins/1bdd0e12c81a2f327e7579030a998cd23273552f/specfuse/loop"}} +{"timestamp": "2026-11-26T17:43:13.113258+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "broad_run_result", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "tree": "07bbf72d1e7af3c1a03af605f40e5563dc3a18db:0ec7c6da6e74f0b56753f09657b654a6d289b91b:12064a6191eeb830a9826d911a8543fbaba3da75:27968248a450a842ccd187b7dce0fb0ded934866:287efde8f90320baffac08f5f3287b9456a65cb9:2e29b2f7e073a0cbe290f01d3b397e1cdd10c81c:42796ea0e0a6c03811b0e4bc9dbd3b5ee62dd2e4:4acc6dfc5e8cece358c167d876515eba4a39a500:56ae45adcc17a1292977c436fd195ef8c61cc9e4:6b5c76ebbf025cbc351b8e53befb9eb1cd766d7d:730293495f0527afe574261e3a399a7ee4e1b8dc:834d9d9c16094a386cd9b5a6f9ced9a3a9b4e7fb:bbd1aea514612d76722a18c7aece7c767cf1a076:bf5328ea194a219488f840fd7688ba65e41b9b9e:c23b62e87f1ae3890c6f9e3d8c7ca7ec9225ed81:caffe2d63ceacde448842a91bc7a12c206a67523:d74b7d113b844e84f0009098f576fd28477f072d:e3b0de29b81a6c8e0abeacb3898519b98014b9ef:fa2f4f88657587b6e3b560977858810846b1d366", "ok": true, "failing": []}} +{"timestamp": "2026-11-26T17:43:13.113286+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "tests", "ok": true, "skipped": false, "duration_seconds": 428.264, "phase": "broad"}} +{"timestamp": "2026-11-26T17:43:13.113292+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "lint", "ok": true, "skipped": false, "duration_seconds": 0.063, "phase": "broad"}} +{"timestamp": "2026-11-26T17:43:13.113294+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "security", "ok": true, "skipped": false, "duration_seconds": 1.673, "phase": "broad"}} +{"timestamp": "2026-11-26T17:43:13.113301+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "coverage", "ok": true, "skipped": false, "duration_seconds": 1.308, "phase": "broad"}} +{"timestamp": "2026-11-26T17:43:13.113302+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "leak-scan", "ok": true, "skipped": false, "duration_seconds": 18.984, "phase": "broad"}} +{"timestamp": "2026-11-26T17:43:13.113305+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "changelog-fragments", "ok": true, "skipped": false, "duration_seconds": 0.071, "phase": "broad"}} +{"timestamp": "2026-11-26T17:43:13.113309+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "agent-policy-example-lint", "ok": true, "skipped": false, "duration_seconds": 0.123, "phase": "broad"}} +{"timestamp": "2026-11-26T17:43:13.113311+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "event-type-gate", "ok": true, "skipped": false, "duration_seconds": 0.178, "phase": "broad"}} +{"timestamp": "2026-11-26T17:43:13.113317+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "roadmap-link-gate", "ok": true, "skipped": false, "duration_seconds": 0.057, "phase": "broad"}} +{"timestamp": "2026-11-26T17:43:13.113319+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "arm-sweep-gate", "ok": true, "skipped": false, "duration_seconds": 0.415, "phase": "broad"}} +{"timestamp": "2026-11-26T17:43:13.113321+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "monitoring-example-lint", "ok": true, "skipped": false, "duration_seconds": 0.05, "phase": "broad"}} +{"timestamp": "2026-11-26T17:43:13.113322+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "leak-scan-hook", "ok": true, "skipped": false, "duration_seconds": 0.989, "phase": "broad"}} +{"timestamp": "2026-11-26T17:43:13.113324+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "pre-push-hook", "ok": true, "skipped": false, "duration_seconds": 3.889, "phase": "broad"}} +{"timestamp": "2026-11-26T17:43:13.113325+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "sync-scaffold-bats", "ok": true, "skipped": false, "duration_seconds": 11.598, "phase": "broad"}} +{"timestamp": "2026-11-26T17:43:13.113327+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "sync-scaffold-symlinks-bats", "ok": true, "skipped": false, "duration_seconds": 1.69, "phase": "broad"}} +{"timestamp": "2026-11-26T17:43:13.113328+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "init-sh-shim-bats", "ok": true, "skipped": false, "duration_seconds": 1.058, "phase": "broad"}} +{"timestamp": "2026-11-26T17:43:13.113329+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "init-skills-bats", "ok": true, "skipped": false, "duration_seconds": 0.133, "phase": "broad"}} +{"timestamp": "2026-11-26T17:43:13.113333+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "hookspath-conflict-bats", "ok": true, "skipped": false, "duration_seconds": 0.594, "phase": "broad"}} From 0f559c7a73c2c5b092c0a5da3c9c6999a8beb78a Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 12:55:40 -0500 Subject: [PATCH 57/69] =?UTF-8?q?feat:=20G1-CLOSE=20=E2=80=94=20terminal?= =?UTF-8?q?=20close?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Feature: FEAT-LOOP-2026-0251/G1-CLOSE --- .../FOLLOW-UPS.md | 83 ++---- .../LEARNINGS-pending.md | 4 +- .../PROGRESS.md | 2 + .../RETROSPECTIVE.md | 263 +++++++++++------- .../WU-90-gate-1-close.md | 28 +- .../events.jsonl | 2 + ...he-retry-note-for-the-three-deliverable.md | 2 +- 7 files changed, 195 insertions(+), 189 deletions(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md index 1513692d..2cab0aed 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md @@ -1,68 +1,20 @@ # Follow-ups — FEAT-LOOP-2026-0251 -Fifth close, 2026-11-26. One entry is open, below. The re-run conditions of #3608, #3609, -#3610, #3612 and #3613 hold. +Sixth close, 2026-11-26. No entry is open. The re-run conditions of #3608, #3609, #3610, +#3612, #3613 and #3614 hold. -### T03#1 — the retry note's path list still misses renames, non-ASCII names and mode changes - -**Tracked as #3614.** - -**Criterion** (`GATE-01.md`, clause 4): "**Tree and note.** An early refusal keeps or resets -the tree per `defaults.retain_on_guard_refusal`, as the late refusal does; its retry note -states that verification did not run and lists the paths this attempt changed (or says it -changed none)." - -**In plain words.** After a refused attempt, the next session is told which files the last -one changed. For some kinds of change that list is incomplete, and sometimes it says -nothing changed when something did. Which attempts are refused is not affected. - -**Evidence.** A probe drove `loop.run()` through the oracle's `_second_attempt_note` helper -(kept tree, stubbed dispatch and `verify`), with fail-fast on and off (same results), and -read the path list in the note for attempt 2: - -- R9: attempt 2 renames a tracked file: only the new name is listed. A first attempt with a - reset tree does the same. -- R10: attempt 1 renames a tracked file, attempt 2 writes the old name back: "(none — this - attempt changed no files)". -- R11: attempt 2 only makes a kept new file executable: the same "(none)" line. -- R13: attempts 1 and 2 both edit tracked `docs/café.md`: "(none)". -- R15: attempt 2 restores that file: "(none)". - -`python3 -m unittest tests.test_fail_fast_deliverables -b` exits 0 (36 tests); no test -covers these cases. With `attempt_own_paths` returning its input unchanged, R10, R11 and -R13 list a path, so the filter added for #3612 drops them. Causes: git's rename detection -reports only the new name; git returns non-ASCII names quoted, so `_path_digest` returns -`None` both times; the digest covers content only. The same quoted names make -`git add -N` crash the driver on a new non-ASCII file in a kept tree (probe R4; the fourth -close saw the pre-feature driver do the same). - -**Why the loop did not fix it.** This close may not edit source files. - -**Options.** - -1. Fix the way the list is built. Record each path's state (content and mode) at the start - and end of the attempt, with names read by `git diff --no-renames --name-only -z` and - `git ls-files -z`, and list every path in either set whose state differs. - For: covers all five cases at once, and the same `-z` reading can fix the crash. - Against: more code on a judge surface, and another re-close (the four recorded closes - cost 6.35 USD). -2. Amend clause 4 to say the list is best-effort and name these limits, and change the - "this attempt changed no files" line so that it does not claim certainty. - For: small; the list only informs the next session. Against: the definition of done is - narrowed a third time on this gate, the wording change is still a source edit, and the - crash stays. - -**Recommendation:** option 1. The last two fixes each covered only the cases named so far; -comparing start and end states removes the dependence on the filtered diff. - -**Re-run condition.** Either of these: +## Resolved -- the note lists the right paths in R9 (both names), R10, R11, R13 and R15, each shown by a - test with fail-fast on and off, and R7 and R14 still say nothing changed; -- or the operator amends clause 4 as in option 2 and the "changed no files" wording is - changed to match. +#### The retry note's path list missed renames, non-ASCII names and mode changes -## Resolved +**Tracked as #3614.** **Re-run condition holds** (first branch). In this close's probe the +note lists the right paths in R9 (both rename names), R10, R11, R13 and R15, and R7 and R14 +say nothing changed, with fail-fast on and off. Tests cover each of R9, R10, R11, R13, R15 +and R14 with both settings (`test_rename_lists_both_names`, +`test_writing_back_a_renamed_file_lists_it`, `test_mode_only_change_lists_it`, the three +`test_non_ascii_name_*` tests). R7 (a deleted tracked file, then nothing) rests on the probe. +Remaining limits that no entry named (git-ignored files, files named like driver +bookkeeping, non-UTF-8 names, and the older `git add -N` crash) are in `RETROSPECTIVE.md`. #### A kept file that an attempt deletes or reverts is missing from its retry note @@ -72,8 +24,7 @@ off (`test_deleting_a_kept_file_lists_it`, `test_reverting_a_kept_tracked_edit_lists_it`, `test_deleting_a_kept_file_and_writing_another_lists_both`; probe cases R1, R2, R5). With the removed-path branch disabled in a scratch copy, `TestTreeAndNote` gives 6 failures. The -condition covers deletes and reverts of ordinary names; other kinds of change are the open -entry above. +condition covers deletes and reverts of ordinary names; other kinds of change were #3614, above. #### A later attempt's note listed the earlier attempt's kept edits as its own @@ -111,7 +62,7 @@ this session; the probe's case A agrees. The ten changed modules pass (68 tests, exit 0), and the two edits are named in `RETROSPECTIVE.md`. -This fifth close reran the oracle (which holds the #3608 and #3612 tests), the ten modules -behind #3609 (68 tests, `OK`) and the removed-filter control. For #3610 the condition is the -wording in `GATE-01.md`, the close unit and `docs/methodology.md`, which is present; probe -cases D to G were not run again. +This sixth close reran the oracle (which holds the #3608, #3612, #3613 and #3614 tests), the +ten modules behind #3609 (68 tests, `OK`) and the unfiltered-list control. For #3610 the +condition is wording in `GATE-01.md`, the close unit and `docs/methodology.md`; the fifth +close found it present, and probe cases D to G were not run again. diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/LEARNINGS-pending.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/LEARNINGS-pending.md index 793f219c..b66ed079 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/LEARNINGS-pending.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/LEARNINGS-pending.md @@ -32,4 +32,6 @@ Licensed under the Apache License, Version 2.0. See LICENSE. to a non-ASCII name (git quotes it, so the file cannot be opened) and mode changes. Compare attempt-start and attempt-end states over the union of their paths, read with `--no-renames -z`. Test write, edit, delete, revert, rename and a non-ASCII name on a - second attempt, and probe the whole matrix before the first fix, not one case per close. + second attempt, and probe the whole matrix before the first fix, not one case per close + (the state comparison closed the whole matrix at once; three filter fixes had not). When + switching git reads to `-z`, decide how a non-UTF-8 name decodes: quoting had hidden that. diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md index 3a6d4bea..2b7dc907 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md @@ -14,3 +14,5 @@ - note: Fix by also listing attempt-start snapshot paths that left the diff and whose digest changed, with delete and revert tests; separately, a non-ASCII changed filename on a kept tree crashes git add -N, which also happens on the pre-feature loop.py. - **FEAT-LOOP-2026-0251/G1-CLOSE**: Updated the gate 1 close files in place for the fifth close, with advisory verdict not_met because the retry note's path list still misses a renamed file's old name, later changes to kept non-ASCII-named files, a restore after an earlier rename, and mode-only changes (clause 4). - note: Build the retry note's list by comparing attempt-start and attempt-end path states (content and mode, read with --no-renames -z), and reuse the -z reading for the git add -N crash on non-ASCII names. +- **FEAT-LOOP-2026-0251/G1-CLOSE**: Sixth close of gate 1 confirms the + - note: Weigh probe case N2 (a file named events.jsonl outside the feature folder is left out of the retry note); the non-UTF-8 decode in _paths_differing_from and the older git add -N crash have no filed issue. diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/RETROSPECTIVE.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/RETROSPECTIVE.md index 5e1c4777..f3f762ff 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/RETROSPECTIVE.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/RETROSPECTIVE.md @@ -4,73 +4,103 @@ ## Verdict -`not_met` (advisory; the judge concludes). The #3613 cases are fixed: a kept file that the -attempt deletes or reverts is now listed. Definition-of-done clause 4 still does not hold. -The path list leaves out the old name of a renamed tracked file, and it says "this attempt -changed no files" after some later attempts that did change a file: a second edit or a -revert of a kept tracked file with a non-ASCII name, a restore of the old name of a file -an earlier attempt renamed, and a mode-only change (probe cases R9, R10, R11, R13, R15 -below). This is the fifth close of the gate. Follow-up: `FOLLOW-UPS.md`. +`met` (advisory; the judge concludes). This is the sixth close of the gate. The #3614 cases +are fixed: both names of a rename, a restored old name, a mode-only change and later changes +to a non-ASCII name are listed, with fail-fast on and off. The oracle passes (42 tests, no +skips). This session did not rerun the early-against-late probe; the fourth and fifth closes' +runs of it showed no difference beyond the stated precedence. + +One judgement call sits under clause 4. The list leaves out any file *named* `events.jsonl`, +`PROGRESS.md` or like the unit file, in any directory, and files git ignores (probe cases N2 +and S10). I read both as outside "the paths this attempt changed": the guards use the same +by-name bookkeeping rule, and the diff they judge never holds ignored files. Under a literal +reading, a note that says "changed no files" in case N2 is wrong. ## Measurements -All commands ran fresh in this fifth close on the working tree, unless a line says +All commands ran fresh in this sixth close on the working tree, unless a line says otherwise. Test runs and probes used `HOME` under `$TMPDIR` with a stub git identity, because with the real `HOME` the sandbox blocks the driver's preflight write (observed in the fourth close). git version 2.53.0. ### feature_oracle: PASS -`python3 -m unittest tests.test_fail_fast_deliverables -v -b`: exit 0, `Ran 36 tests`, `OK`, +`python3 -m unittest tests.test_fail_fast_deliverables -v -b`: exit 0, `Ran 42 tests`, `OK`, no skips. `grep -c "unittest.skip" tests/test_fail_fast_deliverables.py` prints `0`. A search of that file for `unittest.skip`, `skipIf`, `skipUnless`, `skipTest` and `@skip` finds nothing. -The oracle passes and does not cover the clause 4 gaps below. +It does not cover the limits in cases N2 and S10 below. -### Retry note on a kept tree (#3613 and beyond it) +### Retry note on a kept tree (#3614 and beyond it) A throwaway probe drove `loop.run()` through the oracle's own helper (`_second_attempt_note`, kept tree, stubbed agent session and `verify`) and read the path -list in the note recorded for attempt 2. Each case gave the same result with fail-fast on -and off. The last column repeats the case with `attempt_own_paths` replaced by a function -that returns its input, which is the listing without the #3612 and #3613 logic. A dash -means the case was not repeated that way. - -| Case | Attempt 1 | Attempt 2 | Attempt 2's note lists | Correct | Without the filter | -|---|---|---|---|---|---| -| R0 | writes a new file | writes another | the second file | yes | — | -| R1 | writes a new file | deletes it | that file | yes | — | -| R2 | edits a tracked file | restores it | that file | yes | — | -| R3 | edits a tracked file | edits it again | that file | yes | — | -| R5 | writes a new file | deletes it, writes another | both | yes | — | -| R6 | deletes a tracked file | restores it | that file | yes | — | -| R7 | deletes a tracked file | nothing | "changed no files" | yes | — | -| R8 | writes a new file | renames it | both names | yes | — | -| R12 | writes a file with a space in its name | edits it | that file | yes | — | -| R9 | writes `docs/x.md` | renames tracked `docs/tracked.md` to `docs/moved.md` | `docs/moved.md` only | **no** | `moved.md`, `x.md`; old name still missing | -| R10 | renames tracked `docs/tracked.md` | writes the old name back, same content | "changed no files" | **no** | `docs/moved.md` | -| R11 | writes a new file | makes it executable | "changed no files" | **no** | that file | -| R13 | edits tracked `docs/café.md` | edits it again | "changed no files" | **no** | the file, in git's quoted form | -| R14 | edits tracked `docs/café.md` | nothing | "changed no files" | yes | lists it (the #3612 defect) | -| R15 | edits tracked `docs/café.md` | restores it | "changed no files" | **no** | "changed no files" | - -A separate probe renamed a tracked file on a first attempt with a reset tree. The note -listed only the new name, with fail-fast on and off. So the missing old name does not need -a kept tree. - -Causes, from the code together with the table: - -- `git_diff_names` and `pending_squash_names` call `git diff --name-only` with git's - default rename detection, which reports a rename under the new name only. The old name - is then in neither the guard's diff nor the attempt-start snapshot (R9, R10). -- Both return git's quoted form for a non-ASCII name. `_path_digest` cannot open that - string, so it returns `None` before and after, and the path never counts as changed - (R13, R15). R13 is caused by the filter added for #3612. -- `_path_digest` hashes file content only (R11). - -R4 (a new file with a non-ASCII name, kept tree): `loop.run()` raised -`CalledProcessError` from `git add -N` on the quoted path. The fourth close saw the -pre-feature `loop.py` raise the same error from the same function; that comparison was not -repeated. +list in the note recorded for attempt 2. Every row below gave the same list with fail-fast on +and off. + +| Case | Attempt 1 | Attempt 2 | Attempt 2's note lists | Matches what attempt 2 changed | +|---|---|---|---|---| +| R0 | writes a new file | writes another | the second file | yes | +| R1 | writes a new file | deletes it | that file | yes | +| R2 | edits a tracked file | restores it | that file | yes | +| R3 | edits a tracked file | edits it again | that file | yes | +| R5 | writes a new file | deletes it, writes another | both | yes | +| R6 | deletes a tracked file | restores it | that file | yes | +| R7 | deletes a tracked file | nothing | "changed no files" | yes | +| R8 | writes a new file | renames it | both names | yes | +| R9 | writes `docs/x.md` | renames tracked `docs/tracked.md` to `docs/moved.md` | both rename names, not `x.md` | yes | +| R10 | renames a tracked file | writes the old name back | the old name | yes | +| R11 | writes a new file | makes it executable | that file | yes | +| R12 | writes a name with a space | edits it | that file | yes | +| R13 | edits tracked `docs/café.md` | edits it again | the file, unquoted | yes | +| R14 | edits tracked `docs/café.md` | nothing | "changed no files" | yes | +| R15 | edits tracked `docs/café.md` | restores it | the file | yes | +| S1 | writes a new file | `chmod` on a tracked file | the tracked file | yes | +| S2 | edits a tracked name holding `"` | edits it again | that file | yes | +| S3 | creates a symlink | retargets it | the link | yes | +| S4 | writes a file, sets `diff.renames=copies` | renames a tracked file | both names | yes | +| S5 | writes a new file | replaces it with a symlink | that file | yes | +| S6 | writes a new file | only `git add`s it | "changed no files" | yes (no content or mode change) | +| S7 | writes a new file | nothing | "changed no files" | yes | +| S8 | edits a tracked name holding a newline | edits it again | the file, split over two lines | yes, badly formatted | +| S9 | renames a tracked file | nothing | "changed no files" | yes | +| S10 | writes a new file | writes a git-ignored file | "changed no files" | **ignored file not listed** | +| N2 | writes a new file | writes `docs/events.jsonl` | "changed no files" | **file not listed** | + +N2 follows from `format_changed_paths`, which drops by base name (`events.jsonl`, +`PROGRESS.md`, the unit file's name). `assert_implementation_touched_files` filters the same +way, and `git_diff_names` drops `PROGRESS.md` by base name. Only the `events.jsonl` name was +run; the other two names are read from the code. + +First attempt, reset tree, fail-fast on and off: a new `docs/ñ.md` is listed unquoted, and a +rename of the tracked deliverable `src/rule.py` lists both names (in the presence-refusal +note, under "Files this attempt touched"). + +With the opt-out, a stub gate that writes `gate-out.txt` during a late refusal gets that file +listed although the agent wrote nothing. This is the late order, not the early refusal that +clause 4 describes. + +Two probes crashed the driver: + +- R4, a new non-ASCII file in a kept tree: `CalledProcessError` from `git add -N` on the + quoted path, with fail-fast on and off. The close unit records this as older than the + feature. +- A nested repository with no commit: `CalledProcessError` from `git add -A`. This shows + nothing about the note. + +### Non-UTF-8 file names + +`_paths_differing_from` reads `git ... -z` output as strict UTF-8. In a temporary repository +with one tracked name holding byte `0xff` (made through the index, since macOS refuses such a +name on disk), `snapshot_dirty_tree` raised `UnicodeDecodeError`, while `git_diff_names` over +the same tree returned the quoted name. + +Through `loop.run()`, a simulated attempt that deletes that tracked file and writes nothing +else raised `UnicodeDecodeError` from `attempt_own_paths`. The pre-feature `loop.py` +(`bd7e508` pin) raised `UnicodeDecodeError` on the same input too, from +`retain_tree_after_refusal` with a kept tree and `reset_preserving_events` with a reset one. +So this input stops both builds. A case that stops only the new build was **not** shown +through `loop.run()`: a file already dirty at the start is refused by the branch guard (both +builds) when tracked, and an untracked one cannot be created on macOS. ### Other oracles @@ -86,37 +116,45 @@ repeated. | `python3 -m specfuse.loop.changelog_fragments check` | exit 0 | This session did not run the full suite or coverage. The driver's broad run recorded at -2026-11-26T16:51:24Z has `ok: true` and no failing gate. Its tests log -(`work/gate-logs/`, stamp `20261126T165040`) shows `Ran 5150 tests`, `OK (skipped=4)`; its +2026-11-26T17:43:13Z has `ok: true` and no failing gate. Its tests log +(`work/gate-logs/`, stamp `20261126T174230`) shows `Ran 5156 tests`, `OK (skipped=4)`; its coverage log shows 92% total. ### Controls: the oracle observes the feature Each mutation ran in a scratch copy of the package, tests and `.specfuse/` (without the -feature folders). The unmodified copy ran the 36 oracle tests: `OK`. +feature folders). The unmodified copy ran the 42 oracle tests: `OK`. `TestTreeAndNote` has 18 +tests; failure counts include subtests. | Mutation | Result | |---|---| -| `resolve_fail_fast_deliverables` forced to return `False` | 13 failures, no errors: `TestOptOut` 4, `TestPresenceEarly` 3, `TestProducesNotInDiffEarly` 3, `TestTreeAndNote` 2, `TestEarlyRefusalRecovery` 1 | -| `attempt_own_paths` returns its input unfiltered (#3612 undone) | `TestTreeAndNote`, 12 tests: 10 failures (subtests counted) | -| only the removed-path branch disabled (#3613 undone) | `TestTreeAndNote`, 12 tests: 6 failures (subtests counted) | +| `resolve_fail_fast_deliverables` forced to return `False` | 42 tests: 13 failures | +| `attempt_own_paths` returns its input unfiltered | `TestTreeAndNote`: 20 failures | +| rename pairing turned back on (`--find-renames`) | `TestTreeAndNote`: 3 failures | +| mode bits left out of `_path_state` | `TestTreeAndNote`: 2 failures | +| non-ASCII names mangled, as quoting would | `TestTreeAndNote`: 4 failures | +| attempt-start paths left out of the compared set | `TestTreeAndNote`: 10 failures | | `check_produces_mentioned` made a no-op | `TestArmTimeWarning`, 6 tests: 2 failures (the other four expect silence) | -| `loop.py` replaced by the pre-feature one (`bd7e508`, no `fail_fast_deliverables`) | 36 tests: 12 failures, 24 errors (subtests counted) | +| `loop.py` replaced by the pre-feature one (`bd7e508` pin) | 42 tests: 12 failures, 30 errors | -On the old driver, `TestProducesNotInDiffEarly` (6) and `TestPresenceEarly` (3) give only -errors, from a missing interface; the first mutation is the behaviour evidence for those two -classes. `TestOptOut` (3 failures, 1 error) and `TestTreeAndNote` (7 failures, 11 errors) -also fail on assertions. This is not a full pre-feature tree. +On the old driver, every failing `TestProducesNotInDiffEarly` and `TestPresenceEarly` entry is +an error, so the first mutation is the behaviour evidence for those two classes. `TestOptOut` +and `TestTreeAndNote` also fail on assertions. This is not a full pre-feature tree. ### Early against late, same input -A throwaway probe drove `loop.run()` over the oracle's fixture and read the first -`attempt_outcome` for T01, once with fail-fast on and once off. Verification is a stub. The -unit declares `src/rule.py`. "Untouched" means the attempt writes only `docs/notes.md`. Each -cell is outcome / failure class. Where one name is shown, both are equal. Every early -deliverable refusal recorded `verify_seconds: 0` and `tree_retained: true`. +These tables are earlier closes' observations. **This sixth close did not run the probe +again.** The source change named since is the path-list code, whose only caller is +`format_changed_paths` (checked by `grep`). This session reran the oracle, which holds the +`files_changed_mismatch` pair (case A) and the single-refusal pairs in `TestOptOut`. + +The probe drove `loop.run()` over the oracle's fixture and read the first `attempt_outcome` +for T01, once with fail-fast on and once off. Verification is a stub. The unit declares +`src/rule.py`. "Untouched" means the attempt writes only `docs/notes.md`. Each cell is +outcome / failure class. Where one name is shown, both are equal. Every early deliverable +refusal recorded `verify_seconds: 0` and `tree_retained: true`. -Run again in this close: +As run in the fifth close: | Case | fail-fast on | fail-fast off | Differs because | |---|---|---|---| @@ -129,8 +167,7 @@ Run again in this close: | M: only `src/rule.py` deleted (two apply) | `deliverable_missing` / `guard_refusal` | same | same | | O: RESULT `status: blocked`, untouched | `blocked`, no failure class | same | same | -Not run again, and carried only as the fourth close's observations. The only source change -named since then is in `attempt_own_paths`, which builds note text. +As run in the fourth close: | Case | fail-fast on | fail-fast off | |---|---|---| @@ -161,7 +198,7 @@ because it is not one of this unit's permitted closing surfaces. | T02#1 | passes | `TestPresenceEarly`; on the old driver errors only, behaviour shown by the first mutation | | T02#2 | passes | `TestOptOut`; assertion failures on the old driver | | T02#3 | passes | empty diff | -| T03#1 | the listed assertions pass; clause 4, which the unit exists to turn green, **fails** | `TestTreeAndNote`; probe cases R9, R10, R11, R13, R15 | +| T03#1 | passes; limits in N2 and S10 | `TestTreeAndNote` (18); assertion failures on the old driver | | T03#2 | passes | `test_list_is_capped_at_twenty` | | T04#1 | passes | `TestArmTimeWarning`; no-op control | | T04#2 | passes with the repository script | 97 folders, 0 non-zero exits | @@ -178,10 +215,10 @@ carried forward: 0 criteria, re-measured: 13 | 1. `produces_not_in_diff` early | Refused with 0 `verify_fn` calls, `verify_seconds` 0, no attempt-phase `gate_result`; a changed path verifies once and passes; a justified path still verifies; class, signature and summary equal the late site's | `TestProducesNotInDiffEarly` (6 tests) | | 2. Presence early | Absent, empty and bookkeeping-only diffs are refused with 0 calls | `TestPresenceEarly` (3) | | 3. Opt-out | With the key `false`, each of the three cases verifies once; outcome, class, signature and summary equal the default's, for inputs that trip one refusal | `TestOptOut` (4), on plain-RESULT, passing-stub inputs; probe cases C, L, M | -| 4. Tree and note | **Not proven.** The note says verification did not run; lists written, edited, deleted (#3613) and reverted (#3613) paths with ordinary names; leaves out untouched kept edits (#3612); caps at 20; the tree is kept or reset. The list still omits the changes in probe cases R9, R10, R11, R13 and R15 | `TestTreeAndNote` (12). The kept/reset assertions use `produces_not_in_diff` only | +| 4. Tree and note | Proven, with the by-name and ignored-file limits (N2, S10). The note says verification did not run; lists written, edited, deleted, reverted, renamed (both names), mode-changed and non-ASCII-named paths; leaves out untouched kept edits; caps at 20; the tree is kept or reset | `TestTreeAndNote` (18); probe cases R0 to R15 and S1 to S9. The kept/reset assertions use `produces_not_in_diff` only | | 5. Arm-time WARN | Warns on an unmentioned path; silent on full path, file name or parent directory, and on `done` / `abandoned`; `lint()` calls it | `TestArmTimeWarning` (6) | | 6. Nothing else changes | Holds as widened for #3609. See the list below | `diff -ru` of `tests/` against the recorded base; the ten modules pass | -| Precedence over every later check | Holds on every probed pair. A test asserts only the `files_changed_mismatch` pair | `test_deliverable_refusal_outranks_files_changed_mismatch`; probe cases A, B and K run again; D to J, P and Q carried from the fourth close | +| Precedence over every later check | Holds on every probed pair. A test asserts only the `files_changed_mismatch` pair | `test_deliverable_refusal_outranks_files_changed_mismatch`; this session, the oracle test only; probe cases carried from the fourth and fifth closes | Three review fixes made before the first close, outside any work unit, are covered by `TestEarlyRefusalRecovery` (3: re-plan still fires; uncommitted tracked edits count as a @@ -189,14 +226,14 @@ moved tree; an untouched tree still halts) and `TestEarlyRetainedNoteWording` (2 ## Pre-existing tests changed -This fifth close ran no git command and did not repeat the tree comparison. It listed the -files under `tests/`, `specfuse/`, `scripts/`, `.specfuse/scripts/` and `docs/` modified -after the fourth close last wrote `LEARNINGS-pending.md`: only `specfuse/loop/loop.py` and -the feature's own `tests/test_fail_fast_deliverables.py` (the #3613 fix and its three -tests). No pre-existing test is newer. The third and fourth closes did the same kind of -check, each against the close before, back to the second close's comparison, below. These -are modification-time checks, not content diffs. The ten modules were rerun in this -session. In the comparison text, "this session" means the second close. +This sixth close ran no git command on the repository and did not repeat the tree comparison. +It listed the files under `tests/`, `specfuse/`, `scripts/`, `.specfuse/scripts/` and `docs/` +modified after the fifth close last wrote `LEARNINGS-pending.md`: only +`specfuse/loop/loop.py` and the feature's own `tests/test_fail_fast_deliverables.py` (the +#3614 fix and its tests). No pre-existing test is newer. The third, fourth and fifth closes +did the same kind of check, each against the close before, back to the second close's +comparison, below. These are modification-time checks, not content diffs. The ten modules +were rerun in this session. In the comparison text, "this session" means the second close. Compared against the public tarball of `a89373d119f8e2d8003a8956dbd4bd27dde8057f`, the merge base recorded on the first close's `judged` event, and against public `main` as @@ -256,11 +293,17 @@ probed removals on a kept tree and found that deleted and reverted files were mi The fourth close (2026-11-26T16:28Z) and the judge recorded `not_met`, and the driver filed #3613. The fix to `attempt_own_paths` and three tests were made on the branch outside any -work unit, and the operator re-armed this unit. This fifth close confirmed that fix and +work unit, and the operator re-armed this unit. The fifth close confirmed that fix and probed renames, non-ASCII names and a mode change. #3612, #3613 and the gaps now open are all in one list, built by filtering a name-only diff; each fix so far covered the cases the previous close had named. +The fifth close (2026-11-26T17:03Z) and the judge recorded `not_met`, and the driver filed +#3614. The fix replaced filtering of the guard's diff with a comparison of each path's state +at the start and end of the attempt, which is the first option that close recommended. It was +made on the branch outside any work unit, and the operator re-armed this unit. This sixth +close confirmed it on the whole earlier matrix and ten further cases. + T04 passed although its Verification section names `tests.test_lint_plan`, which does not exist. @@ -281,16 +324,17 @@ includes its judge: `record_judge_cost_fold` adds the judge's usage to the attem | G1-CLOSE, second close | (same line) | 1.49 | 0.48 | 30% | 1 | | G1-CLOSE, third close | (same line) | 1.73 | 0.57 | 35% | 1 | | G1-CLOSE, fourth close | (same line) | 1.44 | 0.36 | 29% | 1 | -| G1-CLOSE, fifth close | (same line) | not yet recorded | — | — | in progress | -| G1-CLOSE, four recorded closes | 5.00 | 6.35 | 1.84 | 127% | 4 | - -Recorded unit spend is 9.03 USD against a plan of 11.00 and a gate budget of 14.00. The -close line is already past its 5.00 plan, and this session's cost and its judge's are -written later. The earlier `blocked_human` stop of this unit recorded 0.00. The independent -review, its fixes, both amendments and the #3612 and #3613 fixes happened outside the loop, -so `events.jsonl` has no cost for them. All four re-closes cost money for questions the -plan or the oracle had left open: two for an unstated precedence, one for the #3612 defect -and this one for #3613. +| G1-CLOSE, fifth close | (same line) | 1.35 | 0.47 | 27% | 1 | +| G1-CLOSE, sixth close | (same line) | not yet recorded | — | — | in progress | +| G1-CLOSE, five recorded closes | 5.00 | 7.70 | 2.32 | 154% | 5 | + +Recorded unit spend is 10.37 USD against a plan of 11.00 and a gate budget of 14.00. The +close line is well past its 5.00 plan, and this session's cost and its judge's are written +later. The earlier `blocked_human` stop of this unit recorded 0.00. The independent review, +its fixes, both amendments and the #3612, #3613 and #3614 fixes happened outside the loop, +so `events.jsonl` has no cost for them. All five re-closes cost money for questions the plan +or the oracle had left open: two for an unstated precedence, then one each for #3612, #3613 +and #3614. **T04's warning rate.** Re-measured this session over `done` units with `produces:`: the shipped rule (path, file name or parent directory) would fire on 35 of 402, **8.7%**, under @@ -303,8 +347,8 @@ satisfied by almost any body. The WARN is weak for such paths. ## Consumer-visible contract changes Pending human acknowledgment. Each has a `changelog.d/` fragment tracing to -`FEAT-LOOP-2026-0251`. This close added no fragment; it extended the retry-note one in place -with the kept-tree behaviour and its known limits. +`FEAT-LOOP-2026-0251`. This close added no fragment; it corrected the retry-note one in +place, replacing the limits that #3614 fixed. 1. **Changed:** the three deliverable refusals run before verification. They take precedence over every verification gate and later guard. An attempt that also would have failed one @@ -312,22 +356,28 @@ with the kept-tree behaviour and its known limits. old order reset it. 2. **Added:** `defaults.fail_fast_deliverables`, default `true`. 3. **Changed:** the retry note for the three refusals lists the changed paths, at most 20 - plus a count. Untouched edits kept from an earlier attempt are left out; kept files the - attempt deleted or reverted are listed. Known limits: a renamed tracked file appears - under its new name only; later changes to a kept non-ASCII-named file and mode-only - changes to a kept file are not listed. + plus a count. Untouched edits kept from an earlier attempt are left out; deletes, + reverts, both names of a rename, mode-only changes and non-ASCII names are listed. Not + listed: git-ignored files, and files named like the driver's bookkeeping. 4. **Added:** a `specfuse lint` WARN for a `produces:` path the unit's body never mentions. ## Notes for the human reviewer None of these is a failed criterion. This unit may edit none of the files concerned. +- **Non-UTF-8 names in the new reader.** `_paths_differing_from` decodes `-z` output + strictly and catches only `OSError` and `CalledProcessError`. It runs before every + attempt. From the code and the function-level probe, an untracked non-UTF-8 name (possible + on Linux) would raise there, where the old listing got an ASCII quoted form. Whether the + old driver would have finished such a run was not shown. Passing + `errors="surrogateescape"` is a likely fix; printing such a name into the note would need + checking too. Worth fixing with the crash below. + - **Older defect, worth its own bug.** A refused attempt that keeps its tree and has a changed file with a non-ASCII name stops the driver with `CalledProcessError`: `git_diff_names` returns git's quoted form and `git add -N` rejects it (probe R4). The - fourth close saw the pre-feature `loop.py` do the same. `attempt_own_paths` reads the - same names (cases R13, R15), so one fix should cover both. This close filed no issue for - the crash itself; the follow-up entry mentions it. + fourth close saw the pre-feature `loop.py` do the same. R4 reproduced in this close. This + close filed no issue for it, and with no open follow-up entry the driver will file none. - **One sentence in `docs/methodology.md` is too strong.** It says "What is refused does not change, only when." Probe case Q is an attempt that passes with the key `false` and is @@ -352,11 +402,10 @@ None of these is a failed criterion. This unit may edit none of the files concer `attempt_outcome` in `events.jsonl` before this close is `passed`. No real early refusal has happened, so no real saving in gate time is measured. - The probes stubbed the agent session, `verify`, and (for H and P) the squash rejection. -- Early-against-late cases D to J (with the smoke-import line or `close` type), P, Q and N, - and the other observations listed as not run again. -- Other ways to change a file that the note might miss, such as symlinks (the digest follows - the link), submodules, a rename under a non-default `diff.renames` setting, or a name - containing a quote or newline. None was probed. +- Every early-against-late probe case, and the other observations listed as not run again. +- A non-UTF-8 name on a real filesystem, and any run on Linux. +- Submodules and nested repositories (the one nested probe crashed in `git add -A`), changes + to an empty directory, `core.filemode=false`, and special files such as a named pipe. - That cases A to Q are the whole list of overtaken checks. The list comes from reading `execute_unit_attempt()` and the post-squash guards in `run()`. The general rule does not depend on the list being complete; the claim that it holds rests on the early check running diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md index 2baa05c9..22ed049f 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md @@ -1,8 +1,8 @@ --- id: FEAT-LOOP-2026-0251/G1-CLOSE type: close -status: pending -attempts: 0 +status: done +attempts: 1 oracle_env: macos_local planned_cost_usd: 5.00 auto_close_disabled: true @@ -60,20 +60,20 @@ re_arm_history: prior_cost_usd: 1.347591 prior_duration_seconds: 616.642 reason: "Fixed renames, modes and non-ASCII names, re-close it" -cumulative_cost_usd: 6.350473 -cumulative_duration_seconds: 1409.375 -cumulative_input_tokens: 236 -cumulative_output_tokens: 150215 -cumulative_attempts: 4 -cost_usd: 1.347591 -duration_seconds: 616.642 -input_tokens: 44 -output_tokens: 31539 -folded_through_re_arm: 5 +cumulative_cost_usd: 7.698064 +cumulative_duration_seconds: 2026.017 +cumulative_input_tokens: 280 +cumulative_output_tokens: 181754 +cumulative_attempts: 5 +cost_usd: 1.174106 +duration_seconds: 747.309 +input_tokens: 46 +output_tokens: 34183 +folded_through_re_arm: 6 gate_set: plannext driver_version: 0.33.2 -started_at: 2026-11-26T16:51:24.709873+00:00 -verdict: not_met +started_at: 2026-11-26T17:43:13.364717+00:00 +verdict: met --- # G1-CLOSE — terminal close diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index f290e266..d348be9f 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -274,3 +274,5 @@ {"timestamp": "2026-11-26T17:43:13.113328+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "init-sh-shim-bats", "ok": true, "skipped": false, "duration_seconds": 1.058, "phase": "broad"}} {"timestamp": "2026-11-26T17:43:13.113329+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "init-skills-bats", "ok": true, "skipped": false, "duration_seconds": 0.133, "phase": "broad"}} {"timestamp": "2026-11-26T17:43:13.113333+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "hookspath-conflict-bats", "ok": true, "skipped": false, "duration_seconds": 0.594, "phase": "broad"}} +{"timestamp": "2026-11-26T17:43:13.237699+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "terminal_judge_editing_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "status": "clean", "reason": "acknowledged by operator: .specfuse/verification.yml.example, produces_driver_helper, specfuse/loop/data/verification.yml.example, specfuse/loop/lint_plan.py, specfuse/loop/loop.py"}} +{"timestamp": "2026-11-26T17:43:13.242245+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "terminal_judge_editing_acknowledged", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "close_unit": "FEAT-LOOP-2026-0251/G1-CLOSE", "paths": [".specfuse/verification.yml.example", "produces_driver_helper", "specfuse/loop/data/verification.yml.example", "specfuse/loop/lint_plan.py", "specfuse/loop/loop.py"], "reason": "Review fixes tested, full suite green, accept the generator risk"}} diff --git a/changelog.d/FEAT-LOOP-2026-0251-the-retry-note-for-the-three-deliverable.md b/changelog.d/FEAT-LOOP-2026-0251-the-retry-note-for-the-three-deliverable.md index 6294753c..dd2ea151 100644 --- a/changelog.d/FEAT-LOOP-2026-0251-the-retry-note-for-the-three-deliverable.md +++ b/changelog.d/FEAT-LOOP-2026-0251-the-retry-note-for-the-three-deliverable.md @@ -2,4 +2,4 @@ class: changed trace: FEAT-LOOP-2026-0251 --- -The retry note for the three deliverable refusals now lists the paths the attempt changed (at most 20, plus a count of the rest), or says it changed none. Edits kept from an earlier attempt that this attempt did not touch are not listed; kept files that this attempt deleted or reverted are. Known limits: a renamed tracked file is listed under its new name only, and later changes to a kept file with a non-ASCII name, or a mode-only change to a kept file, are not listed, so the note can say it changed none +The retry note for the three deliverable refusals now lists the paths the attempt changed (at most 20, plus a count of the rest), or says it changed none. Edits kept from an earlier attempt that this attempt did not touch are not listed; deletes, reverts, both names of a rename, mode-only changes and non-ASCII names are. Not listed: files git ignores, and files named `events.jsonl`, `PROGRESS.md` or like the unit file, in any directory From e9a1b4bd36c5dc4ffcf680af2148e047d6a3c7b9 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 13:04:52 -0500 Subject: [PATCH 58/69] chore(loop): FEAT-LOOP-2026-0251/G1-CLOSE judge lowered verdict to not_met Feature: FEAT-LOOP-2026-0251/G1-CLOSE --- .../FOLLOW-UPS.md | 29 +++++++++++++++++++ .../WU-90-gate-1-close.md | 2 +- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md index 2cab0aed..400a7b8c 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md @@ -66,3 +66,32 @@ This sixth close reran the oracle (which holds the #3608, #3612, #3613 and #3614 ten modules behind #3609 (68 tests, `OK`) and the unfiltered-list control. For #3610 the condition is wording in `GATE-01.md`, the close unit and `docs/methodology.md`; the fifth close found it present, and probe cases D to G were not run again. + +### Definition of done clause 5 (arm-time warning) + +The clause says lint warns when a `produces:` path appears nowhere in the unit body, by full path or file name. The code also stays silent when the body names only the parent directory. + +I tested a `pending` unit with `produces: specfuse/loop/loop.py`. Its body mentioned only `specfuse/loop/data/docs`, so it had neither the full path nor `loop.py`. No WARN was printed. A body naming none of these did warn. + +`test_parent_directory_mention_is_silent` asserts this silent behaviour. T04's text allowed narrowing the match, but clause 5 was never amended. Clause 6 and the precedence rule were amended explicitly, and no deliverable is recorded as dropped by amendment. + +- command: `PYTHONPATH=. python3 $TMPDIR/p5.py` (calls `lint_plan.check_produces_mentioned` on temporary units; the "dir-only" case printed nothing) +- exit: 0 + +### Definition of done clause 4 (tree and note) + +The clause says the retry note lists the paths this attempt changed, or says it changed none. In a kept tree, I had attempt 2 write only a new `docs/events.jsonl`, and separately only a new `docs/PROGRESS.md`. These are ordinary agent files, not the driver's bookkeeping files. + +In both cases the note said "(none — this attempt changed no files)", which is false. This happened with fail-fast both on and off. The control file `docs/plain.md` was listed correctly. The cause is that `format_changed_paths` drops paths by base name only. + +- command: `PYTHONPATH=. python3 $TMPDIR/p4.py` (uses `TestTreeAndNote._second_attempt_note`) +- exit: 0 + +### T04#3 + +I couldn't verify that T04's RESULT notes gave the measured count and total. I searched the feature's `events.jsonl`, `PROGRESS.md` and `work/` for the figures and found nothing. + +The numbers themselves look right. My own count gave 402 `done` units with `produces:`. 81 would warn when matching only path or file name, and 35 when the parent directory also counts. The code docstring says 81 and 35 of 401. That doesn't show what the RESULT notes said. + +- command: `grep -rnE "81 of 401|35 \(8\.7|20\.2%" /events.jsonl /PROGRESS.md /work` +- exit: 1 diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md index 22ed049f..ed6f2824 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md @@ -73,7 +73,7 @@ folded_through_re_arm: 6 gate_set: plannext driver_version: 0.33.2 started_at: 2026-11-26T17:43:13.364717+00:00 -verdict: met +verdict: not_met --- # G1-CLOSE — terminal close From 01e1998441542bfdab28948509b4a27416e5858c Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 13:04:52 -0500 Subject: [PATCH 59/69] chore(loop): FEAT-LOOP-2026-0251/G1-CLOSE judge cost fold Feature: FEAT-LOOP-2026-0251 --- .../WU-90-gate-1-close.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md index ed6f2824..23392486 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md @@ -65,10 +65,10 @@ cumulative_duration_seconds: 2026.017 cumulative_input_tokens: 280 cumulative_output_tokens: 181754 cumulative_attempts: 5 -cost_usd: 1.174106 +cost_usd: 1.657563 duration_seconds: 747.309 -input_tokens: 46 -output_tokens: 34183 +input_tokens: 64 +output_tokens: 41536 folded_through_re_arm: 6 gate_set: plannext driver_version: 0.33.2 From aba53a35f6d3945404d6000c044926c0492ac47c Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 13:04:53 -0500 Subject: [PATCH 60/69] chore(loop): gate 1 awaiting_review Feature: FEAT-LOOP-2026-0251 --- .../GATE-01.md | 2 +- .../events.jsonl | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md index 98326dd7..fcf58e97 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md @@ -1,6 +1,6 @@ --- gate: 1 -status: open +status: awaiting_review feature_oracle: "python3 -m unittest tests.test_fail_fast_deliverables -v -b" cost_budget_usd: 14.00 broad_run: diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index d348be9f..def82f9a 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -276,3 +276,12 @@ {"timestamp": "2026-11-26T17:43:13.113333+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "hookspath-conflict-bats", "ok": true, "skipped": false, "duration_seconds": 0.594, "phase": "broad"}} {"timestamp": "2026-11-26T17:43:13.237699+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "terminal_judge_editing_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "status": "clean", "reason": "acknowledged by operator: .specfuse/verification.yml.example, produces_driver_helper, specfuse/loop/data/verification.yml.example, specfuse/loop/lint_plan.py, specfuse/loop/loop.py"}} {"timestamp": "2026-11-26T17:43:13.242245+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "terminal_judge_editing_acknowledged", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "close_unit": "FEAT-LOOP-2026-0251/G1-CLOSE", "paths": [".specfuse/verification.yml.example", "produces_driver_helper", "specfuse/loop/data/verification.yml.example", "specfuse/loop/lint_plan.py", "specfuse/loop/loop.py"], "reason": "Review fixes tested, full suite green, accept the generator risk"}} +{"timestamp": "2026-11-26T17:43:13.365277+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "task_started", "source": "driver", "source_version": "0.33.2", "payload": {"type": "close", "model": "sonnet", "re_arm_count": 6}} +{"timestamp": "2026-11-26T17:43:13.365287+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "re_arm_dispatched", "source": "driver", "source_version": "0.33.2", "payload": {"re_arm_count": 6, "reason": "Fixed renames, modes and non-ASCII names, re-close it"}} +{"timestamp": "2026-11-26T17:55:40.715052+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "plan-lint", "ok": true, "skipped": false, "duration_seconds": 0.205, "phase": "attempt"}} +{"timestamp": "2026-11-26T17:55:40.715082+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "feature_oracle", "ok": true, "skipped": false, "duration_seconds": 38.805, "phase": "attempt"}} +{"timestamp": "2026-11-26T18:04:52.930448+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "judged", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "close_verdict": "met", "close_model": "sonnet", "judge_verdict": "not_met", "verdict": "not_met", "lowered": true, "disagreed": true, "findings": 3, "reason": "judge lowered the verdict on 3 finding(s) (Definition of done clause 5 (arm-time warning), Definition of done clause 4 (tree and note), T04#3); the judge's own words are in features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md", "diff_base": "3bc8bef37e1903f18b2a48f78a44fb9a63600864", "diff_base_source": "merge-base of HEAD with main", "usage": {"cost_usd": 0.4834566999999999, "input_tokens": 18, "output_tokens": 7353, "cache_read_input_tokens": 659627, "cache_creation_input_tokens": 85982}, "findings_path": "features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md", "finding_criteria": ["Definition of done clause 5 (arm-time warning)", "Definition of done clause 4 (tree and note)", "T04#3"], "judge_cost_usd": 0.483457}} +{"timestamp": "2026-11-26T18:04:52.933215+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "attempt_outcome", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "outcome": "passed", "duration_seconds": 747.309, "agent_seconds": 708.0799457919784, "verify_seconds": 39.030798624968156, "cost_usd": 1.6575626, "input_tokens": 64, "output_tokens": 41536, "cache_read_input_tokens": 3290826, "cache_creation_input_tokens": 228248, "model": "sonnet", "effort": "high", "failure_class": null, "failure_signature": null, "failure_excerpt": null, "files_touched": [".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md", ".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/LEARNINGS-pending.md", ".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/RETROSPECTIVE.md", ".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md", ".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl", "changelog.d/FEAT-LOOP-2026-0251-the-retry-note-for-the-three-deliverable.md"], "agent_status": "complete", "agent_blocked_reason": null, "re_arm_count": 0, "failing_tests": []}} +{"timestamp": "2026-11-26T18:04:52.933531+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "task_completed", "source": "driver", "source_version": "0.33.2", "payload": {"attempts": 1, "attempts_usage": [{"attempt": 1, "duration_seconds": 747.309, "cost_usd": 1.6575626, "input_tokens": 64, "output_tokens": 41536, "cache_read_input_tokens": 3290826, "cache_creation_input_tokens": 228248, "agent_seconds": 708.0799457919784, "verify_seconds": 39.030798624968156}], "type": "close", "re_arm_count": 6, "cost_usd": 1.657563, "cumulative_cost_usd": 9.355627, "attempts_lifetime": 6, "planned_cost_usd": 5.0}} +{"timestamp": "2026-11-26T18:04:52.971256+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_reached", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1}} +{"timestamp": "2026-11-26T18:04:52.971246+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "arm_predicate_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "would_arm": true, "predicate_version": "v1", "classes": {"budget_projection": {"status": "clean", "reason": "projected spend $12.03 within 2.0x baseline planned total $11.00 (cap $22.00)"}, "judge_editing": {"status": "clean", "reason": "no drafted WU touches judge-path surfaces"}, "decision_class_paths": {"status": "clean", "reason": "no drafted WU touches a recognised dependency manifest (pyproject.toml, package.json, pom.xml, build.gradle, build.gradle.kts, Cargo.toml, go.mod, Gemfile, composer.json, requirements*.txt, *.csproj)"}, "retroactive_edits": {"status": "clean", "reason": "no passed-gate baseline WU altered or removed"}, "drift_caps": {"status": "clean", "reason": "added WUs and gates within drift caps"}, "missing_provenance": {"status": "clean", "reason": "no added WUs"}, "open_questions_human_only": {"status": "clean", "reason": "terminal gate: no drafted successor"}, "plan_next_lint": {"status": "clean", "reason": "plan-next lint: no findings"}}}} From 24e0113d875b53f22a1c040a24ee6139d5e74a76 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 13:04:59 -0500 Subject: [PATCH 61/69] =?UTF-8?q?chore(loop):=20FEAT-LOOP-2026-0251=20?= =?UTF-8?q?=E2=80=94=20record=20the=20follow-up=20issues=20the=20driver=20?= =?UTF-8?q?filed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FOLLOW-UPS.md | 6 ++++++ .../FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl | 1 + 2 files changed, 7 insertions(+) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md index 400a7b8c..3e0f4274 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md @@ -69,6 +69,8 @@ close found it present, and probe cases D to G were not run again. ### Definition of done clause 5 (arm-time warning) +**Tracked as #3617.** + The clause says lint warns when a `produces:` path appears nowhere in the unit body, by full path or file name. The code also stays silent when the body names only the parent directory. I tested a `pending` unit with `produces: specfuse/loop/loop.py`. Its body mentioned only `specfuse/loop/data/docs`, so it had neither the full path nor `loop.py`. No WARN was printed. A body naming none of these did warn. @@ -80,6 +82,8 @@ I tested a `pending` unit with `produces: specfuse/loop/loop.py`. Its body menti ### Definition of done clause 4 (tree and note) +**Tracked as #3618.** + The clause says the retry note lists the paths this attempt changed, or says it changed none. In a kept tree, I had attempt 2 write only a new `docs/events.jsonl`, and separately only a new `docs/PROGRESS.md`. These are ordinary agent files, not the driver's bookkeeping files. In both cases the note said "(none — this attempt changed no files)", which is false. This happened with fail-fast both on and off. The control file `docs/plain.md` was listed correctly. The cause is that `format_changed_paths` drops paths by base name only. @@ -89,6 +93,8 @@ In both cases the note said "(none — this attempt changed no files)", which is ### T04#3 +**Tracked as #3619.** + I couldn't verify that T04's RESULT notes gave the measured count and total. I searched the feature's `events.jsonl`, `PROGRESS.md` and `work/` for the figures and found nothing. The numbers themselves look right. My own count gave 402 `done` units with `produces:`. 81 would warn when matching only path or file name, and 35 when the parent directory also counts. The code docstring says 81 and 35 of 401. That doesn't show what the RESULT notes said. diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index def82f9a..912067d0 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -285,3 +285,4 @@ {"timestamp": "2026-11-26T18:04:52.933531+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "task_completed", "source": "driver", "source_version": "0.33.2", "payload": {"attempts": 1, "attempts_usage": [{"attempt": 1, "duration_seconds": 747.309, "cost_usd": 1.6575626, "input_tokens": 64, "output_tokens": 41536, "cache_read_input_tokens": 3290826, "cache_creation_input_tokens": 228248, "agent_seconds": 708.0799457919784, "verify_seconds": 39.030798624968156}], "type": "close", "re_arm_count": 6, "cost_usd": 1.657563, "cumulative_cost_usd": 9.355627, "attempts_lifetime": 6, "planned_cost_usd": 5.0}} {"timestamp": "2026-11-26T18:04:52.971256+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_reached", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1}} {"timestamp": "2026-11-26T18:04:52.971246+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "arm_predicate_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "would_arm": true, "predicate_version": "v1", "classes": {"budget_projection": {"status": "clean", "reason": "projected spend $12.03 within 2.0x baseline planned total $11.00 (cap $22.00)"}, "judge_editing": {"status": "clean", "reason": "no drafted WU touches judge-path surfaces"}, "decision_class_paths": {"status": "clean", "reason": "no drafted WU touches a recognised dependency manifest (pyproject.toml, package.json, pom.xml, build.gradle, build.gradle.kts, Cargo.toml, go.mod, Gemfile, composer.json, requirements*.txt, *.csproj)"}, "retroactive_edits": {"status": "clean", "reason": "no passed-gate baseline WU altered or removed"}, "drift_caps": {"status": "clean", "reason": "added WUs and gates within drift caps"}, "missing_provenance": {"status": "clean", "reason": "no added WUs"}, "open_questions_human_only": {"status": "clean", "reason": "terminal gate: no drafted successor"}, "plan_next_lint": {"status": "clean", "reason": "plan-next lint: no findings"}}}} +{"timestamp": "2026-11-26T18:04:59.241480+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "followups_recorded", "source": "driver", "source_version": "0.33.2", "payload": {"filed": 3, "unfiled": 0, "already_tracked": 0, "issue_numbers": ["3617", "3618", "3619"], "written_back": ["FOLLOW-UPS.md"]}} From 8984c8142bd092efa5ba4e125b116c4e365d44ad Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 13:13:16 -0500 Subject: [PATCH 62/69] fix(loop): retry note leaves out driver bookkeeping by full path, not base name (#3618) An agent's own docs/events.jsonl or docs/PROGRESS.md was dropped from the note's path list because the driver's bookkeeping was matched by base name. The unit file, events.jsonl and PROGRESS.md are now matched by full path in the unit's feature folder. Co-Authored-By: Claude Opus 5.5 --- .../PLAN.md | 5 +++++ specfuse/loop/loop.py | 13 ++++++++++++- tests/test_fail_fast_deliverables.py | 14 ++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PLAN.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PLAN.md index 40670f3a..b6c2de52 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PLAN.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PLAN.md @@ -151,3 +151,8 @@ gates: for each case, with and without `fail_fast_deliverables`; a non-ASCII kept edit left alone still reads "changed no files". The driver crash on `git add -N` for a new non-ASCII file is a separate, pre-existing defect (it predates this feature) and is not fixed here. +- **Sixth-close follow-up (2026-11-26, #3618).** The note left out the driver's bookkeeping by + base name, so an agent's own `docs/events.jsonl` or `docs/PROGRESS.md` was dropped and the note + could say "changed no files". It now matches the unit file, `events.jsonl` and `PROGRESS.md` by + full path in the unit's feature folder. Tested in `TestTreeAndNote`, with and without + `fail_fast_deliverables`. diff --git a/specfuse/loop/loop.py b/specfuse/loop/loop.py index 1ff1b646..60f357b7 100644 --- a/specfuse/loop/loop.py +++ b/specfuse/loop/loop.py @@ -5326,13 +5326,24 @@ def format_changed_paths(wu: "WorkUnit", changed: list, `assert_implementation_touched_files` leaves it out: the driver writes it on every attempt, so listing it would hide that the agent changed nothing. + Those files are matched by full path, in the unit's feature folder, so + an agent's own `docs/events.jsonl` or `PROGRESS.md` elsewhere is still + listed (#3618). + *tree_before* is the attempt-start snapshot (`snapshot_dirty_tree`): paths a kept earlier attempt left, unchanged since, are not this attempt's and are left out (#3612). """ + feature_dir = Path(wu.file).parent + bookkeeping = { + Path(os.path.relpath(f)).as_posix() if Path(f).is_absolute() + else Path(f).as_posix() + for f in (wu.file, feature_dir / "events.jsonl", + feature_dir / PROGRESS_FILENAME) + } paths = [ t for t in attempt_own_paths(changed, tree_before) - if Path(t).name not in (wu.file.name, "events.jsonl", PROGRESS_FILENAME) + if Path(t).as_posix() not in bookkeeping ] if not paths: return "(none — this attempt changed no files)" diff --git a/tests/test_fail_fast_deliverables.py b/tests/test_fail_fast_deliverables.py index d851fc32..d3e0e6ab 100644 --- a/tests/test_fail_fast_deliverables.py +++ b/tests/test_fail_fast_deliverables.py @@ -632,6 +632,20 @@ def test_non_ascii_name_left_alone_is_not_listed(self): with self.subTest(fail_fast=ff): self.assertIn("this attempt changed no files", listed) + def test_agent_files_named_like_driver_bookkeeping_are_listed(self): + # #3618: only the driver's own files are left out, by full path; an + # agent's `docs/events.jsonl` or `docs/PROGRESS.md` is listed. + def write_lookalikes(): + Path("docs/events.jsonl").write_text("{}\n") + Path("docs/PROGRESS.md").write_text("progress\n") + + for ff, listed in self._listed(write_lookalikes).items(): + with self.subTest(fail_fast=ff): + self.assertIn("- `docs/events.jsonl`", listed) + self.assertIn("- `docs/PROGRESS.md`", listed) + self.assertNotIn("WU-T01.md", listed) + self.assertNotIn(".specfuse/features/", listed) + def test_list_is_capped_at_twenty(self): def thirty(): Path("docs").mkdir(exist_ok=True) From 75d7173af4d818244de4cbfb92d10b8fc335c5d7 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 16:34:39 -0500 Subject: [PATCH 63/69] =?UTF-8?q?chore(loop):=20FEAT-LOOP-2026-0251=20?= =?UTF-8?q?=E2=80=94=20amend=20clause=205=20(#3617,=20#3619),=20re-arm=20G?= =?UTF-8?q?1-CLOSE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 5.5 --- .../GATE-01.md | 13 ++++++++-- .../WU-90-gate-1-close.md | 24 +++++++++++++++---- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md index fcf58e97..0b9c6b20 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md @@ -1,6 +1,6 @@ --- gate: 1 -status: awaiting_review +status: open feature_oracle: "python3 -m unittest tests.test_fail_fast_deliverables -v -b" cost_budget_usd: 14.00 broad_run: @@ -31,7 +31,16 @@ leaves a known diff and a `verify_fn` that counts its calls: verification did not run and lists the paths this attempt changed (or says it changed none). 5. **Arm-time warning.** `specfuse lint` prints a WARN for a dispatchable unit whose `produces:` - path appears nowhere in its body, by full path or file name, and stays silent when it does. + path appears nowhere in its body, by full path, file name or parent directory, and stays + silent when it does. *(Parent directory added 2026-11-26 by the operator after the sixth + close, #3617: `PLAN.md` decision 7 required narrowing above a 10% warning rate; by full path + or file name the warning fired on 81 of 401 `done` units with `produces:` (20.2%), with the + parent directory on 35 (8.7%).)* **Measurement record** *(operator, 2026-11-26, #3619):* the + driver keeps no RESULT notes from passed attempts, so T04's measured count and total are + recorded by the `check_produces_mentioned` docstring in `specfuse/loop/lint_plan.py` (81 and + 35 of 401) and confirmed by the sixth close's judge, who recounted independently (81 and 35 + of 402; one unit finished since). That pair is the accepted evidence for WU-04's reporting + criterion. 6. **Nothing else changes.** Every existing test of the three guards passes unchanged, apart from assertions on the order of `verify` and the guard, and edits forced by moving code into a shared helper or by new lint wording that a text-matching assertion picks up. No such edit diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md index 23392486..ee4acd0e 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md @@ -1,8 +1,8 @@ --- id: FEAT-LOOP-2026-0251/G1-CLOSE type: close -status: done -attempts: 1 +status: pending +attempts: 0 oracle_env: macos_local planned_cost_usd: 5.00 auto_close_disabled: true @@ -16,7 +16,7 @@ judge_edit_acknowledged: - specfuse/loop/lint_plan.py - specfuse/loop/loop.py reason: "Review fixes tested, full suite green, accept the generator risk" -re_arm_count: 6 +re_arm_count: 7 re_arm_history: - timestamp: 2026-11-26T13:30:05+00:00 @@ -60,6 +60,13 @@ re_arm_history: prior_cost_usd: 1.347591 prior_duration_seconds: 616.642 reason: "Fixed renames, modes and non-ASCII names, re-close it" + - + timestamp: 2026-11-26T21:34:17+00:00 + prior_status: done + prior_attempts: 1 + prior_cost_usd: 1.657563 + prior_duration_seconds: 747.309 + reason: "Amend both as recommended, fixed bookkeeping paths, re-close it" cumulative_cost_usd: 7.698064 cumulative_duration_seconds: 2026.017 cumulative_input_tokens: 280 @@ -73,7 +80,6 @@ folded_through_re_arm: 6 gate_set: plannext driver_version: 0.33.2 started_at: 2026-11-26T17:43:13.364717+00:00 -verdict: not_met --- # G1-CLOSE — terminal close @@ -140,3 +146,13 @@ comparing each path's state at the start and end of the attempt (`snapshot_dirty `git add -N` crash on a new non-ASCII file predates this feature and is outside clause 4. Update the closing files in place as before, and say in `FOLLOW-UPS.md` whether #3614's re-run condition now holds. + +**Sixth re-close note (2026-11-26).** The sixth close recorded `not_met` on #3617, #3618 and +#3619. #3618 (the retry note dropped an agent's own `docs/events.jsonl` or `docs/PROGRESS.md` +because it matched driver bookkeeping by base name) is fixed on the branch: it now matches the +unit file, `events.jsonl` and `PROGRESS.md` by full path in the unit's feature folder (tests in +`TestTreeAndNote`; see `PLAN.md` Notes). For #3617 and #3619 the operator amended `GATE-01.md` +clause 5: the warning stays silent when the body names the path's parent directory (narrowed +under `PLAN.md` decision 7), and T04's measurement is recorded there with its evidence. Update +the closing files in place as before, and say in `FOLLOW-UPS.md` whether each of #3617, #3618 +and #3619's re-run conditions now holds. From 1abffca5e443e3243ec3b836433c98c2b717c40f Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 16:34:42 -0500 Subject: [PATCH 64/69] chore(loop): FEAT-LOOP-2026-0251 build pin recorded Feature: FEAT-LOOP-2026-0251 --- .../FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl | 1 + 1 file changed, 1 insertion(+) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index 912067d0..d37a10a7 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -286,3 +286,4 @@ {"timestamp": "2026-11-26T18:04:52.971256+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_reached", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1}} {"timestamp": "2026-11-26T18:04:52.971246+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "arm_predicate_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "would_arm": true, "predicate_version": "v1", "classes": {"budget_projection": {"status": "clean", "reason": "projected spend $12.03 within 2.0x baseline planned total $11.00 (cap $22.00)"}, "judge_editing": {"status": "clean", "reason": "no drafted WU touches judge-path surfaces"}, "decision_class_paths": {"status": "clean", "reason": "no drafted WU touches a recognised dependency manifest (pyproject.toml, package.json, pom.xml, build.gradle, build.gradle.kts, Cargo.toml, go.mod, Gemfile, composer.json, requirements*.txt, *.csproj)"}, "retroactive_edits": {"status": "clean", "reason": "no passed-gate baseline WU altered or removed"}, "drift_caps": {"status": "clean", "reason": "added WUs and gates within drift caps"}, "missing_provenance": {"status": "clean", "reason": "no added WUs"}, "open_questions_human_only": {"status": "clean", "reason": "terminal gate: no drafted successor"}, "plan_next_lint": {"status": "clean", "reason": "plan-next lint: no findings"}}}} {"timestamp": "2026-11-26T18:04:59.241480+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "followups_recorded", "source": "driver", "source_version": "0.33.2", "payload": {"filed": 3, "unfiled": 0, "already_tracked": 0, "issue_numbers": ["3617", "3618", "3619"], "written_back": ["FOLLOW-UPS.md"]}} +{"timestamp": "2026-11-26T21:34:42.609533+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "driver_build_pinned", "source": "driver", "source_version": "0.33.2", "payload": {"tree": "44f7450397555acbb50ce03c7ff7c99f4282164a", "path": "/private/var/folders/zc/rgq11x850d78dx_kf1fd4vx80000gn/T/specfuse-pins/44f7450397555acbb50ce03c7ff7c99f4282164a/specfuse/loop"}} From 6ea70115262c61cf4a08a129bb10c248c856001e Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 16:46:35 -0500 Subject: [PATCH 65/69] chore(loop): gate 1 broad run clean Feature: FEAT-LOOP-2026-0251 --- .../GATE-01.md | 4 ++-- .../events.jsonl | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md index 0b9c6b20..c98dbb52 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md @@ -4,8 +4,8 @@ status: open feature_oracle: "python3 -m unittest tests.test_fail_fast_deliverables -v -b" cost_budget_usd: 14.00 broad_run: - tree: 07bbf72d1e7af3c1a03af605f40e5563dc3a18db:0ec7c6da6e74f0b56753f09657b654a6d289b91b:12064a6191eeb830a9826d911a8543fbaba3da75:27968248a450a842ccd187b7dce0fb0ded934866:287efde8f90320baffac08f5f3287b9456a65cb9:2e29b2f7e073a0cbe290f01d3b397e1cdd10c81c:42796ea0e0a6c03811b0e4bc9dbd3b5ee62dd2e4:4acc6dfc5e8cece358c167d876515eba4a39a500:56ae45adcc17a1292977c436fd195ef8c61cc9e4:6b5c76ebbf025cbc351b8e53befb9eb1cd766d7d:730293495f0527afe574261e3a399a7ee4e1b8dc:834d9d9c16094a386cd9b5a6f9ced9a3a9b4e7fb:bbd1aea514612d76722a18c7aece7c767cf1a076:bf5328ea194a219488f840fd7688ba65e41b9b9e:c23b62e87f1ae3890c6f9e3d8c7ca7ec9225ed81:caffe2d63ceacde448842a91bc7a12c206a67523:d74b7d113b844e84f0009098f576fd28477f072d:e3b0de29b81a6c8e0abeacb3898519b98014b9ef:fa2f4f88657587b6e3b560977858810846b1d366 - ran_at: 2026-11-26T17:43:13.106354+00:00 + tree: 005cbf7fae31cc70ae2611ac1daa3e6f33f8c06b:07bbf72d1e7af3c1a03af605f40e5563dc3a18db:0ec7c6da6e74f0b56753f09657b654a6d289b91b:12064a6191eeb830a9826d911a8543fbaba3da75:27968248a450a842ccd187b7dce0fb0ded934866:287efde8f90320baffac08f5f3287b9456a65cb9:2e29b2f7e073a0cbe290f01d3b397e1cdd10c81c:42796ea0e0a6c03811b0e4bc9dbd3b5ee62dd2e4:453dde1cefd6975f95fef87586aebf0587449a5d:4acc6dfc5e8cece358c167d876515eba4a39a500:56ae45adcc17a1292977c436fd195ef8c61cc9e4:834d9d9c16094a386cd9b5a6f9ced9a3a9b4e7fb:bbd1aea514612d76722a18c7aece7c767cf1a076:c23b62e87f1ae3890c6f9e3d8c7ca7ec9225ed81:caffe2d63ceacde448842a91bc7a12c206a67523:d74b7d113b844e84f0009098f576fd28477f072d:e3b0de29b81a6c8e0abeacb3898519b98014b9ef:edd5a2872c1d0bda9e1273c586da80e330e1652c:fa2f4f88657587b6e3b560977858810846b1d366 + ran_at: 2026-11-26T21:46:35.359538+00:00 ok: true failing: [] --- diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index d37a10a7..de697f57 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -287,3 +287,22 @@ {"timestamp": "2026-11-26T18:04:52.971246+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "arm_predicate_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "would_arm": true, "predicate_version": "v1", "classes": {"budget_projection": {"status": "clean", "reason": "projected spend $12.03 within 2.0x baseline planned total $11.00 (cap $22.00)"}, "judge_editing": {"status": "clean", "reason": "no drafted WU touches judge-path surfaces"}, "decision_class_paths": {"status": "clean", "reason": "no drafted WU touches a recognised dependency manifest (pyproject.toml, package.json, pom.xml, build.gradle, build.gradle.kts, Cargo.toml, go.mod, Gemfile, composer.json, requirements*.txt, *.csproj)"}, "retroactive_edits": {"status": "clean", "reason": "no passed-gate baseline WU altered or removed"}, "drift_caps": {"status": "clean", "reason": "added WUs and gates within drift caps"}, "missing_provenance": {"status": "clean", "reason": "no added WUs"}, "open_questions_human_only": {"status": "clean", "reason": "terminal gate: no drafted successor"}, "plan_next_lint": {"status": "clean", "reason": "plan-next lint: no findings"}}}} {"timestamp": "2026-11-26T18:04:59.241480+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "followups_recorded", "source": "driver", "source_version": "0.33.2", "payload": {"filed": 3, "unfiled": 0, "already_tracked": 0, "issue_numbers": ["3617", "3618", "3619"], "written_back": ["FOLLOW-UPS.md"]}} {"timestamp": "2026-11-26T21:34:42.609533+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "driver_build_pinned", "source": "driver", "source_version": "0.33.2", "payload": {"tree": "44f7450397555acbb50ce03c7ff7c99f4282164a", "path": "/private/var/folders/zc/rgq11x850d78dx_kf1fd4vx80000gn/T/specfuse-pins/44f7450397555acbb50ce03c7ff7c99f4282164a/specfuse/loop"}} +{"timestamp": "2026-11-26T21:46:35.372471+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "broad_run_result", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "tree": "005cbf7fae31cc70ae2611ac1daa3e6f33f8c06b:07bbf72d1e7af3c1a03af605f40e5563dc3a18db:0ec7c6da6e74f0b56753f09657b654a6d289b91b:12064a6191eeb830a9826d911a8543fbaba3da75:27968248a450a842ccd187b7dce0fb0ded934866:287efde8f90320baffac08f5f3287b9456a65cb9:2e29b2f7e073a0cbe290f01d3b397e1cdd10c81c:42796ea0e0a6c03811b0e4bc9dbd3b5ee62dd2e4:453dde1cefd6975f95fef87586aebf0587449a5d:4acc6dfc5e8cece358c167d876515eba4a39a500:56ae45adcc17a1292977c436fd195ef8c61cc9e4:834d9d9c16094a386cd9b5a6f9ced9a3a9b4e7fb:bbd1aea514612d76722a18c7aece7c767cf1a076:c23b62e87f1ae3890c6f9e3d8c7ca7ec9225ed81:caffe2d63ceacde448842a91bc7a12c206a67523:d74b7d113b844e84f0009098f576fd28477f072d:e3b0de29b81a6c8e0abeacb3898519b98014b9ef:edd5a2872c1d0bda9e1273c586da80e330e1652c:fa2f4f88657587b6e3b560977858810846b1d366", "ok": true, "failing": []}} +{"timestamp": "2026-11-26T21:46:35.372517+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "tests", "ok": true, "skipped": false, "duration_seconds": 525.451, "phase": "broad"}} +{"timestamp": "2026-11-26T21:46:35.372521+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "lint", "ok": true, "skipped": false, "duration_seconds": 0.816, "phase": "broad"}} +{"timestamp": "2026-11-26T21:46:35.372525+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "security", "ok": true, "skipped": false, "duration_seconds": 3.246, "phase": "broad"}} +{"timestamp": "2026-11-26T21:46:35.372527+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "coverage", "ok": true, "skipped": false, "duration_seconds": 2.618, "phase": "broad"}} +{"timestamp": "2026-11-26T21:46:35.372529+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "leak-scan", "ok": true, "skipped": false, "duration_seconds": 28.601, "phase": "broad"}} +{"timestamp": "2026-11-26T21:46:35.372532+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "changelog-fragments", "ok": true, "skipped": false, "duration_seconds": 0.219, "phase": "broad"}} +{"timestamp": "2026-11-26T21:46:35.372535+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "agent-policy-example-lint", "ok": true, "skipped": false, "duration_seconds": 0.176, "phase": "broad"}} +{"timestamp": "2026-11-26T21:46:35.372537+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "event-type-gate", "ok": true, "skipped": false, "duration_seconds": 0.416, "phase": "broad"}} +{"timestamp": "2026-11-26T21:46:35.372539+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "roadmap-link-gate", "ok": true, "skipped": false, "duration_seconds": 0.087, "phase": "broad"}} +{"timestamp": "2026-11-26T21:46:35.372543+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "arm-sweep-gate", "ok": true, "skipped": false, "duration_seconds": 1.165, "phase": "broad"}} +{"timestamp": "2026-11-26T21:46:35.372546+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "monitoring-example-lint", "ok": true, "skipped": false, "duration_seconds": 0.086, "phase": "broad"}} +{"timestamp": "2026-11-26T21:46:35.372548+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "leak-scan-hook", "ok": true, "skipped": false, "duration_seconds": 12.568, "phase": "broad"}} +{"timestamp": "2026-11-26T21:46:35.372550+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "pre-push-hook", "ok": true, "skipped": false, "duration_seconds": 58.873, "phase": "broad"}} +{"timestamp": "2026-11-26T21:46:35.372551+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "sync-scaffold-bats", "ok": true, "skipped": false, "duration_seconds": 71.431, "phase": "broad"}} +{"timestamp": "2026-11-26T21:46:35.372554+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "sync-scaffold-symlinks-bats", "ok": true, "skipped": false, "duration_seconds": 3.3, "phase": "broad"}} +{"timestamp": "2026-11-26T21:46:35.372556+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "init-sh-shim-bats", "ok": true, "skipped": false, "duration_seconds": 1.564, "phase": "broad"}} +{"timestamp": "2026-11-26T21:46:35.372558+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "init-skills-bats", "ok": true, "skipped": false, "duration_seconds": 0.259, "phase": "broad"}} +{"timestamp": "2026-11-26T21:46:35.372563+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "hookspath-conflict-bats", "ok": true, "skipped": false, "duration_seconds": 1.217, "phase": "broad"}} From 596d1e711f699c5fb931894fa071128249ba9603 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 16:53:31 -0500 Subject: [PATCH 66/69] =?UTF-8?q?feat:=20G1-CLOSE=20=E2=80=94=20terminal?= =?UTF-8?q?=20close?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Feature: FEAT-LOOP-2026-0251/G1-CLOSE --- .../FOLLOW-UPS.md | 93 ++++---- .../LEARNINGS-pending.md | 5 +- .../PROGRESS.md | 2 + .../RETROSPECTIVE.md | 202 +++++++++++------- .../WU-90-gate-1-close.md | 27 +-- .../events.jsonl | 2 + ...he-retry-note-for-the-three-deliverable.md | 2 +- 7 files changed, 194 insertions(+), 139 deletions(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md index 3e0f4274..74eab953 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md @@ -1,10 +1,56 @@ # Follow-ups — FEAT-LOOP-2026-0251 -Sixth close, 2026-11-26. No entry is open. The re-run conditions of #3608, #3609, #3610, -#3612, #3613 and #3614 hold. +Seventh close, 2026-11-26. No entry is open. The re-run conditions of #3608, #3609, #3610, +#3612, #3613, #3614, #3617, #3618 and #3619 hold. ## Resolved +#### Definition of done clause 5 (arm-time warning) + +**Tracked as #3617.** **Re-run condition holds.** The entry's gap was that clause 5 did not +allow the parent-directory match. `GATE-01.md` clause 5 now says the warning is silent when +the body names the path's parent directory, narrowed under `PLAN.md` decision 7. This +close's probe of `check_produces_mentioned` on `specfuse/loop/loop.py`: silent for the full +path, the file name and `specfuse/loop/data/docs` (the entry's case, which contains the +parent `specfuse/loop`); WARN for a body naming none. The entry's silent result is now the +stated behaviour. With the parent directory dropped from the check in a scratch copy, +`TestArmTimeWarning` gives 1 failure. + +- command: `PYTHONPATH=. python3 $TMPDIR/close7/p5.py` +- exit: 0 + +#### Definition of done clause 4 (tree and note) + +**Tracked as #3618.** **Re-run condition holds.** On a kept tree, attempt 2 writing only +`docs/events.jsonl`, or only `docs/PROGRESS.md`, now gets that file in its note, with +fail-fast on and off; so do the same names at the repository root and a `docs/WU-T01.md`. +Writing nothing still says "changed no files". Covered by +`test_agent_files_named_like_driver_bookkeeping_are_listed`. With the base-name filter put +back in a scratch copy, `TestTreeAndNote` gives 2 failures. The driver's own three files in +the feature folder are still left out. Git-ignored files are still not listed; the entry did +not name them (see `RETROSPECTIVE.md`). + +- command: `PYTHONPATH=. python3 $TMPDIR/close7/p4.py` (uses + `TestTreeAndNote._second_attempt_note`) +- exit: 0 + +#### T04#3 + +**Tracked as #3619.** **Re-run condition holds**, by amendment. T04's RESULT notes still have +not been seen: the driver keeps none for passed attempts. `GATE-01.md` clause 5 ("Measurement +record") accepts the `check_produces_mentioned` docstring and the sixth judge's recount. The +docstring reads 81 and 35 of 401, matching `GATE-01.md`. This close's own recount of `done` +units with `produces:` gave 81 and 35 of 402. + +- command: `PYTHONPATH=. python3 $TMPDIR/close7/count.py` +- exit: 0 + +### Resolved at earlier closes + +The text below is as the sixth close wrote it. Its "this close" and "this session" mean the +close named in each entry or the sixth. Where #3614 lists files named like driver bookkeeping +as a limit, #3618 above has since narrowed it. + #### The retry note's path list missed renames, non-ASCII names and mode changes **Tracked as #3614.** **Re-run condition holds** (first branch). In this close's probe the @@ -62,42 +108,7 @@ this session; the probe's case A agrees. The ten changed modules pass (68 tests, exit 0), and the two edits are named in `RETROSPECTIVE.md`. -This sixth close reran the oracle (which holds the #3608, #3612, #3613 and #3614 tests), the -ten modules behind #3609 (68 tests, `OK`) and the unfiltered-list control. For #3610 the -condition is wording in `GATE-01.md`, the close unit and `docs/methodology.md`; the fifth -close found it present, and probe cases D to G were not run again. - -### Definition of done clause 5 (arm-time warning) - -**Tracked as #3617.** - -The clause says lint warns when a `produces:` path appears nowhere in the unit body, by full path or file name. The code also stays silent when the body names only the parent directory. - -I tested a `pending` unit with `produces: specfuse/loop/loop.py`. Its body mentioned only `specfuse/loop/data/docs`, so it had neither the full path nor `loop.py`. No WARN was printed. A body naming none of these did warn. - -`test_parent_directory_mention_is_silent` asserts this silent behaviour. T04's text allowed narrowing the match, but clause 5 was never amended. Clause 6 and the precedence rule were amended explicitly, and no deliverable is recorded as dropped by amendment. - -- command: `PYTHONPATH=. python3 $TMPDIR/p5.py` (calls `lint_plan.check_produces_mentioned` on temporary units; the "dir-only" case printed nothing) -- exit: 0 - -### Definition of done clause 4 (tree and note) - -**Tracked as #3618.** - -The clause says the retry note lists the paths this attempt changed, or says it changed none. In a kept tree, I had attempt 2 write only a new `docs/events.jsonl`, and separately only a new `docs/PROGRESS.md`. These are ordinary agent files, not the driver's bookkeeping files. - -In both cases the note said "(none — this attempt changed no files)", which is false. This happened with fail-fast both on and off. The control file `docs/plain.md` was listed correctly. The cause is that `format_changed_paths` drops paths by base name only. - -- command: `PYTHONPATH=. python3 $TMPDIR/p4.py` (uses `TestTreeAndNote._second_attempt_note`) -- exit: 0 - -### T04#3 - -**Tracked as #3619.** - -I couldn't verify that T04's RESULT notes gave the measured count and total. I searched the feature's `events.jsonl`, `PROGRESS.md` and `work/` for the figures and found nothing. - -The numbers themselves look right. My own count gave 402 `done` units with `produces:`. 81 would warn when matching only path or file name, and 35 when the parent directory also counts. The code docstring says 81 and 35 of 401. That doesn't show what the RESULT notes said. - -- command: `grep -rnE "81 of 401|35 \(8\.7|20\.2%" /events.jsonl /PROGRESS.md /work` -- exit: 1 +This seventh close reran the oracle (which holds the #3608, #3612, #3613, #3614 and #3618 +tests) and the ten modules behind #3609 (68 tests, `OK`). It did not repeat the earlier +mutation for #3612 and #3613 or probe cases D to G. For #3610 the condition is wording in +`GATE-01.md`, the close unit and `docs/methodology.md`; the fifth close found it present. diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/LEARNINGS-pending.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/LEARNINGS-pending.md index b66ed079..67eb16cc 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/LEARNINGS-pending.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/LEARNINGS-pending.md @@ -34,4 +34,7 @@ Licensed under the Apache License, Version 2.0. See LICENSE. `--no-renames -z`. Test write, edit, delete, revert, rename and a non-ASCII name on a second attempt, and probe the whole matrix before the first fix, not one case per close (the state comparison closed the whole matrix at once; three filter fixes had not). When - switching git reads to `-z`, decide how a non-UTF-8 name decodes: quoting had hidden that. + switching git reads to `-z`, decide how a non-UTF-8 name decodes: quoting had hidden that. A filter that + hides the tool's own bookkeeping must match full paths: matched by base name it also hid an + agent's own `docs/events.jsonl`, and a close that argued such a limit was acceptable was + overruled by the judge. diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md index 2b7dc907..b848c751 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PROGRESS.md @@ -16,3 +16,5 @@ - note: Build the retry note's list by comparing attempt-start and attempt-end path states (content and mode, read with --no-renames -z), and reuse the -z reading for the git add -N crash on non-ASCII names. - **FEAT-LOOP-2026-0251/G1-CLOSE**: Sixth close of gate 1 confirms the - note: Weigh probe case N2 (a file named events.jsonl outside the feature folder is left out of the retry note); the non-UTF-8 decode in _paths_differing_from and the older git add -N crash have no filed issue. +- **FEAT-LOOP-2026-0251/G1-CLOSE**: Seventh close of gate 1 updated the closing files in place with advisory verdict met, confirming that the re-run conditions of + - note: No follow-up is open, so the older git add -N crash on non-ASCII names and the non-UTF-8 decode in _paths_differing_from have no tracked issue (see RETROSPECTIVE.md, "Notes for the human reviewer"). diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/RETROSPECTIVE.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/RETROSPECTIVE.md index f3f762ff..0cff90e7 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/RETROSPECTIVE.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/RETROSPECTIVE.md @@ -4,33 +4,60 @@ ## Verdict -`met` (advisory; the judge concludes). This is the sixth close of the gate. The #3614 cases -are fixed: both names of a rename, a restored old name, a mode-only change and later changes -to a non-ASCII name are listed, with fail-fast on and off. The oracle passes (42 tests, no -skips). This session did not rerun the early-against-late probe; the fourth and fifth closes' -runs of it showed no difference beyond the stated precedence. - -One judgement call sits under clause 4. The list leaves out any file *named* `events.jsonl`, -`PROGRESS.md` or like the unit file, in any directory, and files git ignores (probe cases N2 -and S10). I read both as outside "the paths this attempt changed": the guards use the same -by-name bookkeeping rule, and the diff they judge never holds ignored files. Under a literal -reading, a note that says "changed no files" in case N2 is wrong. +`met` (advisory; the judge concludes). This is the seventh close of the gate. The re-run +conditions of #3617, #3618 and #3619 hold: lint is silent on a parent-directory mention, as +amended clause 5 says; an agent's own `docs/events.jsonl` or `docs/PROGRESS.md` is now in the +retry note; and `GATE-01.md` records the warning-rate measurement and its accepted evidence, +which an independent recount in this session agrees with. The oracle passes (43 tests, no +skips). This session did not rerun the early-against-late probe; its tables below are the +fourth and fifth closes' observations. + +Limits that remain under clause 4: the note does not list files git ignores, and it leaves out +the driver's own three files in the feature folder (the unit file, `events.jsonl`, +`PROGRESS.md`) even if an agent edits one. Non-UTF-8 names and an older crash are under +"Notes for the human reviewer". ## Measurements -All commands ran fresh in this sixth close on the working tree, unless a line says -otherwise. Test runs and probes used `HOME` under `$TMPDIR` with a stub git identity, +Commands in this section ran fresh in this seventh close on the working tree, unless a line +says otherwise. Test runs and probes used `HOME` under `$TMPDIR` with a stub git identity, because with the real `HOME` the sandbox blocks the driver's preflight write (observed in -the fourth close). git version 2.53.0. +the fourth close). ### feature_oracle: PASS -`python3 -m unittest tests.test_fail_fast_deliverables -v -b`: exit 0, `Ran 42 tests`, `OK`, +`python3 -m unittest tests.test_fail_fast_deliverables -v -b`: exit 0, `Ran 43 tests`, `OK`, no skips. `grep -c "unittest.skip" tests/test_fail_fast_deliverables.py` prints `0`. A search of that file for `unittest.skip`, `skipIf`, `skipUnless`, `skipTest` and `@skip` finds nothing. -It does not cover the limits in cases N2 and S10 below. -### Retry note on a kept tree (#3614 and beyond it) +### Retry note: files named like driver bookkeeping (#3618) + +A throwaway probe drove `loop.run()` through the oracle's `_second_attempt_note` (kept tree, +stubbed agent session and `verify`) and read attempt 2's path list. Every row gave the same +list with fail-fast on and off. + +| Attempt 2 does | Note lists | +|---|---| +| writes a new `docs/events.jsonl` | that file | +| writes a new `docs/PROGRESS.md` | that file | +| writes a new `events.jsonl` at the repository root | that file | +| writes a new `PROGRESS.md` at the repository root | that file | +| writes a new `docs/WU-T01.md` (the unit file's name) | that file | +| writes `docs/plain.md` (control) | that file | +| edits a tracked `docs/PROGRESS.md` that attempt 1 had edited | that file | +| nothing | "changed no files" | +| appends to the feature folder's own `events.jsonl` | "changed no files" (driver file, left out by design) | +| writes a git-ignored file | "changed no files" (**ignored file not listed**) | + +The guard itself still filters by base name (`assert_implementation_touched_files`, read from +the code). So an `implementation` attempt whose only new file is, say, `docs/events.jsonl` +can be refused as `no_deliverable_files` while its note lists that file. The note is right +about what changed; the guard rule is older than this feature and clause 6 leaves it alone. + +### Retry note on a kept tree (#3614 and beyond it), as run in the sixth close + +This table is the sixth close's observation, not run again. The oracle's tests for these +kinds of change passed in this session. Row N2 is superseded by the table above. A throwaway probe drove `loop.run()` through the oracle's own helper (`_second_attempt_note`, kept tree, stubbed agent session and `verify`) and read the path @@ -66,10 +93,10 @@ and off. | S10 | writes a new file | writes a git-ignored file | "changed no files" | **ignored file not listed** | | N2 | writes a new file | writes `docs/events.jsonl` | "changed no files" | **file not listed** | -N2 follows from `format_changed_paths`, which drops by base name (`events.jsonl`, -`PROGRESS.md`, the unit file's name). `assert_implementation_touched_files` filters the same -way, and `git_diff_names` drops `PROGRESS.md` by base name. Only the `events.jsonl` name was -run; the other two names are read from the code. +N2 was true on the sixth close's tree, where `format_changed_paths` dropped by base name. +It now matches the three driver files by full path (#3618). `git_diff_names` still drops +`PROGRESS.md` by base name from the guard's diff, but the note's list is built from the +attempt-start comparison, so the table above shows the file listed. First attempt, reset tree, fail-fast on and off: a new `docs/ñ.md` is listed unquoted, and a rename of the tracked deliverable `src/rule.py` lists both names (in the presence-refusal @@ -107,7 +134,7 @@ builds) when tracked, and an untracked one cannot be created on macOS. | Check | Result | |---|---| | `python3 -m unittest tests.test_dispatch_skeleton tests.test_gate_timings -b` | 25 tests, `OK` | -| `python3 -m unittest tests.test_lint_plan -b` (named by T04) | **error: no such module** | +| `python3 -m unittest tests.test_lint_plan -b` (named by T04) | **import error: no such module** | | the `tests/test_lint_plan*.py` modules that do exist | 46 tests, `OK` | | the ten changed pre-existing test modules | 68 tests, `OK` | | `.specfuse/scripts/lint_plan.py` over every feature folder with a `PLAN.md` | 97 linted, 0 non-zero exits | @@ -115,38 +142,36 @@ builds) when tracked, and an untracked one cannot be created on macOS. | `diff docs/methodology.md specfuse/loop/data/docs/methodology.md` | exit 0, empty | | `python3 -m specfuse.loop.changelog_fragments check` | exit 0 | -This session did not run the full suite or coverage. The driver's broad run recorded at -2026-11-26T17:43:13Z has `ok: true` and no failing gate. Its tests log -(`work/gate-logs/`, stamp `20261126T174230`) shows `Ran 5156 tests`, `OK (skipped=4)`; its -coverage log shows 92% total. +This session did not run the full suite or coverage. The log of the driver's latest broad run +(`work/gate-logs/`, stamps `20261126T2143`) shows `Ran 5157 tests`, `OK (skipped=4)`, and 92% +total coverage. `GATE-01.md` records that run with `ok: true` and no failing gate. ### Controls: the oracle observes the feature -Each mutation ran in a scratch copy of the package, tests and `.specfuse/` (without the -feature folders). The unmodified copy ran the 42 oracle tests: `OK`. `TestTreeAndNote` has 18 -tests; failure counts include subtests. +Each mutation ran in a scratch copy of the package, scripts, tests, docs and `.specfuse/` +(without the feature folders). The unmodified copy ran the 43 oracle tests: `OK`. | Mutation | Result | |---|---| -| `resolve_fail_fast_deliverables` forced to return `False` | 42 tests: 13 failures | -| `attempt_own_paths` returns its input unfiltered | `TestTreeAndNote`: 20 failures | -| rename pairing turned back on (`--find-renames`) | `TestTreeAndNote`: 3 failures | -| mode bits left out of `_path_state` | `TestTreeAndNote`: 2 failures | -| non-ASCII names mangled, as quoting would | `TestTreeAndNote`: 4 failures | -| attempt-start paths left out of the compared set | `TestTreeAndNote`: 10 failures | -| `check_produces_mentioned` made a no-op | `TestArmTimeWarning`, 6 tests: 2 failures (the other four expect silence) | -| `loop.py` replaced by the pre-feature one (`bd7e508` pin) | 42 tests: 12 failures, 30 errors | - -On the old driver, every failing `TestProducesNotInDiffEarly` and `TestPresenceEarly` entry is -an error, so the first mutation is the behaviour evidence for those two classes. `TestOptOut` -and `TestTreeAndNote` also fail on assertions. This is not a full pre-feature tree. +| `resolve_fail_fast_deliverables` forced to return `False` | 43 tests: 13 failures | +| note filter turned back to base names | `TestTreeAndNote`, 19 tests: 2 failures | +| parent directory no longer accepted by the lint check | `TestArmTimeWarning`, 6 tests: 1 failure | + +Earlier controls, from the sixth close and not repeated: an unfiltered `attempt_own_paths` +(20 failures), rename pairing turned back on (3), mode bits left out of `_path_state` (2), +mangled non-ASCII names (4), attempt-start paths left out of the compared set (10), a no-op +`check_produces_mentioned` (2), and the pre-feature `loop.py` (`bd7e508` pin; 12 failures and +30 errors in 42 tests). On the old driver every failing `TestProducesNotInDiffEarly` and +`TestPresenceEarly` entry was an error, so the first mutation is the behaviour evidence for +those two classes. That substitution was not a full pre-feature tree. ### Early against late, same input -These tables are earlier closes' observations. **This sixth close did not run the probe -again.** The source change named since is the path-list code, whose only caller is -`format_changed_paths` (checked by `grep`). This session reran the oracle, which holds the -`files_changed_mismatch` pair (case A) and the single-refusal pairs in `TestOptOut`. +These tables are earlier closes' observations. **Neither the sixth nor this seventh close +ran the probe again.** The source changes named since are in the path-list code, reached only +through `format_changed_paths`, whose three call sites build retry notes (checked by `grep`). +This session reran the oracle, which holds the `files_changed_mismatch` pair (case A) and the +single-refusal pairs in `TestOptOut`. The probe drove `loop.run()` over the oracle's fixture and read the first `attempt_outcome` for T01, once with fail-fast on and once off. Verification is a stub. The unit declares @@ -190,19 +215,19 @@ firing alone when every declared path is changed, and early presence refusals wi All 13 criteria were looked at again. `GATE-01-CRITERIA.md` is left as the driver seeded it, because it is not one of this unit's permitted closing surfaces. -| Criterion | Result | Evidence | +| Criterion | Result | Evidence from this session | |---|---|---| -| T01#1 | passes | `TestProducesNotInDiffEarly`; on the old driver errors only, behaviour shown by the first mutation | +| T01#1 | passes | `TestProducesNotInDiffEarly` in the oracle; first mutation. "Fails on HEAD" rests on the sixth close's old-driver run | | T01#2 | passes | `test_early_record_equals_late_record` (plain RESULT, passing stub) | | T01#3 | passes | 25 tests, `OK` | -| T02#1 | passes | `TestPresenceEarly`; on the old driver errors only, behaviour shown by the first mutation | -| T02#2 | passes | `TestOptOut`; assertion failures on the old driver | +| T02#1 | passes | `TestPresenceEarly` in the oracle; first mutation. "Fails on HEAD" as for T01#1 | +| T02#2 | passes | `TestOptOut` in the oracle | | T02#3 | passes | empty diff | -| T03#1 | passes; limits in N2 and S10 | `TestTreeAndNote` (18); assertion failures on the old driver | +| T03#1 | passes; limit: ignored files | `TestTreeAndNote` (19); lookalike probe; base-name mutation | | T03#2 | passes | `test_list_is_capped_at_twenty` | -| T04#1 | passes | `TestArmTimeWarning`; no-op control | +| T04#1 | passes | `TestArmTimeWarning`; parent-directory mutation; lint probe | | T04#2 | passes with the repository script | 97 folders, 0 non-zero exits | -| T04#3 | not observed | no close has seen T04's RESULT; the count is re-measured below | +| T04#3 | accepted under clause 5's measurement record | T04's RESULT notes were not seen by any close; `GATE-01.md` accepts the docstring (81 and 35 of 401) and the sixth judge's recount. This session's recount agrees: 81 and 35 of 402 | | T04#4 | passes | empty diff | | T04#5 | passes | prints `0` | @@ -215,8 +240,8 @@ carried forward: 0 criteria, re-measured: 13 | 1. `produces_not_in_diff` early | Refused with 0 `verify_fn` calls, `verify_seconds` 0, no attempt-phase `gate_result`; a changed path verifies once and passes; a justified path still verifies; class, signature and summary equal the late site's | `TestProducesNotInDiffEarly` (6 tests) | | 2. Presence early | Absent, empty and bookkeeping-only diffs are refused with 0 calls | `TestPresenceEarly` (3) | | 3. Opt-out | With the key `false`, each of the three cases verifies once; outcome, class, signature and summary equal the default's, for inputs that trip one refusal | `TestOptOut` (4), on plain-RESULT, passing-stub inputs; probe cases C, L, M | -| 4. Tree and note | Proven, with the by-name and ignored-file limits (N2, S10). The note says verification did not run; lists written, edited, deleted, reverted, renamed (both names), mode-changed and non-ASCII-named paths; leaves out untouched kept edits; caps at 20; the tree is kept or reset | `TestTreeAndNote` (18); probe cases R0 to R15 and S1 to S9. The kept/reset assertions use `produces_not_in_diff` only | -| 5. Arm-time WARN | Warns on an unmentioned path; silent on full path, file name or parent directory, and on `done` / `abandoned`; `lint()` calls it | `TestArmTimeWarning` (6) | +| 4. Tree and note | Proven, with the ignored-file limit. The note says verification did not run; lists written, edited, deleted, reverted, renamed (both names), mode-changed and non-ASCII-named paths, and agent files named like driver bookkeeping; leaves out untouched kept edits and the driver's own three files; caps at 20; the tree is kept or reset | `TestTreeAndNote` (19); this session's lookalike probe; sixth close's cases R0 to R15 and S1 to S9. The kept/reset assertions use `produces_not_in_diff` only | +| 5. Arm-time WARN | Warns on an unmentioned path; silent on full path, file name or parent directory (as amended, #3617), and on `done` / `abandoned`; `lint()` calls it. The measurement record is in `GATE-01.md` (#3619) | `TestArmTimeWarning` (6), including `test_parent_directory_mention_is_silent`; lint probe; recount | | 6. Nothing else changes | Holds as widened for #3609. See the list below | `diff -ru` of `tests/` against the recorded base; the ten modules pass | | Precedence over every later check | Holds on every probed pair. A test asserts only the `files_changed_mismatch` pair | `test_deliverable_refusal_outranks_files_changed_mismatch`; this session, the oracle test only; probe cases carried from the fourth and fifth closes | @@ -226,11 +251,11 @@ moved tree; an untouched tree still halts) and `TestEarlyRetainedNoteWording` (2 ## Pre-existing tests changed -This sixth close ran no git command on the repository and did not repeat the tree comparison. +This seventh close ran no git command on the repository and did not repeat the tree comparison. It listed the files under `tests/`, `specfuse/`, `scripts/`, `.specfuse/scripts/` and `docs/` -modified after the fifth close last wrote `LEARNINGS-pending.md`: only +modified after the sixth close last wrote `LEARNINGS-pending.md`: only `specfuse/loop/loop.py` and the feature's own `tests/test_fail_fast_deliverables.py` (the -#3614 fix and its tests). No pre-existing test is newer. The third, fourth and fifth closes +#3618 fix and its tests). No pre-existing test is newer. The third to sixth closes did the same kind of check, each against the close before, back to the second close's comparison, below. These are modification-time checks, not content diffs. The ten modules were rerun in this session. In the comparison text, "this session" means the second close. @@ -288,22 +313,29 @@ The third close (2026-11-26T15:45Z) recorded `met`. The judge lowered it to `not clause 4, and the driver filed #3612: the note listed an earlier attempt's kept edits as the later attempt's own. That close, like the two before it, tested "changed nothing" only on a first attempt. The fix (`snapshot_dirty_tree`, `attempt_own_paths`, three tests) was made on -the branch outside any work unit, and the operator re-armed this unit. This fourth close +the branch outside any work unit, and the operator re-armed this unit. The fourth close probed removals on a kept tree and found that deleted and reverted files were missing. The fourth close (2026-11-26T16:28Z) and the judge recorded `not_met`, and the driver filed #3613. The fix to `attempt_own_paths` and three tests were made on the branch outside any work unit, and the operator re-armed this unit. The fifth close confirmed that fix and -probed renames, non-ASCII names and a mode change. #3612, #3613 and the gaps now open are +probed renames, non-ASCII names and a mode change. #3612, #3613 and the gaps then open were all in one list, built by filtering a name-only diff; each fix so far covered the cases the previous close had named. The fifth close (2026-11-26T17:03Z) and the judge recorded `not_met`, and the driver filed #3614. The fix replaced filtering of the guard's diff with a comparison of each path's state at the start and end of the attempt, which is the first option that close recommended. It was -made on the branch outside any work unit, and the operator re-armed this unit. This sixth +made on the branch outside any work unit, and the operator re-armed this unit. The sixth close confirmed it on the whole earlier matrix and ten further cases. +The sixth close (2026-11-26T18:04Z) recorded `met`. The judge lowered it to `not_met` on three +findings, and the driver filed #3617 (clause 5 never amended for the parent directory), #3618 +(the note dropped agent files by base name; the sixth close had probed this as case N2 and +judged it acceptable, wrongly) and #3619 (T04's measurement not visible in its RESULT notes). +The operator fixed #3618 on the branch outside any work unit, amended clause 5 for the other +two, and re-armed this unit. + T04 passed although its Verification section names `tests.test_lint_plan`, which does not exist. @@ -325,30 +357,32 @@ includes its judge: `record_judge_cost_fold` adds the judge's usage to the attem | G1-CLOSE, third close | (same line) | 1.73 | 0.57 | 35% | 1 | | G1-CLOSE, fourth close | (same line) | 1.44 | 0.36 | 29% | 1 | | G1-CLOSE, fifth close | (same line) | 1.35 | 0.47 | 27% | 1 | -| G1-CLOSE, sixth close | (same line) | not yet recorded | — | — | in progress | -| G1-CLOSE, five recorded closes | 5.00 | 7.70 | 2.32 | 154% | 5 | - -Recorded unit spend is 10.37 USD against a plan of 11.00 and a gate budget of 14.00. The -close line is well past its 5.00 plan, and this session's cost and its judge's are written -later. The earlier `blocked_human` stop of this unit recorded 0.00. The independent review, -its fixes, both amendments and the #3612, #3613 and #3614 fixes happened outside the loop, -so `events.jsonl` has no cost for them. All five re-closes cost money for questions the plan -or the oracle had left open: two for an unstated precedence, then one each for #3612, #3613 -and #3614. - -**T04's warning rate.** Re-measured this session over `done` units with `produces:`: the -shipped rule (path, file name or parent directory) would fire on 35 of 402, **8.7%**, under -the 10% limit. Path or file name alone would fire on 81 of 402, 20.1%. T04 recorded 81 and -35 of 401 in the check's docstring; the population has since grown by one. T04's progress -note does not carry the count that its criterion 3 asked for in the RESULT notes. The -parent-directory match is a plain substring test, so a short directory such as `tests` is -satisfied by almost any body. The WARN is weak for such paths. +| G1-CLOSE, sixth close | (same line) | 1.66 | 0.48 | 33% | 1 | +| G1-CLOSE, seventh close | (same line) | not yet recorded | — | — | in progress | +| G1-CLOSE, six recorded closes | 5.00 | 9.36 | 2.80 | 187% | 6 | + +Recorded unit spend is 12.03 USD. That is over the plan of 11.00 (109%) and under the gate +budget of 14.00, with this session's cost and its judge's still to be written. The earlier +`blocked_human` stop of this unit recorded 0.00. The independent review, its fixes, the +amendments and the #3612, #3613, #3614 and #3618 fixes happened outside the loop, so +`events.jsonl` has no cost for them. All six re-closes cost money for questions the plan or +the oracle had left open: two for an unstated precedence, one each for #3612, #3613 and +#3614, and this one for #3617 to #3619. + +**T04's warning rate.** T04 recorded, in the check's docstring, 81 of 401 `done` units with +`produces:` for path or file name alone (20.2%) and 35 with the parent directory (8.7%). +Re-measured this session: the shipped rule would fire on 35 of 402, **8.7%**, under the 10% +limit; path or file name alone on 81 of 402, 20.1%. The population has grown by one. T04's +progress note does not carry the count. The parent-directory match is a plain substring +test, so a short directory such as `tests` is satisfied by almost any body, and a mention of +a subdirectory (`specfuse/loop/data/docs`) also silences `specfuse/loop/loop.py`. The WARN is +weak for such paths. ## Consumer-visible contract changes Pending human acknowledgment. Each has a `changelog.d/` fragment tracing to `FEAT-LOOP-2026-0251`. This close added no fragment; it corrected the retry-note one in -place, replacing the limits that #3614 fixed. +place, replacing the base-name limit that #3618 fixed. 1. **Changed:** the three deliverable refusals run before verification. They take precedence over every verification gate and later guard. An attempt that also would have failed one @@ -358,7 +392,8 @@ place, replacing the limits that #3614 fixed. 3. **Changed:** the retry note for the three refusals lists the changed paths, at most 20 plus a count. Untouched edits kept from an earlier attempt are left out; deletes, reverts, both names of a rename, mode-only changes and non-ASCII names are listed. Not - listed: git-ignored files, and files named like the driver's bookkeeping. + listed: git-ignored files, and the driver's own unit file, `events.jsonl` and + `PROGRESS.md` in the feature folder. 4. **Added:** a `specfuse lint` WARN for a `produces:` path the unit's body never mentions. ## Notes for the human reviewer @@ -376,8 +411,8 @@ None of these is a failed criterion. This unit may edit none of the files concer - **Older defect, worth its own bug.** A refused attempt that keeps its tree and has a changed file with a non-ASCII name stops the driver with `CalledProcessError`: `git_diff_names` returns git's quoted form and `git add -N` rejects it (probe R4). The - fourth close saw the pre-feature `loop.py` do the same. R4 reproduced in this close. This - close filed no issue for it, and with no open follow-up entry the driver will file none. + fourth close saw the pre-feature `loop.py` do the same. R4 reproduced in the sixth close. No + close has filed an issue for it, and with no open follow-up entry the driver will file none. - **One sentence in `docs/methodology.md` is too strong.** It says "What is refused does not change, only when." Probe case Q is an attempt that passes with the key `false` and is @@ -402,7 +437,8 @@ None of these is a failed criterion. This unit may edit none of the files concer `attempt_outcome` in `events.jsonl` before this close is `passed`. No real early refusal has happened, so no real saving in gate time is measured. - The probes stubbed the agent session, `verify`, and (for H and P) the squash rejection. -- Every early-against-late probe case, and the other observations listed as not run again. +- Every early-against-late probe case, the sixth close's path-list matrix, its crash and + non-UTF-8 probes, and the other observations listed as not run again. - A non-UTF-8 name on a real filesystem, and any run on Linux. - Submodules and nested repositories (the one nested probe crashed in `git add -A`), changes to an empty directory, `core.filemode=false`, and special files such as a named pipe. diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md index ee4acd0e..603b8b99 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md @@ -1,10 +1,11 @@ --- id: FEAT-LOOP-2026-0251/G1-CLOSE type: close -status: pending -attempts: 0 +status: done +attempts: 1 oracle_env: macos_local planned_cost_usd: 5.00 +verdict: met auto_close_disabled: true model: sonnet effort: high @@ -67,19 +68,19 @@ re_arm_history: prior_cost_usd: 1.657563 prior_duration_seconds: 747.309 reason: "Amend both as recommended, fixed bookkeeping paths, re-close it" -cumulative_cost_usd: 7.698064 -cumulative_duration_seconds: 2026.017 -cumulative_input_tokens: 280 -cumulative_output_tokens: 181754 -cumulative_attempts: 5 -cost_usd: 1.657563 -duration_seconds: 747.309 -input_tokens: 64 -output_tokens: 41536 -folded_through_re_arm: 6 +cumulative_cost_usd: 9.355627 +cumulative_duration_seconds: 2773.326 +cumulative_input_tokens: 344 +cumulative_output_tokens: 223290 +cumulative_attempts: 6 +cost_usd: 0.975064 +duration_seconds: 415.272 +input_tokens: 42 +output_tokens: 25318 +folded_through_re_arm: 7 gate_set: plannext driver_version: 0.33.2 -started_at: 2026-11-26T17:43:13.364717+00:00 +started_at: 2026-11-26T21:46:35.862369+00:00 --- # G1-CLOSE — terminal close diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index de697f57..6b9ab048 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -306,3 +306,5 @@ {"timestamp": "2026-11-26T21:46:35.372556+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "init-sh-shim-bats", "ok": true, "skipped": false, "duration_seconds": 1.564, "phase": "broad"}} {"timestamp": "2026-11-26T21:46:35.372558+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "init-skills-bats", "ok": true, "skipped": false, "duration_seconds": 0.259, "phase": "broad"}} {"timestamp": "2026-11-26T21:46:35.372563+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "hookspath-conflict-bats", "ok": true, "skipped": false, "duration_seconds": 1.217, "phase": "broad"}} +{"timestamp": "2026-11-26T21:46:35.672863+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "terminal_judge_editing_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "status": "clean", "reason": "acknowledged by operator: .specfuse/verification.yml.example, produces_driver_helper, specfuse/loop/data/verification.yml.example, specfuse/loop/lint_plan.py, specfuse/loop/loop.py"}} +{"timestamp": "2026-11-26T21:46:35.680430+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "terminal_judge_editing_acknowledged", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "close_unit": "FEAT-LOOP-2026-0251/G1-CLOSE", "paths": [".specfuse/verification.yml.example", "produces_driver_helper", "specfuse/loop/data/verification.yml.example", "specfuse/loop/lint_plan.py", "specfuse/loop/loop.py"], "reason": "Review fixes tested, full suite green, accept the generator risk"}} diff --git a/changelog.d/FEAT-LOOP-2026-0251-the-retry-note-for-the-three-deliverable.md b/changelog.d/FEAT-LOOP-2026-0251-the-retry-note-for-the-three-deliverable.md index dd2ea151..035b6931 100644 --- a/changelog.d/FEAT-LOOP-2026-0251-the-retry-note-for-the-three-deliverable.md +++ b/changelog.d/FEAT-LOOP-2026-0251-the-retry-note-for-the-three-deliverable.md @@ -2,4 +2,4 @@ class: changed trace: FEAT-LOOP-2026-0251 --- -The retry note for the three deliverable refusals now lists the paths the attempt changed (at most 20, plus a count of the rest), or says it changed none. Edits kept from an earlier attempt that this attempt did not touch are not listed; deletes, reverts, both names of a rename, mode-only changes and non-ASCII names are. Not listed: files git ignores, and files named `events.jsonl`, `PROGRESS.md` or like the unit file, in any directory +The retry note for the three deliverable refusals now lists the paths the attempt changed (at most 20, plus a count of the rest), or says it changed none. Edits kept from an earlier attempt that this attempt did not touch are not listed; deletes, reverts, both names of a rename, mode-only changes and non-ASCII names are. Not listed: files git ignores, and the driver's own unit file, `events.jsonl` and `PROGRESS.md` in the feature folder From f0dbfb45bb9853f79e83c1a7b25c1ec6cac1d090 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 17:08:31 -0500 Subject: [PATCH 67/69] chore(loop): gate 1 awaiting_review Feature: FEAT-LOOP-2026-0251 --- .../GATE-01.md | 2 +- .../events.jsonl | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md index c98dbb52..2a7fa219 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md @@ -1,6 +1,6 @@ --- gate: 1 -status: open +status: awaiting_review feature_oracle: "python3 -m unittest tests.test_fail_fast_deliverables -v -b" cost_budget_usd: 14.00 broad_run: diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index 6b9ab048..01ab6db7 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -308,3 +308,12 @@ {"timestamp": "2026-11-26T21:46:35.372563+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": null, "gate": "hookspath-conflict-bats", "ok": true, "skipped": false, "duration_seconds": 1.217, "phase": "broad"}} {"timestamp": "2026-11-26T21:46:35.672863+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "terminal_judge_editing_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "status": "clean", "reason": "acknowledged by operator: .specfuse/verification.yml.example, produces_driver_helper, specfuse/loop/data/verification.yml.example, specfuse/loop/lint_plan.py, specfuse/loop/loop.py"}} {"timestamp": "2026-11-26T21:46:35.680430+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "terminal_judge_editing_acknowledged", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "close_unit": "FEAT-LOOP-2026-0251/G1-CLOSE", "paths": [".specfuse/verification.yml.example", "produces_driver_helper", "specfuse/loop/data/verification.yml.example", "specfuse/loop/lint_plan.py", "specfuse/loop/loop.py"], "reason": "Review fixes tested, full suite green, accept the generator risk"}} +{"timestamp": "2026-11-26T21:46:35.863035+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "task_started", "source": "driver", "source_version": "0.33.2", "payload": {"type": "close", "model": "sonnet", "re_arm_count": 7}} +{"timestamp": "2026-11-26T21:46:35.863044+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "re_arm_dispatched", "source": "driver", "source_version": "0.33.2", "payload": {"re_arm_count": 7, "reason": "Amend both as recommended, fixed bookkeeping paths, re-close it"}} +{"timestamp": "2026-11-26T21:53:31.126351+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "plan-lint", "ok": true, "skipped": false, "duration_seconds": 0.135, "phase": "attempt"}} +{"timestamp": "2026-11-26T21:53:31.126383+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "gate_result", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "gate": "feature_oracle", "ok": true, "skipped": false, "duration_seconds": 34.311, "phase": "attempt"}} +{"timestamp": "2026-11-26T22:08:31.485906+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "judged", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "close_verdict": "met", "close_model": "sonnet", "judge_verdict": null, "verdict": "met", "lowered": false, "disagreed": false, "findings": 0, "reason": "the judge session timed out after 900s", "diff_base": "3bc8bef37e1903f18b2a48f78a44fb9a63600864", "diff_base_source": "merge-base of HEAD with main"}} +{"timestamp": "2026-11-26T22:08:31.486832+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "attempt_outcome", "source": "driver", "source_version": "0.33.2", "payload": {"attempt": 1, "outcome": "passed", "duration_seconds": 415.272, "agent_seconds": 380.69860966701526, "verify_seconds": 34.46391620801296, "cost_usd": 0.9750642, "input_tokens": 42, "output_tokens": 25318, "cache_read_input_tokens": 2178642, "cache_creation_input_tokens": 125984, "model": "sonnet", "effort": "high", "failure_class": null, "failure_signature": null, "failure_excerpt": null, "files_touched": [".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md", ".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/LEARNINGS-pending.md", ".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/RETROSPECTIVE.md", ".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/WU-90-gate-1-close.md", ".specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl", "changelog.d/FEAT-LOOP-2026-0251-the-retry-note-for-the-three-deliverable.md"], "agent_status": "complete", "agent_blocked_reason": null, "re_arm_count": 0, "failing_tests": []}} +{"timestamp": "2026-11-26T22:08:31.487124+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "task_completed", "source": "driver", "source_version": "0.33.2", "payload": {"attempts": 1, "attempts_usage": [{"attempt": 1, "duration_seconds": 415.272, "cost_usd": 0.9750642, "input_tokens": 42, "output_tokens": 25318, "cache_read_input_tokens": 2178642, "cache_creation_input_tokens": 125984, "agent_seconds": 380.69860966701526, "verify_seconds": 34.46391620801296}], "type": "close", "re_arm_count": 7, "cost_usd": 0.975064, "cumulative_cost_usd": 10.330691, "attempts_lifetime": 7, "planned_cost_usd": 5.0}} +{"timestamp": "2026-11-26T22:08:31.515537+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_reached", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1}} +{"timestamp": "2026-11-26T22:08:31.515523+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "arm_predicate_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "would_arm": true, "predicate_version": "v1", "classes": {"budget_projection": {"status": "clean", "reason": "projected spend $13.01 within 2.0x baseline planned total $11.00 (cap $22.00)"}, "judge_editing": {"status": "clean", "reason": "no drafted WU touches judge-path surfaces"}, "decision_class_paths": {"status": "clean", "reason": "no drafted WU touches a recognised dependency manifest (pyproject.toml, package.json, pom.xml, build.gradle, build.gradle.kts, Cargo.toml, go.mod, Gemfile, composer.json, requirements*.txt, *.csproj)"}, "retroactive_edits": {"status": "clean", "reason": "no passed-gate baseline WU altered or removed"}, "drift_caps": {"status": "clean", "reason": "added WUs and gates within drift caps"}, "missing_provenance": {"status": "clean", "reason": "no added WUs"}, "open_questions_human_only": {"status": "clean", "reason": "terminal gate: no drafted successor"}, "plan_next_lint": {"status": "clean", "reason": "plan-next lint: no findings"}}}} From 2a12fdc26dc9319284360a7f6494264bf5d55a69 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 17:08:31 -0500 Subject: [PATCH 68/69] chore(loop): FEAT-LOOP-2026-0251/G1-CLOSE terminal flips Feature: FEAT-LOOP-2026-0251 --- .../GATE-01.md | 2 +- .../PLAN.md | 2 +- .specfuse/roadmap-archive.md | 19 +++++++++++++++++++ .specfuse/roadmap.md | 13 +------------ 4 files changed, 22 insertions(+), 14 deletions(-) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md index 2a7fa219..adbeb1ec 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/GATE-01.md @@ -1,6 +1,6 @@ --- gate: 1 -status: awaiting_review +status: passed feature_oracle: "python3 -m unittest tests.test_fail_fast_deliverables -v -b" cost_budget_usd: 14.00 broad_run: diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PLAN.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PLAN.md index b6c2de52..a91152c8 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PLAN.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/PLAN.md @@ -5,7 +5,7 @@ slug: fail-fast-deliverables branch: feat/FEAT-LOOP-2026-0251-fail-fast-deliverables roadmap_goal: An attempt whose declared deliverable is missing or untouched is refused before any verification gate runs, its retry note names the files it did change, and `specfuse lint` warns before arming when a `produces:` path appears nowhere in its unit's text. autonomy_default: auto -status: active +status: done planned_cost_usd: 11.00 --- diff --git a/.specfuse/roadmap-archive.md b/.specfuse/roadmap-archive.md index f6d89575..5f8d2861 100644 --- a/.specfuse/roadmap-archive.md +++ b/.specfuse/roadmap-archive.md @@ -43,6 +43,25 @@ sections inline in `roadmap.md`. point; T02 (`roadmap-archive` skill) and T04 (migration) append after it. + +## FEAT-LOOP-2026-0251 — Refuse a missing deliverable before the verification gates run + +**Why.** Three driver refusals (`produces_not_in_diff`, `deliverable_missing`, `no_deliverable_files`) judge only the attempt's diff against `produces:`, yet run only after the full verification run has passed. An operator report measured 19 of 48 non-passing attempts (of 184) ending in one of them, and 6 of 26 escalations as `deterministic_refusal_repeat`. + +**Goal.** Those three refusals run before any verification gate (opt-out `defaults.fail_fast_deliverables: false`), their retry note lists the paths the attempt did change, and `specfuse lint` warns before arming when a `produces:` path appears nowhere in its unit's text. One gate, four units and a terminal close. + +**Out of scope.** Moving the smoke-import or closing-deliverable guards, changing repeat-refusal detection, live progress or halt notification, parallel gates or a result cache. + +**Status: done.** + +**Post-merge checklist.** + +- On the next real feature run that hits one of the three refusals, confirm its + `attempt_outcome` carries `verify_seconds: 0` and no `gate_result` events (FEAT-LOOP-2026-0250 + timings), i.e. the refusal really cost no gate run. +- In a project whose gates generate tracked files, confirm `fail_fast_deliverables: false` + restores the old order. + ## FEAT-LOOP-2026-0250 — Record verification gate results and durations diff --git a/.specfuse/roadmap.md b/.specfuse/roadmap.md index 46c4eda1..d3fa9eca 100644 --- a/.specfuse/roadmap.md +++ b/.specfuse/roadmap.md @@ -129,7 +129,7 @@ installation a target project copies via `init.sh`. | FEAT-LOOP-2026-0248 | Make `ids migrate --all` safe on a real repository | done | — | [→ archive](roadmap-archive.md#feat-loop-2026-0248) | | FEAT-LOOP-2026-0249 | Changelog fragments: stop concurrent PRs conflicting on CHANGELOG.md | done | — | [→ archive](roadmap-archive.md#feat-loop-2026-0249) | | FEAT-LOOP-2026-0250 | Record verification gate results and durations | done | `.specfuse/features/FEAT-LOOP-2026-0250-gate-timings/` | [→ archive](roadmap-archive.md#feat-loop-2026-0250) | -| FEAT-LOOP-2026-0251 | Refuse a missing deliverable before the verification gates run | active | `.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/` | [→ detail](#feat-loop-2026-0251) | +| FEAT-LOOP-2026-0251 | Refuse a missing deliverable before the verification gates run | done | `.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/` | [→ archive](roadmap-archive.md#feat-loop-2026-0251) | Status: `planned` → `active` → `done` (or `abandoned`). `deferred` = parked by choice pending an external decision/dependency; resumable (a human flips it @@ -1060,17 +1060,6 @@ So the question is no longer "how do we distil lessons" — that is built and lo **Status: planned.** - -## FEAT-LOOP-2026-0251 — Refuse a missing deliverable before the verification gates run - -**Why.** Three driver refusals (`produces_not_in_diff`, `deliverable_missing`, `no_deliverable_files`) judge only the attempt's diff against `produces:`, yet run only after the full verification run has passed. An operator report measured 19 of 48 non-passing attempts (of 184) ending in one of them, and 6 of 26 escalations as `deterministic_refusal_repeat`. - -**Goal.** Those three refusals run before any verification gate (opt-out `defaults.fail_fast_deliverables: false`), their retry note lists the paths the attempt did change, and `specfuse lint` warns before arming when a `produces:` path appears nowhere in its unit's text. One gate, four units and a terminal close. - -**Out of scope.** Moving the smoke-import or closing-deliverable guards, changing repeat-refusal detection, live progress or halt notification, parallel gates or a result cache. - -**Status: active.** - ## Notes - Correlation IDs are allocated here, sequentially per year: `FEAT-YYYY-NNNN`. From 069189c4f67e9cc64caa7b58170ddbe1f6e585ce Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 26 Nov 2026 17:08:35 -0500 Subject: [PATCH 69/69] =?UTF-8?q?chore(loop):=20FEAT-LOOP-2026-0251=20?= =?UTF-8?q?=E2=80=94=20record=20the=20follow-up=20issues=20the=20driver=20?= =?UTF-8?q?filed?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md | 2 ++ .../FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl | 1 + 2 files changed, 3 insertions(+) diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md index 74eab953..bcf21420 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/FOLLOW-UPS.md @@ -47,6 +47,8 @@ units with `produces:` gave 81 and 35 of 402. ### Resolved at earlier closes +**Tracked as #3621.** + The text below is as the sixth close wrote it. Its "this close" and "this session" mean the close named in each entry or the sixth. Where #3614 lists files named like driver bookkeeping as a limit, #3618 above has since narrowed it. diff --git a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl index 01ab6db7..d6f1f1e8 100644 --- a/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl +++ b/.specfuse/features/FEAT-LOOP-2026-0251-fail-fast-deliverables/events.jsonl @@ -317,3 +317,4 @@ {"timestamp": "2026-11-26T22:08:31.487124+00:00", "correlation_id": "FEAT-LOOP-2026-0251/G1-CLOSE", "event_type": "task_completed", "source": "driver", "source_version": "0.33.2", "payload": {"attempts": 1, "attempts_usage": [{"attempt": 1, "duration_seconds": 415.272, "cost_usd": 0.9750642, "input_tokens": 42, "output_tokens": 25318, "cache_read_input_tokens": 2178642, "cache_creation_input_tokens": 125984, "agent_seconds": 380.69860966701526, "verify_seconds": 34.46391620801296}], "type": "close", "re_arm_count": 7, "cost_usd": 0.975064, "cumulative_cost_usd": 10.330691, "attempts_lifetime": 7, "planned_cost_usd": 5.0}} {"timestamp": "2026-11-26T22:08:31.515537+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "gate_reached", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1}} {"timestamp": "2026-11-26T22:08:31.515523+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "arm_predicate_evaluated", "source": "driver", "source_version": "0.33.2", "payload": {"gate": 1, "would_arm": true, "predicate_version": "v1", "classes": {"budget_projection": {"status": "clean", "reason": "projected spend $13.01 within 2.0x baseline planned total $11.00 (cap $22.00)"}, "judge_editing": {"status": "clean", "reason": "no drafted WU touches judge-path surfaces"}, "decision_class_paths": {"status": "clean", "reason": "no drafted WU touches a recognised dependency manifest (pyproject.toml, package.json, pom.xml, build.gradle, build.gradle.kts, Cargo.toml, go.mod, Gemfile, composer.json, requirements*.txt, *.csproj)"}, "retroactive_edits": {"status": "clean", "reason": "no passed-gate baseline WU altered or removed"}, "drift_caps": {"status": "clean", "reason": "added WUs and gates within drift caps"}, "missing_provenance": {"status": "clean", "reason": "no added WUs"}, "open_questions_human_only": {"status": "clean", "reason": "terminal gate: no drafted successor"}, "plan_next_lint": {"status": "clean", "reason": "plan-next lint: no findings"}}}} +{"timestamp": "2026-11-26T22:08:35.401582+00:00", "correlation_id": "FEAT-LOOP-2026-0251", "event_type": "followups_recorded", "source": "driver", "source_version": "0.33.2", "payload": {"filed": 1, "unfiled": 0, "already_tracked": 0, "issue_numbers": ["3621"], "written_back": ["FOLLOW-UPS.md"]}}