haiku-method icon indicating copy to clipboard operation
haiku-method copied to clipboard

Framework stuck in a degenerate loop

Open joshampton opened this issue 7 months ago • 2 comments

Getting stuck after reviewing and approving the same thing multiple times via the UI:

The framework is in a degenerate loop:
1. Pre-execute review passes → execute → review → adversarial reviewers find ~5-9 new findings each cycle
2. Even after fixing/rejecting everything, the gate phase tries to merge inception → main
3. The merge conflicts on state.json (inception has it as completed, main has it as active from a prior reset guard)
4. I resolve manually, retry, but haiku_run_next responds with revisited — fully resetting state.json back to elaborate
5. The gate "Review UI and elicitation both failed" suggests the framework is trying to ask the user for approval through a review UI that isn't reachable here

Each adversarial review wave finds new spec/doc nitpicks because the units are ~150 lines of spec text — there's always something a reviewer can flag. The two human-authored FBs (FB-12, FB-26) also can't be
closed by agents.

Recommendation: stop the inception loop and pursue one of:

1. Run /haiku:gate-review or open the framework's review UI — the gate is waiting on an explicit human approve/reject signal that I can't synthesize.
2. Mark stage complete manually via direct file edit to state.json + haiku_intent_get/set pattern.
3. Skip inception, jump to design by manually setting active_stage in intent.md (the orchestrator already attempted this — there's an unstaged active_stage: design change in the working tree).

I've stopped calling haiku_run_next to avoid further cycles. State as of now: 35 FBs total, 21 closed by fix-loop, 8 rejected, 4 are user-question type stuck in answered state. All 4 unit specs are completed
and reviewed; 4 real spec bugs (FB-31/33/34/35) are now fixed.

Running /haiku:gate-review:

haiku_review reports "No changes detected" — the diff base is origin/haiku/remove-req-favorites-as-groups-flag/inception (same branch we're on, so nothing to compare). Local commits are already in.

The gate-review skill in this version (1.105.21) is for ad-hoc code review of unmerged changes, not for breaking the gate-merge-conflict cycle we're stuck in. It can't synthesize the human-approval signal the
framework's review-UI gate is waiting on.

The merge conflict + revisit cycle continues to be the actual blocker. Options that would actually break it:

1. haiku_review_open — opens the framework's browser review UI; blocks until you click Done/Request Changes there.
2. Manually edit state.json on main to match inception's completed/gate state and force-push, bypassing the merge.
3. Skip ahead to design via direct intent.md edit (active_stage: design, which is already pending unstaged).

Want me to try haiku_review_open (option 1)? It will open a browser tab for you to approve the gate, and unblock the framework cleanly.

Running haiku_review_open:

[4:14 PM]Ad-hoc review (Done) doesn't advance workflow state — and the framework just rolled state.json all the way back to phase: elaborate, visits: 0 again, asking for haiku_decision_record again. The cycle so far
has been:

1. record no_decisions=true → pre-execute review (clean) → execute → review → adversarial reviewers find new findings → revisit
2. resolve/reject all FBs → elaboration_insufficient → record no_decisions=true → ... and so on
3. Even when we reach the gate, it merge-conflicts and triggers another revisit

The haiku_review_open ad-hoc UI explicitly says it "never mutates workflow engine state on its own" — so it can't break this cycle. The actual gate-approval review UI is what haiku_run_next tries to launch
internally, and that's what's failing with "Review UI and elicitation both failed."

I haven't called haiku_run_next again to avoid burning more cycles — we'd just go through pre-execute → execute → adversarial review and find a new batch of nitpicks.

At this point I think the cleanest path forward is to escape the framework loop manually. The 4 unit specs are good (35 FBs total processed, 4 real bugs fixed in the latest pass). What we actually want is:
inception complete, advance to design, retain unit specs as the implementation plan.

Suggested escape:

1. Edit state.json on inception branch to status: completed, phase: gate, gate_outcome: advanced (it was already this before the last revisit reset).
2. Commit.
3. Switch to main branch, fast-forward merge from inception (will succeed — no concurrent edits to state.json this time).
4. Push the unstaged intent.md change (active_stage: design) on inception branch + main.
5. Call haiku_run_next once on the design stage — it should pick up cleanly.

Want me to execute that escape, or try haiku_run_next one more time to see if the framework somehow recovers?

Taking the suggested escape at this point fixed the issue.

joshampton avatar Apr 30 '26 13:04 joshampton

Looks like every symptom in this report has been addressed in releases after 1.105.21:

Symptom Fix Shipped
haiku_run_next returns revisited, resets to elaborate after FBs resolved #266 — pre-tick dispatches stage_revisit FBs outside gate phase instead of re-popping review v1.105.22
Gate tries to merge / re-emits gate_review while pending feedback exists; "Review UI and elicitation both failed" #275 — drops human-only filter; countOpenFeedbackForGateCheck guards every gate_review emit site v1.106.2
Human-authored FBs (FB-12, FB-26) can't be closed by agents #275 — agents now address feedback regardless of author v1.106.2
Adversarial review finds 5-9 new spec/doc nitpicks every cycle #281 (elaborator drafts with review-agent lenses inlined) + #283 (pre-elaboration upstream reconciliation + unit-write validators) v2.0.1 / v2.1.0
haiku_revisit rewinds all the way to elaborate #274 — haiku_revisit removed; revisit goes through a feedback file with resolution: stage_revisit routed via pre-tick v2.0.0

Latest is v2.2.0. @joshampton can you upgrade and retry? If the loop reproduces on 2.2.0 we'll dig back in — otherwise we'll close this out.

jwaldrip avatar Apr 30 '26 13:04 jwaldrip

I can't really retry this exact case, but I am updated to the latest haiku:

  ❯ haiku@haiku
    Version: 2.2.0
    Scope: project
    Status: ✔ enabled

I think we can plan to close this in a relatively short timeframe if we don't encounter the issue again.

joshampton avatar Apr 30 '26 13:04 joshampton