mirror of
https://github.com/rennf93/roboco.git
synced 2026-08-03 07:23:24 +02:00
[fix] submit_root: hard unchanged-PR gate stops the pr_fail re-submit loop
The 2026-06-27 infinite pr_fail loop: a Main-PM root (PR #139) was pr_fail'd, routed to needs_revision, and re-submitted byte-identical → awaiting_pr_review → pr_fail again, forever. The prior hint/a2a steer was ignored by the weak coordinator model — hints don't stop a model that won't read them. A HARD gate refuses the re-submit when the assembled root PR's head SHA is unchanged since the last pr_fail (no new cell work → identical diff); a different SHA ⇒ the branch advanced ⇒ allow. Every ambiguous case fails open (no prior fail, no recorded SHA, no pr_number, unresolvable slug, git error, closed PR) — only the exact-unchanged case is hard-blocked. - content/models: PrReviewContent.head_sha (optional; JSON col → no migration). - git: get_pr_head_sha (GitHub pulls API; None on any failure → fail-open). - pr_gate: pr_fail captures head_sha into the verdict record; pr_pass does not. - _impl: submit_root runs _submit_root_unchanged_pr_guard after _submit_up_guard; _current_root_pr_head_sha resolves slug + current SHA (fail-open). - pr_review: extract module-level resolve_task_project_slug, shared by the mixin and the gate helper (_LegacyChoreographer reaches it via cast to the ChoreographerHelpers typed view — it doesn't inherit the helpers mixin). - tests: test_submit_root_unchanged_pr_guard (11 — refuse/allow/6 fail-open/3 capture-side, mypy-clean via cc:Any spy idiom, zero type:ignore) + test_pr_gate_notifies_pm capture-path stub.
This commit is contained in:
@@ -63,6 +63,14 @@ def _stub_gate_path(
|
||||
)
|
||||
)
|
||||
c._gate_tracing = AsyncMock(return_value=None) # type: ignore[method-assign]
|
||||
# These tests exercise the pr_fail a2a / notify path, not the head-sha
|
||||
# capture (which has its own suite in test_submit_root_unchanged_pr_guard).
|
||||
# Stub the capture so it does not walk the mock session into un-awaited
|
||||
# coroutines; the verdict still lands via the _record_gate_verdict spy.
|
||||
# Alias to ``Any`` so this addition needs no type:ignore (mypy doesn't flag
|
||||
# attribute assignment on ``Any``; avoids ruff B010's no-setattr rule too).
|
||||
cc: Any = c
|
||||
cc._capture_pr_head_sha = AsyncMock(return_value=None)
|
||||
c._record_gate_verdict = MagicMock() # type: ignore[method-assign]
|
||||
c._post_gate_review_to_pr = AsyncMock() # type: ignore[method-assign]
|
||||
runner = MagicMock()
|
||||
|
||||
Reference in New Issue
Block a user