fix(loop): WS-B — don't trap the model in the hollow-app state (completion-phase flag)#148
Merged
Conversation
…tion-class errors) Reproduced in THREE live builds (build3/4/5): the model reaches ~1 error where the remaining error clears ONLY by adding code — an unused i18n key it declared (i18n-locale-keys-used), an unreachable feature (reachability), or the hollow-app judge. WS-B locked that hollow state as the near-green best; when the model then made the completeness-guard-DEMANDED CRUD-UI edit (form + buttons + toasts to wire the keys), the count transiently spiked (1→22/27/37) and count-only shouldRollback REVERTED the legitimate completion work back to the list-only page. The model re-did it → sprayed → reverted again (bounded to 3, then confused: 'I changed these but they got reverted'). Fix: classify completion-class errors (isCompletionClass / allCompletionClass, pure + unit-tested) and, in nearGreenCheckpointStep, when EVERY remaining error is completion-class, CLEAR any checkpoint and don't capture — the model must add code, so a transient spike from that is progress, not a spray. Clearing (not just skipping) also drops an earlier compile-state checkpoint so the spray isn't reverted to that either. WS-B resumes normally once errors are fixable-in-place again (a mixed state with any fixable error still checkpoints). settleGate integration test + pure-fn tests; existing WS-B loop/rollback behavior unchanged (non-completion errors).
… judge (panel findings) Panel found #61 (suppress rollback for a hollow completion state) was INCOMPLETE and too broad: - nearGreenBanner ALSO traps: at near-green it tells the model 'smallest change, do NOT create files, add features/routes' — the exact opposite of what a completion-class error (wire i18n keys → build the create/edit/delete UI) requires. Now when every remaining error is completion-class, the banner flips to 'BUILD the missing UI; the count will rise as you add files — that's progress, not a regression to undo'. So both levers (rollback + banner) stand down together for a genuine completion state. - 'judge' DROPPED from completion-class: the quality judge can reject defects in EXISTING code (fixable in place), so it's not a reliable add-only signal and would falsely disable WS-B. Kept reachability + i18n-locale-keys-used (add-only in this stack; the i18n-destructive-delete guard forbids the removal shortcut). Clearing the checkpoint at a completion state is safe: the fixable errors it protected are already resolved (the current state has none), so it is stale. Tests: banner completion cases + judge-excluded; existing WS-B loop/banner behavior unchanged for fixable errors.
… (panel round 2) The panel showed the prior #61 fix was still incomplete: nearGreenRollbackStep runs BEFORE the checkpoint clear, and both the rollback and the 'undo' banner keyed on a PER-CYCLE all-completion check — which flips false the instant the model starts adding the demanded UI (the spike is MIXED: new compile errors + the shrinking i18n error). So rollback re-armed and the banner reverted to REGRESSION/UNDO mid-add — the same thrash. Fix: a PERSISTENT state.completionPhase flag, advanced once at the top of settleGate via nextCompletionPhase(prev, errors): ENTER when all errors are completion-class, STAY while ANY completion error remains (the whole spike), EXIT when none remain (wiring done → WS-B re-engages) or green. While set: nearGreenRollbackStep returns early (no revert), the banner says 'build it', and checkpointStep clears/skips. Reset at the drive boundary. Pure nextCompletionPhase + a spike-suppression integration test (6 mixed errors past the threshold → 0 rollbacks, phase held, file not reverted). 31 near-green tests green.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
WS-B's near-green checkpoint was reverting the model's legitimate completion work (building the create/edit/delete UI the completeness guards demand) as if it were a spray — reproduced in 3 live builds (1→22/27/37 error spike → rollback → thrash).
Fix
A persistent
completionPhaseflag: ENTER when every remaining error is completion-class (unused i18n keys / not reachable — clear only by ADDING code), STAY through the mixed-error spike as the model wires the UI, EXIT when no completion error remains or green. While set: no rollback, the near-green banner flips from 'don't create files' to 'build the missing UI', and no checkpoint is captured.judgeexcluded (can reject existing code). PureisCompletionClass/nextCompletionPhase+ settleGate integration tests; 31 near-green tests green; existing WS-B behavior unchanged for fixable errors.Reviews
3 panel rounds (banner-contradiction + judge-breadth + spike-persistence findings all addressed). Live capstone (build7) pending an OrbStack restart.