Skip to content

fix(#488): prevent loop phase retry misclassification as cold-start - #489

Merged
admarble merged 2 commits into
mainfrom
feature/488-quality-loop-retry-misclassification
Apr 6, 2026
Merged

admarble merged 2 commits into
mainfrom
feature/488-quality-loop-retry-misclassification

Conversation

@admarble

@admarble admarble commented Apr 6, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Skip cold-start retry loop for loop phase — failures at 47-51s are genuine skill failures, not initialization issues
  • Skip MCP fallback for loop phase — MCP is never the cause of loop failures
  • Enrich loop prompt with QA findings (verdict, gaps, suggestions, output tail) so /loop skill has context directly
  • Pass SEQUANT_LAST_VERDICT and SEQUANT_FAILED_ACS env vars for additional skill context
  • Add promptContext field to ExecutionConfig for phase-specific prompt enrichment

AC Coverage

AC Status
/loop receives QA findings directly (verdict + gaps) MET
Quality loop retry failures (47-51s) not misclassified as cold-start MET
Wasted Claude Code spawns reduced from 9+ to ≤1 per quality loop iteration MET
MCP fallback does not trigger for non-MCP failures MET
Quality loop can actually fix issues when ACs are unmet MET (via enriched prompt)

Test plan

  • Build passes (tsc --noEmit)
  • 72/72 phase-executor tests pass (68 existing + 4 new)
  • New test: loop phase skips cold-start retries (single attempt only)
  • New test: loop phase skips MCP fallback
  • New test: loop phase returns success on first attempt
  • New test: getPhasePrompt appends promptContext
  • Scope: 4 files, +211/-26 lines — all on-topic

Fixes #488

Loop phase failures (47-51s) were misclassified as cold-start failures,
triggering 2 cold-start retries + 1 MCP fallback = 3 wasted spawns per
loop invocation. For a 3-iteration quality loop, that's 9+ doomed spawns.

Changes:
- Skip cold-start retry loop for `loop` phase (single attempt only)
- Skip MCP fallback for `loop` phase (MCP is never the cause)
- Enrich loop prompt with QA findings (verdict, gaps, suggestions, output)
  so the /loop skill has context without reconstructing from GitHub
- Pass SEQUANT_LAST_VERDICT and SEQUANT_FAILED_ACS env vars to skills
- Add promptContext field to ExecutionConfig for phase-specific context

Fixes #488
Add 6 unit tests for buildLoopContext covering verdict, gaps, suggestions,
error, output truncation, and minimal result edge cases. Export function
with @internal annotation for testability. Add CHANGELOG entry for the
quality loop retry fix.

Entire-Checkpoint: 00a98ce12944
@admarble
admarble merged commit b183995 into main Apr 6, 2026
3 of 5 checks passed
@admarble
admarble deleted the feature/488-quality-loop-retry-misclassification branch April 6, 2026 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Quality loop retries misclassified as cold-start failures, wasting retry budget

1 participant