feat: harden PR queue reconciliation against stale/conflicting state (#166)

- Add updated_at (list_prs), + merged_at/merge_commit_sha/closed_at/updated_at (view_pr) for staleness detection in tool output and inventory.
- Surface updated_at in gitea_review_pr inventory report.
- Strengthen gitea-pr-review skill steps, _COMMON_WORKFLOWS, _GUIDE_RULES with explicit live reconciliation checklist, 'do not trust prior handoffs', stop on conflict.
- Add dedicated live queue reconciliation runbook section in docs/llm-workflow-runbooks.md.
- Add passthrough tests and assertions for new fields.
- All gates, redaction, author/reviewer separation untouched.
- Tests pass, py_compile clean, diff clean, secret sweep clean.

Closes #166
This commit is contained in:
2026-07-05 12:45:05 -04:00
parent a02d990bc5
commit 194301359e
4 changed files with 77 additions and 12 deletions
+19
View File
@@ -345,6 +345,25 @@ touching anything.
- **Prompt:** `Use any eligible reviewer profile to review PR #N. Approve only
if scope matches issue #M and checks pass; otherwise request changes.`
**Live queue reconciliation (mandatory before any review/merge decision):**
- Reconcile live state first. Do **not** assume prior handoffs, cached tool
output, or chat summaries are current.
- Steps (in order):
1. Call `gitea_list_prs` (open state) with explicit remote/org/repo.
2. Immediately `gitea_view_pr <number>` for the candidate; capture head SHA,
state, mergeable, updated_at, merged_at/merge_commit_sha if present.
3. Verify against any prior report: state, head SHA, updated timestamp,
linked issue state (use `gitea_view_issue` + `gitea_list_issues`).
4. `git fetch <remote> --prune && git checkout master && git pull <remote> master --ff-only`
5. If conflict/staleness detected (prior said "merged" but live open; head or
updated_at differs from claimed; merge commit missing on master), report
the inconsistency explicitly and **STOP** before review or merge.
- After a successful merge: re-run list_prs + view_pr on the PR, confirm
master advanced, and include the live post-merge verification in the handoff.
- Treat any ambiguous queue state as a blocker until a fresh, consistent live
picture is obtained.
### Merge a PR
- **Profile:** merger (allowed to merge; must **not** be the PR author).