Skip to content

armgit / avibe

Public Imported from GitHub
0

Make your computer a home for your AI partner. Avibe is the local-first Agent OS: Vibey, its built-in AI partner, works out of the box, and Claude Code, Codex & OpenCode run unchanged beside it — reach them from your browser, phone, or any chat app.

fix(watch): recognize the Codex receipt pass and wake the Agent after an unclassified verdict (#2885)

Call White2e31ef9eb7c7
diff --git a/docs/plans/pr-watch-coalesce-success.md b/docs/plans/pr-watch-coalesce-success.md
index 9a2ae066d..6f0fb0f94 100644
--- a/docs/plans/pr-watch-coalesce-success.md
+++ b/docs/plans/pr-watch-coalesce-success.md
@@ -34,6 +34,27 @@ The `b44e519d7` inventory covers ten findings-bearing heads and all 16 threads;
The independent review also verified the real summary from comment `6186377372`: its inline `Reviews are triggered when you` preamble differs from the older split `Codex reviews are triggered when you` footer. Accept both complete known footer forms, keeping arbitrary footer content reportable and leaving trigger policy unchanged. The existing progress/error matrix now covers both forms; the two live-form progress cases failed before this compatibility fix, while the 12 controls passed.
+## Receipt-form clean pass (2026-10-20)
+
+Codex now posts its clean pass as a receipt comment: a `<!-- codex-review-receipt:v1 -->` marker, the verdict line
+ending in a rotating sign-off (`:+1:`, "Chef's kiss.", "Keep them coming!", ...), the `Reviewed commit` line, and a
+details footer that differs from the summary comment's. The classifier accepted only the bare two-line form, so on
+avibe#2868 the receipt for `c02d7ae5cd` was reported as an unfamiliar payload while CI was still running; the later
+green CI was then a quiet half-success, and the lane was never woken although the PR stayed Merge-ready for eight
+hours. All 30 receipts on this repository's last 60 PRs have this shape.
+
+Two changes close the class:
+
+- The clean-pass shape accepts the complete receipt: the optional marker, a sign-off of at most 80 plain characters
+ with no problem text or markup, the `Reviewed commit` line, and the exact receipt footer. Anything else, including
+ text after the footer, still reports.
+- Liveness for an unclassified verdict: when the latest current-head Codex verdict is neither a recognized pass nor a
+ recognized problem (problem text, changes requested, inline comments, or unresolved threads), a later complete green
+ CI result is reported once as ordinary CI activity, not as a success candidate. The Agent that judged the verdict
+ gets the signal it is waiting for; recognized findings and errors keep green CI quiet as before.
+
+No state field, waiter option or supervisor behavior changes.
+
## Validation evidence
- With only the new parser flag present, both arrival-order regressions failed because the unchanged waiter emitted a single success (`rc=0` instead of the expected quiet wait).
diff --git a/skills/background-watch-hook/SKILL.md b/skills/background-watch-hook/SKILL.md
index e159b9bc0..9fa17b45f 100644
--- a/skills/background-watch-hook/SKILL.md
+++ b/skills/background-watch-hook/SKILL.md
@@ -2,7 +2,7 @@
name: background-watch-hook
slug: background-watch-hook
description: Run durable `vibe watch` waits for PR reviews, CI, files or external signals, then resume the Agent in the right Session.
-version: 0.18.0
+version: 0.18.1
---
# Background Watch Hook
diff --git a/skills/background-watch-hook/references/waiters.md b/skills/background-watch-hook/references/waiters.md
index 054e2d218..3e66db1d5 100644
--- a/skills/background-watch-hook/references/waiters.md
+++ b/skills/background-watch-hook/references/waiters.md
@@ -252,10 +252,15 @@ one-shot wait. Prefer `--coalesce-success` for delivery loops:
| Both successes at the same head, with no unresolved threads | One combined success **candidate** for Agent verification |
| A requested CI run fails/cancels/times out | Report immediately, even if another workflow is missing/running |
| Review findings, Codex errors, or unfamiliar review payloads | Report without waiting for CI |
+| CI turns green after an unfamiliar verdict was reported | Report the CI result once, since the Agent may be judging that verdict |
Recognized review successes are Codex-authored clean-pass comments/reviews naming
the current SHA, and a new Codex `+1` on the PR body observed after an unchanged
-head's baseline. A reaction present at seeding or first seen with a head change
+head's baseline. A clean-pass comment is either the bare two-line verdict or
+Codex's complete receipt: the `codex-review-receipt` marker, the verdict with a short
+plain sign-off (`:+1:`, "Chef's kiss.", ...), the `Reviewed commit` line, and its
+standard details footer. Any other text in it, or problem text in the sign-off,
+keeps it reportable. A reaction present at seeding or first seen with a head change
cannot be bound this way; head-transition reactions remain visible as ordinary
activity. A reaction candidate still needs the repository's stricter epoch and
prior-review checks in the follow-up; the waiter does not certify that gate.
diff --git a/skills/background-watch-hook/scripts/wait_pr.py b/skills/background-watch-hook/scripts/wait_pr.py
index 1746632cd..fe2bbcd4d 100755
--- a/skills/background-watch-hook/scripts/wait_pr.py
+++ b/skills/background-watch-hook/scripts/wait_pr.py
@@ -72,6 +72,22 @@ CODEX_STANDARD_SUMMARY_FOOTER = (
"Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.",
"</details>",
)
+# The clean-pass receipt Codex posts as a PR conversation comment. Its verdict line
+# ends with a rotating sign-off (":+1:", "Chef's kiss.", "Keep them coming!"), and
+# its details footer differs from the summary comment's.
+CODEX_RECEIPT_MARKER = "<!-- codex-review-receipt:v1 -->"
+CODEX_RECEIPT_FOOTER = (
+ "<details> <summary>ℹ️ About Codex in GitHub</summary>",
+ "<br/>",
+ "[Your team has set up Codex to review pull requests in this repo](https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you",
+ "- Open a pull request for review",
+ "- Mark a draft as ready",
+ "- Comment \"@codex review\".",
+ "If Codex has suggestions, it will comment; otherwise it will react with 👍.",
+ "Codex can also answer questions or update the PR. Try commenting \"@codex address that feedback\".",
+ "</details>",
+)
+CODEX_SIGN_OFF_MAX_CHARS = 80
# Comments that only drive the review loop rather than report its result. On a
# busy PR these outnumber the real findings, and each one costs a full Agent turn.
@@ -387,15 +403,29 @@ def _is_codex_summary_shape(body: str) -> bool:
}
+def _is_codex_sign_off(text: str) -> bool:
+ """A short plain-text sign-off, never markup or anything that reads as a problem."""
+
+ return (
+ len(text) <= CODEX_SIGN_OFF_MAX_CHARS
+ and not _has_codex_problem_text(text)
+ and re.search(r"[`\[\]<>#|]|https?:", text) is None
+ )
+
+
def _codex_clean_pass_body_sha(body: str) -> str | None:
lines = [line.strip() for line in body.splitlines() if line.strip()]
- if not lines or not re.fullmatch(
- r"Codex Review:\s*Didn['’]t find any major issues\.?", lines[0], re.IGNORECASE,
- ):
+ if lines and lines[0] == CODEX_RECEIPT_MARKER:
+ lines = lines[1:]
+ verdict = re.fullmatch(
+ r"Codex Review:\s*Didn['’]t find any major issues\.?(?:\s+(.+))?",
+ lines[0] if lines else "", re.IGNORECASE,
+ )
+ if not verdict or (verdict.group(1) is not None and not _is_codex_sign_off(verdict.group(1))):
return None
if len(lines) == 1:
return ""
- if len(lines) != 2:
+ if len(lines) != 2 and tuple(lines[2:]) != CODEX_RECEIPT_FOOTER:
return None
match = re.fullmatch(
r"\*{0,2}Reviewed commit\*{0,2}:\*{0,2}\s*`([0-9a-f]{7,40})`",
@@ -425,6 +455,20 @@ def _is_codex_clean_pass(item: dict[str, Any], head_sha: str) -> bool:
return len(reviewed) >= 7 and head_sha.casefold().startswith(reviewed.casefold())
+def _awaits_review_judgment(state: dict[str, Any], batch: dict[str, Any]) -> bool:
+ """The latest Codex verdict is neither a recognized pass nor a recognized problem."""
+
+ outcome = batch.get("outcome")
+ if batch.get("review") is not None or not outcome or outcome["kind"] not in {"reviews", "issue_comments"}:
+ return False
+ item = next((item for item in state[outcome["kind"]] if item.get("id") == outcome["id"]), None)
+ return (
+ item is not None
+ and str(item.get("state") or "").lower() not in {"changes_requested", "dismissed"}
+ and not _has_codex_problem_text(str(item.get("body") or ""))
+ )
+
+
def _is_codex_progress(item: dict[str, Any]) -> bool:
body = str(item.get("body") or "")
if (
@@ -2899,7 +2943,13 @@ def main() -> int:
)
# A green CI result alone must not advance its delivery baseline.
# The review evidence above is still adopted on quiet/problem polls.
- if not failed:
+ # A reported verdict the waiter could not classify is the Agent's to
+ # judge, so the green result that judgment may be waiting on is reported.
+ if not failed and not (
+ ci_output and not unresolved
+ and str(batch["head_sha"]).casefold() == _active_ci_head_sha().casefold()
+ and _awaits_review_judgment(state, batch)
+ ):
return pr_result
actions_output = _render_new_actions()
diff --git a/tests/test_wait_for_github_pr_activity.py b/tests/test_wait_for_github_pr_activity.py
index c7fbd49f8..a2090bf9b 100644
--- a/tests/test_wait_for_github_pr_activity.py
+++ b/tests/test_wait_for_github_pr_activity.py
@@ -4356,6 +4356,23 @@ def _clean_codex_comment(comment_id=601, *, head=COALESCED_HEAD, author="chatgpt
}
+def _codex_receipt_body(*, head=COALESCED_HEAD, sign_off=":+1:"):
+ """Codex's live clean-pass receipt (avibe-bot/avibe#2868, comment 6283459288)."""
+
+ return (
+ "<!-- codex-review-receipt:v1 -->\n\n"
+ f"Codex Review: Didn't find any major issues. {sign_off}\n\n"
+ f"**Reviewed commit:** `{head[:10]}`\n\n"
+ "<details> <summary>ℹ️ About Codex in GitHub</summary>\n<br/>\n\n"
+ "[Your team has set up Codex to review pull requests in this repo]"
+ "(https://chatgpt.com/codex/cloud/settings/general). Reviews are triggered when you\n"
+ "- Open a pull request for review\n- Mark a draft as ready\n- Comment \"@codex review\".\n\n"
+ "If Codex has suggestions, it will comment; otherwise it will react with 👍.\n\n\n\n\n"
+ "Codex can also answer questions or update the PR. Try commenting \"@codex address that feedback\".\n"
+ " \n</details>\n"
+ )
+
+
def _success_state(*runs, clean=False, head=COALESCED_HEAD, **items):
state = _pr_state(
issue_comments=[_clean_codex_comment(head=head)] if clean else items.pop("issue_comments", []),
@@ -4400,14 +4417,23 @@ def test_coalesced_success_waits_for_both_gates_across_restart_and_delivers_once
assert repeated == ""
[email protected]("shape", ["comment", "review", "reaction", "api-reaction"])
+ "comment", "review", "reaction", "api-reaction",
+ "receipt", "receipt-chefs-kiss", "receipt-keep-them-coming",
+])
def test_coalesced_success_recognizes_all_supported_codex_shapes(tmp_path, shape):
module = _load_module()
path = tmp_path / "ci.json"
pending = _ci_run(head=COALESCED_HEAD, status="in_progress", conclusion=None)
_seed_ci_state(module, path, pending, head=COALESCED_HEAD)
items = {"issue_comments": [_clean_codex_comment()]}
- if shape == "review":
+ if shape.startswith("receipt"):
+ sign_off = {
+ "receipt": ":+1:", "receipt-chefs-kiss": "Chef's kiss.",
+ "receipt-keep-them-coming": "Keep them coming!",
+ }[shape]
+ items = {"issue_comments": [{**_clean_codex_comment(), "body": _codex_receipt_body(sign_off=sign_off)}]}
+ elif shape == "review":
review = {**_clean_codex_comment(), "state": "COMMENTED", "commit_id": COALESCED_HEAD}
items = {"reviews": [review]}
elif "reaction" in shape:
@@ -4451,6 +4477,41 @@ def test_coalescing_never_hides_findings_errors_or_unknown_evidence(tmp_path, ev
assert "GitHub PR activity" in output
[email protected]("verdict, reaches_agent", [
+ ("unrecognized", True),
+ ("error", False),
+ ("inline", False),
+])
+def test_coalesced_green_ci_reaches_an_agent_judging_an_unrecognized_verdict(tmp_path, verdict, reaches_agent):
+ # The Agent may judge an unrecognized verdict a pass and then wait for CI; a
+ # quiet green would strand it. Recognized problems keep green CI quiet.
+ module = _load_module()
+ path = tmp_path / "ci.json"
+ pending = _ci_run(head=COALESCED_HEAD, status="in_progress", conclusion=None)
+ _seed_ci_state(module, path, pending, head=COALESCED_HEAD)
+ items = {
+ "unrecognized": {"issue_comments": [{**_clean_codex_comment(), "body": "A new verdict format worth inspecting"}]},
+ "error": {"issue_comments": [{**_clean_codex_comment(), "body": "Something went wrong. Please try again."}]},
+ "inline": {"review_comments": [_review_comment(501)]},
+ }[verdict]
+ options = ("--coalesce-success",)
+
+ rc, output, _ = _ci_cycle(module, path, [_success_state(pending, **items)], extra_args=options)
+ assert rc == 0 and "GitHub PR activity" in output
+
+ green = _success_state(_ci_run(head=COALESCED_HEAD), **items)
+ rc, output, _ = _ci_cycle(module, path, [green], delivery="2", extra_args=options)
+ if reaches_agent:
+ assert rc == 0
+ assert "GitHub Actions success" in output
+ assert "success candidate" not in output
+ else:
+ assert (rc, output) == (124, "")
+
+ rc, output, _ = _ci_cycle(module, path, [green], delivery="3", extra_args=options)
+ assert (rc, output) == (124, "")
+
+
@pytest.mark.parametrize("other", ["missing", "running", "missing-known-run"])
def test_coalesced_ci_failure_reports_before_other_workflows_and_is_not_repeated(tmp_path, other):
module = _load_module()
@@ -4862,13 +4923,19 @@ def test_coalescing_does_not_restore_old_reactions_when_report_head_differs(tmp_
"Changes requested",
"## Review findings\nRace allows duplicate notifications",
])
-def test_coalescing_surfaces_mixed_clean_and_error_text(tmp_path, suffix):
[email protected]("placement", ["after-verdict", "after-receipt-footer", "receipt-sign-off"])
+def test_coalescing_surfaces_mixed_clean_and_error_text(tmp_path, suffix, placement):
module = _load_module()
path = tmp_path / "ci.json"
pending = _ci_run(head=COALESCED_HEAD, status="in_progress", conclusion=None)
_seed_ci_state(module, path, pending, head=COALESCED_HEAD)
mixed = _clean_codex_comment()
- mixed["body"] += "\n\n" + suffix
+ if placement == "after-verdict":
+ mixed["body"] += "\n\n" + suffix
+ elif placement == "after-receipt-footer":
+ mixed["body"] = _codex_receipt_body() + "\n\n" + suffix
+ else:
+ mixed["body"] = _codex_receipt_body(sign_off=suffix)
rc, output, _ = _ci_cycle(
module, path, [_success_state(pending, issue_comments=[mixed])], extra_args=("--coalesce-success",),
)