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.
Python agentagent-osaiai-agentsai-partnerchatopsclaudeclaude-codecodexdevtoolsdiscord-botlark-botllmlocal-firstlong-term-memoryopencodeslack-botvibe-codingvibeywechat
fix(watch): bind Codex's summary pass so a pass seen with its head change pairs with green CI (#3065)
Call White160b6a3ff2b1
diff --git a/skills/background-watch-hook/SKILL.md b/skills/background-watch-hook/SKILL.mdindex 47c352a7e..9a88f67cf 100644--- a/skills/background-watch-hook/SKILL.md+++ b/skills/background-watch-hook/SKILL.md@@ -2,7 +2,7 @@name: background-watch-hookslug: background-watch-hookdescription: Run durable `vibe watch` waits for PR reviews, CI, files or external signals, then resume the Agent in the right Session.-version: 0.19.0+version: 0.19.1---# Background Watch Hookdiff --git a/skills/background-watch-hook/references/waiters.md b/skills/background-watch-hook/references/waiters.mdindex b6d836e83..b094eaf6c 100644--- a/skills/background-watch-hook/references/waiters.md+++ b/skills/background-watch-hook/references/waiters.md@@ -206,7 +206,7 @@ notification policy for recognized success shapes, not a generic readiness gate:known half-successes stay quiet, but findings, errors, unfamiliar review payloads,and head/lifecycle/thread changes still reach the Agent. The Agent must fetch livestate and apply the repository's exact-head review, complete CI, and thread gates.-A completed Codex summary or a `Reviewed commit` line alone is not a clean pass.+A summary's "Completed" row or a `Reviewed commit` line alone is not a clean pass.One caveat on CI: a requested workflow that never matches — renamed, misspelled,or never triggered on this branch — cannot establish success. Verify each@@ -255,18 +255,23 @@ one-shot wait. Prefer `--coalesce-success` for delivery loops:| 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 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,+the current SHA, Codex's review summary whose `codex-review-state` line names the+current head in full as `completed` with no findings (and every other review it+lists finished without any), and a new Codex `+1` on the PR body observed after an+unchanged 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 changecannot 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.-Codex's mutable summary comment is progress, not a verdict: routine updates stay-quiet in this mode, while its error/failure text remains reportable. Unknown-verdict formats are surfaced rather than silently interpreted as success.+activity. The summary state names its commit, so it is bound even when its edit is+first seen with the head change; without it, a pass that lands before the next poll+would leave the later green CI a half-success forever (#3040). 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. Codex's mutable summary comment is+otherwise progress, not a verdict: routine updates stay quiet in this mode, while+its error/failure text remains reportable. Unknown verdict formats are surfaced+rather than silently interpreted as success.Deferred evidence lives in the same owner-specific state file and pending deliverytransaction. Retain the latest ordered bot outcome, per-resource semantic history,diff --git a/skills/background-watch-hook/scripts/wait_pr.py b/skills/background-watch-hook/scripts/wait_pr.pyindex e1e8a84a7..889795f89 100755--- a/skills/background-watch-hook/scripts/wait_pr.py+++ b/skills/background-watch-hook/scripts/wait_pr.py@@ -450,6 +450,26 @@ def _codex_clean_pass_body_sha(body: str) -> str | None:return match.group(1) if match else None+def _is_codex_summary_pass(item: dict[str, Any], head_sha: str) -> bool:+ """Codex's review summary in its known shape, whose state line names ``head_sha`` in full as reviewed with no+ findings, and every other review it lists finished without one: the pass ``pr-delivery-loop`` reads.++ The summary is edited in place, so this is a verdict about the commit it names, wherever its row was first seen.+ """++ if not _is_codex_progress(item):+ return False+ state = _codex_summary_state(str(item.get("body") or ""))+ code_review = state.get("code_review") if state is not None else None+ if not isinstance(code_review, dict) or str(code_review.get("commit_sha") or "").casefold() != head_sha.casefold():+ return False+ others = [review for review in state.values() if isinstance(review, dict) and review.get("status") is not None]+ return all(+ str(review.get("status")).casefold() == "completed" and review.get("has_any_findings") is False+ for review in (code_review, *others)+ )++def _is_codex_clean_pass(item: dict[str, Any], head_sha: str) -> bool:"""Recognize a success shape, not a substitute for the Agent's review gate."""@@ -457,6 +477,8 @@ def _is_codex_clean_pass(item: dict[str, Any], head_sha: str) -> bool:return Falseif str(item.get("state") or "").lower() in {"changes_requested", "dismissed"}:return False+ if _is_codex_summary_pass(item, head_sha):+ return Truebody_sha = _codex_clean_pass_body_sha(str(item.get("body") or ""))if body_sha is None:return False@@ -521,8 +543,8 @@ def _github_time(value: Any) -> datetime | None:return parsed if parsed.tzinfo is not None else parsed.replace(tzinfo=timezone.utc)-def _codex_summary_code_review(body: str) -> dict[str, Any] | None:- """The ``code_review`` object of a Codex summary's machine-readable state line."""+def _codex_summary_state(body: str) -> dict[str, Any] | None:+ """A Codex summary's machine-readable state line, as an object."""for line in body.splitlines():match = re.fullmatch(r"<!-- codex-review-state:v1 (.+) -->", line.strip())@@ -532,11 +554,18 @@ def _codex_summary_code_review(body: str) -> dict[str, Any] | None:state = json.loads(match.group(1))except json.JSONDecodeError:return None- code_review = state.get("code_review") if isinstance(state, dict) else None- return code_review if isinstance(code_review, dict) else None+ return state if isinstance(state, dict) else Nonereturn None+def _codex_summary_code_review(body: str) -> dict[str, Any] | None:+ """The ``code_review`` object of a Codex summary's machine-readable state line."""++ state = _codex_summary_state(body)+ code_review = state.get("code_review") if state is not None else None+ return code_review if isinstance(code_review, dict) else None++def _codex_review_stall(state: dict[str, Any],*,@@ -959,7 +988,8 @@ def _coalesced_review_state():old_items = (baseline or {}).get(kind, {})for item in state[kind]:- if not _is_codex_item(item) or _is_codex_progress(item):+ # A summary is progress, except the state that names this head as passed.+ if not _is_codex_item(item) or (_is_codex_progress(item) and not _is_codex_clean_pass(item, head)):continueif kind == "reviews" and not _is_actionable_review(item):continuediff --git a/tests/test_wait_for_github_pr_activity.py b/tests/test_wait_for_github_pr_activity.pyindex b1bea27b0..e847c71c4 100644--- a/tests/test_wait_for_github_pr_activity.py+++ b/tests/test_wait_for_github_pr_activity.py@@ -4620,6 +4620,115 @@ def test_coalescing_never_binds_an_existing_or_head_transition_reaction(tmp_pathassert (rc, output) == (124, "")+def _codex_review_state_summary(comment_id=640, *, head=COALESCED_HEAD, status="completed", findings=False,+ security=None, sha=None, updated_at="2026-10-27T15:37:00Z"):+ """Codex's live review summary (avibe-bot/avibe#3040, comment 6445362341): edited in place, its state line names+ the reviewed commit in full."""++ code_review = {"commit_sha": head if sha is None else sha, "has_any_findings": findings,+ "has_unresolved_findings": findings, "status": status}+ security_review = security or {"commit_sha": None, "has_any_findings": None, "has_unresolved_findings": None,+ "status": None}+ state = json.dumps({"code_review": code_review, "security_review": security_review}, separators=(",", ":"))+ shown = {"completed": "✅ **Completed**", "running": "🔄 **Running**"}.get(status, status)+ return {+ "id": comment_id,+ "body": (+ "<!-- codex-pull-request-review-summary -->\n"+ f"<!-- codex-review-state:v1 {state} -->\n\n"+ "## Codex Review Summary\n\n"+ "This comment shows the latest Codex review activity on this pull request.\n\n"+ "| Review | Status | Commit | Review trigger |\n"+ "| --- | --- | --- | --- |\n"+ f"| 📝 **Code Review** | {shown} <relative-time datetime=\"{updated_at}\">{updated_at}</relative-time> "+ f"| `{head[:7]}` | New commits |\n\n\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\" or \"@codex security review\".\n\n"+ "Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 "+ "once all reviews finish with no findings.\n\n</details>"+ ),+ "user": {"login": "chatgpt-codex-connector[bot]"},+ "created_at": "2026-10-27T14:59:16Z",+ "updated_at": updated_at,+ "html_url": f"https://github.com/example/repo/pull/153#issuecomment-{comment_id}",+ }+++def test_a_pass_seen_with_its_head_change_still_pairs_with_the_later_green_ci(tmp_path):+ """avibe-bot/avibe#3040: a fix was pushed, and Codex passed it before the waiter's next poll. That poll saw the+ head change, the summary naming the new head as passed, and the +1 together; CI was still running. The +1 of a+ head transition is never bound (it names no commit), so the summary's state, which does, must be: otherwise the+ green CI after it is a half-success forever."""++ module = _load_module()+ path = tmp_path / "ci.json"+ pending = _ci_run(head=COALESCED_HEAD, status="in_progress", conclusion=None)+ running = _codex_review_state_summary(status="running", updated_at="2026-10-27T14:59:21Z")+ _seed_ci_state(module, path, pending, head=COALESCED_HEAD)+ options = ("--coalesce-success",)+ assert _ci_cycle(module, path, [_success_state(pending, issue_comments=[running])], extra_args=options)[:2] == (+ 124, "",+ )++ new_head = "b" * 40+ reaction = {"id": 702, "content": "+1", "user": {"login": "chatgpt-codex-connector[bot]"}}+ passed = _codex_review_state_summary(head=new_head)+ moved = _success_state(+ _ci_run(head=new_head, status="in_progress", conclusion=None), head=new_head,+ issue_comments=[passed], reactions=[reaction],+ )+ rc, output, _ = _ci_cycle(module, path, [moved], extra_args=options)+ assert rc == 0 and "pr_head" in output and "success candidate" not in output++ green = {**moved, "actions": [_ci_run(head=new_head)]}+ rc, output, _ = _ci_cycle(module, path, [green], delivery="2", extra_args=options)+ assert rc == 0+ assert f"CI + Codex review success candidate for avibe-bot/avibe#153@{new_head[:12]}" in output+ assert "issue_comment #640" in output+ rc, output, _ = _ci_cycle(module, path, [green], delivery="3", extra_args=options)+ assert (rc, output) == (124, "")++[email protected](("summary", "passes"), [+ ({}, True),+ ({"status": "running"}, False),+ ({"status": None}, False),+ ({"findings": True}, False),+ ({"findings": None}, False),+ # The state must name the head in full; the table's short SHA is not the state.+ ({"sha": COALESCED_HEAD[:7]}, False),+ ({"sha": "b" * 40}, False),+ ({"security": {"commit_sha": COALESCED_HEAD, "has_any_findings": None, "status": "running"}}, False),+ ({"security": {"commit_sha": COALESCED_HEAD, "has_any_findings": True, "status": "completed"}}, False),+ ({"security": {"commit_sha": COALESCED_HEAD, "has_any_findings": False, "status": "completed"}}, True),+], ids=["passed", "running", "no-status", "findings", "findings-unknown", "short-sha", "other-head", "security-running", "security-findings",+ "security-passed"])+def test_the_review_summary_state_is_a_pass_only_for_the_head_with_every_review_done_clean(+ tmp_path, summary, passes,+):+ 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)+ options = ("--coalesce-success",)+ comment = _codex_review_state_summary(**summary)++ # A half-success stays quiet; a summary in no known shape (a status-less row) is surfaced, never a pass.+ rc, output, _ = _ci_cycle(module, path, [_success_state(pending, issue_comments=[comment])], extra_args=options)+ assert "success candidate" not in output+ assert (rc, output) == (124, "") or (summary == {"status": None} and "issue_comment #640" in output)+ rc, output, _ = _ci_cycle(+ module, path, [_success_state(_ci_run(head=COALESCED_HEAD), issue_comments=[comment])], delivery="2",+ extra_args=options,+ )+ assert ("CI + Codex review success candidate" in output) is passes+ if passes:+ assert rc == 0++def test_coalescing_resets_old_head_evidence_without_mixing_ci(tmp_path):module = _load_module()path = tmp_path / "ci.json"