Skip to content

feat: review cycle circuit breaker with configurable max iterations - #288

Merged
bamdadd merged 1 commit into
mainfrom
feat/review-circuit-breaker
Apr 7, 2026
Merged

feat: review cycle circuit breaker with configurable max iterations#288
bamdadd merged 1 commit into
mainfrom
feat/review-circuit-breaker

Conversation

@bamdadd

@bamdadd bamdadd commented Apr 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • Replace hard-coded MAX_REVIEW_CYCLES=5 with configurable per-project max_review_cycles (default 3) on Project dataclass
  • When the review cycle limit is hit, force-approve and raise a PR instead of silently closing the pipeline — ensures code is always visible for human review
  • PR body includes a :warning: Review Circuit Breaker section when the breaker trips
  • Audit event review_circuit_breaker_tripped emitted for notification/guardrail rules
  • Circuit breaker state tracked in ThreadWorkflowState (max_review_cycles, review_circuit_breaker_tripped)
  • setup_workspace resolves per-project max from project store

Changes

  • packages/domain/src/lintel/domain/types.py — add max_review_cycles field to Project
  • packages/workflows/src/lintel/workflows/feature_to_pr.py_resolve_max_review_cycles(), force-approve on trip
  • packages/workflows/src/lintel/workflows/change_request.py — use configurable max
  • packages/workflows/src/lintel/workflows/builtins.py — use configurable max, force-approve
  • packages/workflows/src/lintel/workflows/state.py — add max_review_cycles, review_circuit_breaker_tripped
  • packages/workflows/src/lintel/workflows/nodes/review.py — detect trip, emit audit event
  • packages/workflows/src/lintel/workflows/nodes/close.py — add warning section to PR body
  • packages/workflows/src/lintel/workflows/nodes/setup_workspace.py — read from project store

Test plan

  • test_circuit_breaker_force_approves_at_limit — verifies force-approve at max cycles
  • test_circuit_breaker_respects_per_project_max — per-project override works
  • test_revises_when_under_per_project_max — higher max allows more cycles
  • test_resolve_max_review_cycles — default, override, string coercion
  • test_includes_warning_when_tripped — PR body contains circuit breaker warning
  • test_no_warning_when_not_tripped — no warning in normal flow
  • test_review_decision_respects_per_project_max (change_request graph)
  • All 37 existing + new tests pass

🤖 Generated with Claude Code

Instead of closing the pipeline when the review cycle limit is hit,
the circuit breaker now force-approves so a PR is still raised for
human review. The max review cycles are configurable per-project via
Project.max_review_cycles (default 3). When the breaker trips, the PR
body includes a warning section, and an audit event is emitted for
notification rules.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@bamdadd
bamdadd force-pushed the feat/review-circuit-breaker branch from c2c7858 to fbaea67 Compare April 7, 2026 17:14
@bamdadd
bamdadd merged commit c3bd298 into main Apr 7, 2026
3 checks passed
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.

1 participant