Skip to content

Add Concurrent CI Review Gate#143

Draft
danchild wants to merge 25 commits into
forge-sdlc:mainfrom
danchild:feat/concurrent-ci-review-gate
Draft

Add Concurrent CI Review Gate#143
danchild wants to merge 25 commits into
forge-sdlc:mainfrom
danchild:feat/concurrent-ci-review-gate

Conversation

@danchild

Copy link
Copy Markdown
Contributor

All machine and humans to review PR at the same time

@danchild
danchild force-pushed the feat/concurrent-ci-review-gate branch from 30c8e82 to 6daf65b Compare July 13, 2026 19:17
@eshulman2 eshulman2 added enhancement New feature or request area:workflow Workflow graphs, orchestration, state, routing, and gates ci Continuous integration, checks, and CI repair flows work in progress labels Jul 16, 2026
@danchild
danchild force-pushed the feat/concurrent-ci-review-gate branch 3 times, most recently from ab8f34a to 6e6459f Compare July 23, 2026 19:32
On first implementation run, workspace_setup creates the branch locally
but never pushes it. pull_rebase then fails trying to rebase onto a
non-existent remote ref, exhausting all 3 retries and blocking the
workflow. Guard the rebase with the existing remote_branch_exists check.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@danchild
danchild force-pushed the feat/concurrent-ci-review-gate branch from 6e6459f to 4fc89db Compare July 23, 2026 20:16
danchild and others added 20 commits July 23, 2026 16:19
The prepare_workspace exception handler set last_error but never
incremented retry_count, so the routing function's retry_count >=
max_retries check never triggered — causing an unbounded retry loop.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Adds a test that starts with retry_count=1 and asserts it becomes 2
after a prepare_workspace failure, ensuring the routing function can
break the loop after max_retries.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
prepare_workspace() defaulted to remote="fork" unconditionally, but on
first implementation (before PR creation) the clone only has "origin".
This caused git fetch fork to fail, falling back to recreation which
also failed due to missing fork_owner/fork_repo state — triggering the
retry loop.

Now determines the effective remote based on whether fork state exists,
and raises directly on origin sync failures instead of attempting the
impossible fork recreation path.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Three new tests for the no-fork-state paths:
- uses "origin" remote when fork_owner/fork_repo are not set
- raises directly on origin sync failure instead of attempting fork recreation
- raises ValueError when workspace is missing and fork is not configured

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… wait_for_ci_gate

- Create src/forge/prompts/v1/ci-attribution.md with attribution prompt
- Rewrite attempt_ci_fix: Phase 0 runs attribution container before Phase 1;
  external failures return ci_status="external_failure" without incrementing
  ci_fix_attempt; all paths set pending_ci_event=False; return target changed
  from wait_for_ci_gate to human_review_gate throughout
- Delete wait_for_ci_gate function from ci_evaluator.py
- Remove wait_for_ci_gate from nodes/__init__.py (graph builders updated in Task 6)
- Add 4 new attribution tests to test_ci_attribution.py

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…odes/edges

- Replaced duplicated CI/review node and edge declarations in all three workflow graphs
  (feature, bug, task_takeover) with shared add_post_pr_nodes() and add_post_pr_edges()
- Updated backward compat mapping: wait_for_ci_gate -> ci_evaluator (was human_review_gate)
- Fixed tests to reflect wait_for_ci_gate deletion and new routing
- Updated rebase_pr edges to remove wait_for_ci_gate from all three graphs
- Added rebase_pr support to task_takeover workflow (previously missing)
…gate

pr_creation and implement_review still routed to the deleted node;
update them and fix tests that expected ci_evaluator for backward compat.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ing_ci_event

Update the worker to accept CI webhooks (check_run/check_suite) when
current_node is human_review_gate, setting pending_ci_event=True so
route_human_review can route to ci_evaluator. Remove wait_for_ci_gate
from _CI_STAGES and _signal_required_nodes, add human_review_gate to
_CI_STAGES so /forge skip-gate commands work at the new pause point.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Verify routing logic (route_human_review, _route_ci_evaluation) and
graph compilation for all three workflow types after the DRY refactor.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
… leak

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- _route_after_pr_creation is imported in other modules, so
  semantically, it should not be prepended with a _
danchild and others added 4 commits July 23, 2026 16:21
- Set ci_status="passed" when attempt_ci_fix has no failed checks to
  prevent human_review_gate from hanging without a wake signal
- Route "no_prs" to escalate_blocked instead of human_review_gate to
  avoid indefinite pause when no PRs exist
- Remove unreachable ci_fix_attempt limit guard in attempt_ci_fix
  (already enforced by evaluate_ci_status)
- Remove stale imports and test classes for functions moved to post_pr
- Delete duplicate @pytest.mark.parametrize block causing cartesian
  product of ~800 nonsensical test cases
- Remove trailing whitespace in worker.py

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@danchild
danchild force-pushed the feat/concurrent-ci-review-gate branch from 4fc89db to 5dc629f Compare July 23, 2026 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:workflow Workflow graphs, orchestration, state, routing, and gates ci Continuous integration, checks, and CI repair flows enhancement New feature or request work in progress

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants