Automation: CodeRabbit-Hard-Gate, Remark-lint und verzögerte Reparatur - #44
Conversation
📝 WalkthroughWalkthroughThe PR adds blocking Remark-lint and CodeRabbit gates, deterministic merge/repair policy evaluation, stricter automation prompts and status handling, trusted workflows, documentation updates, and regression tests covering the new policy behavior. ChangesMerge and review enforcement
Estimated code review effort: 4 (Complex) | ~60 minutes Sequence Diagram(s)sequenceDiagram
participant Watcher
participant merge_repair_policy.py
participant review_gate.py
participant GitHub
participant Remark
Watcher->>merge_repair_policy.py: evaluate PR timing and gate states
Watcher->>review_gate.py: check current-head CodeRabbit gate
review_gate.py->>GitHub: fetch signals, threads, and comments
GitHub-->>review_gate.py: return review state
Watcher->>Remark: run changed-Markdown lint
Remark-->>Watcher: return blocking lint result
Watcher-->>GitHub: select wait, repair, ready, or merge action
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
scripts/review_gate.py (1)
265-291: 🔒 Security & Privacy | 🟠 Major | ⚡ Quick winRestrict disruption-resolution markers to trusted PR commenters.
evaluate_gate()parsesDISAGREEMENT_RESOLVED_REfrom every/issues/:number/commentsbody without checking the commenting user’s identity, while resolved review threads are already filtered by CodeRabbit comment authors. Any account able to approve a PR can post a fake marker and close a documented unresolved agent–CodeRabbit disagreement, clearing a requireddisagreementgate failure.🛡️ Suggested author allow-list check
for comment in comments: body = str(comment.get("body") or "") raw_created = str(comment.get("created_at") or "") if not raw_created: continue + author = str(_mapping(comment.get("user")).get("login") or "") + if not TRUSTED_MARKER_AUTHOR_RE.search(author): + continue created = datetime.fromisoformat(raw_created.replace("Z", "+00:00"))🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@scripts/review_gate.py` around lines 265 - 291, Update the comment-processing logic in evaluate_gate() so DISAGREEMENT_RESOLVED_RE markers are recorded only when the comment author belongs to the trusted CodeRabbit commenter allow-list used for review-thread filtering. Keep disagreement markers processed as currently, and ensure untrusted commenters cannot resolve entries in resolutions or clear disagreement_open.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@scripts/review_gate.py`:
- Around line 233-247: Update the CodeRabbit state classification around the
successful and pending sets so only “success” counts as a passing review; remove
“neutral” and “skipped” from successful and classify them according to the
existing incomplete/failure policy, preserving the current handling for missing
and actively pending states.
In `@scripts/validate_prompt_baselines.py`:
- Around line 135-145: Update report generation in main so OSError from
report.parent.mkdir or report.write_text is caught and a warning is logged,
while the existing validation errors remain printed and the intended nonzero
validation exit code is always preserved. Keep successful report writing
unchanged and scope the handling to diagnostic-report creation.
---
Outside diff comments:
In `@scripts/review_gate.py`:
- Around line 265-291: Update the comment-processing logic in evaluate_gate() so
DISAGREEMENT_RESOLVED_RE markers are recorded only when the comment author
belongs to the trusted CodeRabbit commenter allow-list used for review-thread
filtering. Keep disagreement markers processed as currently, and ensure
untrusted commenters cannot resolve entries in resolutions or clear
disagreement_open.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: c1c7e777-0c04-48ce-9c88-bf122e87001e
📒 Files selected for processing (12)
CHANGELOG.mdCONTRIBUTING.mdWARTUNG.mdautomation/prompt-baselines.jsonprompts/MERGE-AUTOMATION-PROMPT.mdprompts/PR-REPAIR-PROMPT.mdscripts/merge_repair_policy.pyscripts/review_gate.pyscripts/validate_prompt_baselines.pytests/test_merge_repair_policy.pytests/test_review_gate.pytests/test_review_policy_files.py
🚧 Files skipped from review as they are similar to previous changes (6)
- CHANGELOG.md
- automation/prompt-baselines.json
- WARTUNG.md
- scripts/merge_repair_policy.py
- prompts/MERGE-AUTOMATION-PROMPT.md
- prompts/PR-REPAIR-PROMPT.md
Ziel
Implementiert die neue Merge-/Repair-Policy für automatische Einheiten-PRs.
Verbindliche Änderungen
npm cials reproduzierbarer blockierender Check ausgeführt.max(PR-Erstellung + 2 Stunden, 20:00 Uhr Europe/Berlin am Erstellungstag).Technische Komponenten
scripts/merge_repair_policy.pyscripts/review_gate.pyscripts/remark_lint.mjs.github/workflows/coderabbit-hard-gate.yml.github/workflows/remark-lint.ymlZusätzliche Härtung nach Review
queued,in_progress,neutralundskippedkönnen das Gate nicht bestehen.page-Parameter statt des mehrdeutigen Teilstringspage=1inper_page=100; dadurch kann die Validierung nicht mehr in einer künstlichen Endlosschleife hängen.Sicherheit
Die Gate-Implementierung wird im
pull_request_target-Kontext ausschließlich aus dem vertrauenswürdigenmainausgecheckt. Schreibende Tokens werden dort nicht verwendet. Dieser PR verändert Workflows, Prompts, Tests und Buildabhängigkeiten und muss deshalb bewusst manuell geprüft werden.Status
feat/hard-review-repair-policyac96d910e4131a9c05c5273900082073c8cddcb2main:93c8c02d263ec123c1c271caf0d2deaa76760ccb<!-- manual-merge-required -->verboten