Repository navigation
Add reproducible PR review loop + enforce merge gate on land #59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 15 commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
94d39c7
feat(permissions): include allow-rule hints for blocked commands
wren-nutthouse f4bb813
style: format permissions CLI output changes
wren-nutthouse 960b55c
fix: make wildcard hint helper internal
wren-nutthouse 6338dfc
feat(automation): enforce PR merge gate for land steps
wren-nutthouse b4700e5
style: format merge-gate automation changes
wren-nutthouse c8cfff8
fix: address CodeRabbit review comments on PR #59
nutt-adam 2a9f4cf
ci: retrigger CI checks
nutt-adam 215d932
fix: stabilize sdlc-auto dogfood loop for clean unattended runs
nutt-adam 2786d05
feat: milestone filter, worktree preservation, and runtime detection …
nutt-adam e66d91f
refactor: centralize TT_ENFORCE_MERGE_GATE env var constant
nutt-adam 5e04b51
merge: resolve conflicts with main
nutt-adam 300677e
fix: address CodeRabbit review comments on PR #59 (round 2)
nutt-adam aa011c8
fix: address CodeRabbit review comments on PR #59 (round 3)
nutt-adam a6bf28c
fix: add timeouts to git subprocess calls in write_implement_result.py
nutt-adam b712479
fix: use explicit UTF-8 encoding for file I/O in write_implement_resu…
nutt-adam 072af0b
merge: resolve conflicts with main after PR #71 merge
nutt-adam 5bc0762
fix: address CodeRabbit review comments on PR #59 (round 4)
nutt-adam 5c8d962
fix: address CodeRabbit review comments on PR #59 (round 5)
nutt-adam b81e59c
Merge branch 'main' into wren/pr-review-loop-merge-gate
nutt-adam 7c083b8
fix: address all remaining CodeRabbit review comments on PR #59
nutt-adam File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| # PR Review Loop ("Choir" Reproducibility) | ||
|
|
||
| This is the exact merge loop for Tutti automation. | ||
|
|
||
| ## Objective | ||
|
|
||
| Make PR handling deterministic: | ||
| 1. Resolve CodeRabbit threads. | ||
| 2. Let CodeRabbit auto re-review after push. | ||
| 3. Wait for required checks to be green. | ||
| 4. Confirm approvals are present. | ||
| 5. Merge/land only after gates pass. | ||
|
|
||
| ## Canonical loop | ||
|
|
||
| 1. Open or update PR from the issue branch. | ||
| 2. Wait for CodeRabbit feedback (`wait_and_collect_coderabbit.py`). | ||
| 3. Apply actionable feedback and push. | ||
| 4. Repeat until no unresolved feedback remains. | ||
| 5. Run final validation (`cargo test --quiet` + reviewer packet). | ||
| 6. **Before `land`/merge, enforce merge gate**: | ||
| - Required checks must be green. | ||
| - PR review threads must all be resolved (including CodeRabbit threads). | ||
| 7. Merge/land. | ||
|
|
||
| ## Enforcement | ||
|
|
||
| Automation land steps now run with: | ||
|
|
||
| - `TT_ENFORCE_MERGE_GATE=1` | ||
|
|
||
| When enabled, `tt land` fails closed if: | ||
| - no open PR exists for the landed branch, | ||
| - any required check is not green, | ||
| - any PR review thread remains unresolved. | ||
|
|
||
| ## Notes | ||
|
|
||
| - CodeRabbit re-review is push-triggered; do not manually force review unless required. | ||
| - Keep this gate in automation even if humans occasionally merge manually. | ||
| - If a gate fails, fix the PR state and rerun the land step. |
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| #!/usr/bin/env bash | ||
| set -euo pipefail | ||
|
|
||
| # Verify that an agent worktree has a clean baseline matching branch.json. | ||
| # Usage: verify_clean_baseline.sh [branch_json_path] | ||
|
|
||
| # Safety: must be in an agent worktree | ||
| TOPLEVEL=$(git rev-parse --show-toplevel) | ||
| case "$TOPLEVEL" in | ||
| */.tutti/worktrees/*) ;; | ||
| *) echo "FATAL: verify_clean_baseline.sh must run inside an agent worktree, not $TOPLEVEL" >&2; exit 1 ;; | ||
| esac | ||
|
|
||
| # Resolve branch.json — try argument as-is, then relative to project root | ||
| BRANCH_JSON="${1:-.tutti/state/auto/branch.json}" | ||
| if [ ! -f "$BRANCH_JSON" ]; then | ||
| ROOT=$(dirname "$(git rev-parse --git-common-dir)") | ||
| BRANCH_JSON="$ROOT/$BRANCH_JSON" | ||
| fi | ||
| if [ ! -f "$BRANCH_JSON" ]; then | ||
| echo "FATAL: branch.json not found at $BRANCH_JSON" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| BASE_SHA=$(python3 -c "import json; print(json.load(open('$BRANCH_JSON'))['base_sha'])") | ||
|
coderabbitai[bot] marked this conversation as resolved.
Resolved
|
||
| HEAD_SHA=$(git rev-parse HEAD) | ||
|
|
||
| if [ "$HEAD_SHA" != "$BASE_SHA" ]; then | ||
| echo "FATAL: HEAD ($HEAD_SHA) != base_sha ($BASE_SHA)" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| DIRTY=$(git status --porcelain) | ||
| if [ -n "$DIRTY" ]; then | ||
| echo "FATAL: worktree not clean:" >&2 | ||
| echo "$DIRTY" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| echo "Baseline verified: HEAD=$HEAD_SHA, clean=true" | ||
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
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.