fix(hn-monitor): guard against cron double-post (interim for cloud#1990)#51
Conversation
The reviewer announced PRs "ready for your review" in cases where it shouldn't, and re-announced the same commit on every webhook: - verifyReadyForHumanReview only queried mergeable,statusCheckRollup — never the PR state — so a PR that merged/closed between the harness run and the check could still be announced ready. Now query state and gate on OPEN. - prReadyStateAllowsHumanReview let an *empty* statusCheckRollup pass vacuously (checks.every === true), so a PR whose checks were queued but not yet registered read as "ready" — the pending-checks symptom. Now an empty rollup is not-ready, and drafts / CHANGES_REQUESTED are held back. - announceReadyOnce records the head SHA it announced ready for and skips re-announcing the same commit; new commits still get a (threaded) note. Also: require the harness to account for every bot/reviewer comment under an "## Addressed comments" heading with the file:line where each was fixed, so the channel and comment authors can see where each was handled. And stop tracking memory/workspace/.relay/state.json — it's relay VFS runtime state rewritten every reconcile cycle, so the review harness kept committing it to PRs. Untracked + gitignored. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…hecks, no-CI repos From cubic + gemini review of #50: - Populate pr.headSha from `gh pr view --json headRefOid` so the ready dedupe always keys on the commit. Some webhook payloads (check_run. completed) omit the head SHA; without it the dedupe was bypassed and re-pinged. (cubic P1 / gemini) - Treat SKIPPED checks as non-blocking in checkPassedAndComplete. A conditionally-skipped CI job is GitHub's "not applicable", not a failure, and was pinning PRs out of "ready" forever. Mirrors the trigger's ciFailed(), which already treats skipped as non-failing. (gemini) - Don't permanently block no-CI repos: an empty status-check rollup now counts as ready when GitHub's mergeStateStatus is CLEAN (nothing blocking), while a transient "checks queued but unregistered" window (UNSTABLE/BLOCKED/UNKNOWN) still reads as not-ready. (gemini) The concurrent-run dedupe race cubic flagged (P2) is a known best-effort limit — the memory API has no atomic check-and-set, and per-PR webhook delivery is effectively serialized. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…-post guard) A single cron tick can re-invoke this handler ~3 min apart: cloud re-runs a tick delivery whose 180s processing lease expires before the first run reports done (AgentWorkforce/cloud#1990). With post-before-save, the re-invocation re-read stale `seen` and posted the digest a second time — the observed double-post. Record the stories as seen BEFORE posting so a re-invocation loads them as already-seen and stays silent. Trade-off: a failed post drops that digest rather than risking a duplicate — acceptable for a low-stakes twice-daily summary. Stopgap; the durable fix is idempotent cron delivery in cloud#1990 (stable per-occurrence key + atomic claim in the runner). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
Your free trial PR review limit of 300 PRs has been reached. Please upgrade your plan to continue using CodeAnt AI. |
|
Warning Review limit reached
More reviews will be available in 31 minutes and 51 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR strengthens PR readiness gating in the review agent with stricter state checks and head-SHA-based notification deduplication, enforces precise comment location tracking in the review harness prompt, and reorders the HN monitor cron handler to persist story digests before posting to Slack. ChangesReview Agent PR Readiness Gating & Notification
HN Monitor Cron Digest Ordering
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Possibly related PRs
Suggested labels
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 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.
Code Review
This pull request improves the PR review agent and HN monitor. It ignores Relay VFS runtime state in .gitignore, deletes an unwanted state file, and prevents duplicate Slack notifications in hn-monitor/agent.ts by marking stories as seen before posting. In review/agent.ts, it implements deduplicated "ready for review" announcements using workspace memory, refines PR readiness checks (verifying open status, draft status, review decisions, and skipped checks), and updates the review prompt to require explicit tracking of addressed comments. Unit tests are added to cover these new readiness rules. There are no review comments to address, so no feedback is provided.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
|
Your free trial PR review limit of 300 PRs has been reached. Please upgrade your plan to continue using CodeAnt AI. |
|
✅ pr-reviewer applied fixes — committed and pushed Fixed a real PR issue in hn-monitor/agent.ts: the PR intended to claim stories before retry-prone work, but it still ran LLM summarization before saving Addressed Comments
Validation run:
Remote PR state is not ready: GitHub API reports CodeRabbit status |
|
ℹ️ pr-reviewer: review only — no file changes were applied to the PR (nothing to commit after review). The notes below are advisory and were not pushed. No further code changes were needed in the current checkout. Validation run:
Remote PR state observed via GitHub API: PR is open, not draft, Addressed comments
|
Why
hn-monitor posted its digest twice for one cron tick. Verified in Daytona (org Agent Relay): a single sandbox ran the runner twice ~3 min apart for one tick — the cloud re-invoked a tick delivery whose 180s processing lease expired before the first run reported
delivered. With the handler's old post-before-save ordering, the re-invocation re-read staleseenand re-posted.Full root-cause analysis and the durable, layered fix (stable per-occurrence key in relaycron → per-occurrence delivery dedup + liveness-gated retry in the delivery layer → atomic
ctx.onceclaim enforced in the runner) are tracked in AgentWorkforce/cloud#1990.Change
Reorder to claim-then-announce: compute the digest, record the stories as
seen, then post. A re-invocation now loads them as already-seen and stays silent.Trade-off: if the post fails after the save, that digest is dropped rather than risking a duplicate — the right call for a low-stakes twice-daily summary. This is an interim guard; it doesn't cover truly concurrent invocations. The robust fix is cloud#1990.
Typecheck passes.
🤖 Generated with Claude Code
Summary by cubic
Stops duplicate Slack posts from
hn-monitorand fixes noisy PR reviewer pings by gating and deduping the “ready for your review” announcement.gh pr view --json headRefOidwhen missing), and only when the PR is OPEN, mergeable, not DRAFT, no CHANGES_REQUESTED, and checks are complete and passing. An empty check rollup counts as ready only whenmergeStateStatusis CLEAN;SKIPPEDchecks are non-blocking..relay/andmemory/workspace/.relay/.Written for commit 2ddc49b. Summary will update on new commits.