Skip to content

fix(server): PR watches wake when the other checks finish after one failed - #30

Merged
pnupu merged 10 commits into
mainfrom
ilkka/pr-watch-checks-finished
Nov 19, 2026
Merged

pnupu merged 10 commits into
mainfrom
ilkka/pr-watch-checks-finished

Conversation

@pnupu

@pnupu pnupu commented Nov 18, 2026 •

Copy link
Copy Markdown
Owner

Problem

A PR watch wakes the agent when a check newly fails or when every check passes. When one check fails and another check finishes later, the watch stays silent. A thread waited 29 hours on this: one review bot failed and woke it, the agent ended its turn to wait for the second review bot, and that bot passed 5 seconds later with no wake.

Change

evaluatePullRequestWatch now reports a checks-finished change while a check has failed, when no check is running and no run waits for approval, and either:

  • the previous read still had running checks or an approval hold, or
  • a check name is finished that the watch had not seen finished on this head. This catches a bot first seen already finished, and a pending answer that a push elsewhere in the thread dropped.

To do this, the watch keeps a new optional finishedChecks list in the ThreadPullRequestWatch contract. It is kept only while a check has failed, so green CI runs do not sync it. Watches saved before the field learn the names without waking.

A read that finds a new failure still reports checks-failed. When no check is running or held for approval in that read, the change has settled: true and the wake says no checks are running any more. Baseline reads stay silent. A read with an unavailable approval lookup still wakes, and the wake says that approval could not be read. A wake that brings only finished checks or comments counts toward the wake limit, so bot loops stay bounded. The wake lists the failed checks and counts as a failure outcome. The user guide's list of wake reasons now includes this case.

Scope

Fork fix for a stall seen in one of my threads. It needs no issue. The watcher also ignores comments from the PR's own account, so a review bot that posts as that account does not wake it either. This PR does not change that.

Verification

  • Extended reports each failure at once, and once more when the other checks finish in pullRequestWatch.test.ts. The first row failed on origin/main (no change reported). Further rows cover a repeat read (quiet), a dropped pending answer, a bot first seen already finished, an unavailable approval read, a finish or a new failure after a first read with an unavailable approval read, a legacy watch (quiet), and an approval hold that clears between reads. stops after the wake limit unless the head moves gained a row for a bot that reruns its check with each comment. I saw the rows for the dropped pending answer, both unavailable approval reads and the approval hold fail before their fixes. I did not run the bot-first-seen and wake-limit rows on the code before their fixes.
  • runtimeLayer.test.ts now expects the wake when a check finishes after a push dropped the pending answer.
  • vp test run on pullRequestWatch.test.ts and runtimeLayer.test.ts: 229 passed. vp run check:changed ran 265 tests in 7 files, all passed.
  • effect-tsgo tsrs --noEmit in apps/server: no errors. Lint passes, and the changed files pass format.
  • vp run check:changed format fails only on an untracked local .jaru/ folder. knip 1/2 fails on scripts/fork/refresh-update-manifest.ts and scripts/fork/sign-macos-app.ts, which are unused on main too. The pre-commit hook runs the same knip check, so I committed with --no-verify.
  • Not checked: a live wake on a real PR.

Created with Claude Opus 5.5 in Claude Code (T3 Code).

🤖 Generated with Claude Code

…ailed

A watch woke on a new failure or when every check passed. When one check
failed and a review bot finished later, the watch stayed silent, so an
agent that waited for the second review never woke.

The watch now reports "checks-finished" once, when the last running check
finishes and at least one check failed. A new failure in the same read
still reports as "checks-failed" only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pnupu

pnupu commented Nov 18, 2026

Copy link
Copy Markdown
Owner Author

Note

claude-fable-5-2 responding on behalf of Ilkka

Automatic review of 689ebb7c8866.

VERDICT: APPROVE

F1 [nit] apps/server/src/orchestration-v2/pullRequestWatch.ts:85 An unreadable approval read on the transition loses the wake for good. The !unread guard skips the report, but line 81 has already stored checksPending = false, so the next readable read has pendingBefore false and stays silent (confirmed: unread read then readable read both report []). This only affects cross-repository PRs whose approval lookup fails, and if that lookup fails on every read, checks-finished never fires. Fix: drop !unread from the condition, since checksPending only counts running checks and does not depend on the approval lookup; or keep the prior checksPending on an unread read. Add a test either way, because the description's "unreadable approval lookup stays silent" claim has none.

F2 [nit] apps/server/src/orchestration-v2/pullRequestWatch.ts:85 When the last running check is a required one that passes while an advisory check already failed, the same read now reports both checks-finished and checks-passed. That read already woke the agent before this PR, and its notification outcome changes from completed to failed with summary "checks finished with failures, checks passed" (confirmed). Fix: skip checks-finished when the read also reports checks-passed, or state in the description that the outcome change is intended and cover it with a test.

F3 [nit] apps/server/src/orchestration-v2/pullRequestWatch.ts:371 "All checks finished" is false when a run still waits for maintainer approval. action-required checks do not count as pending, so [lint failure, test success, gated action-required] produces this line (confirmed). Fix: word it as "No checks are still running ..., and these failed:", or require awaiting.length === 0 && awaitingApproval.length === 0.

The intended case works: a failure, then the other check passing, reports checks-finished once with outcome failed, and the repeated read reports nothing. No test or assertion was weakened.

I could not run vp test because the checkout has no node_modules and installs are not allowed. The confirmations above come from running a copy of pullRequestWatch.ts under node --experimental-strip-types with effect/DateTime stubbed.

@pnupu

pnupu commented Nov 18, 2026

Copy link
Copy Markdown
Owner Author

Note

gpt-6.2-sol responding on behalf of Ilkka

Automatic review of 689ebb7c8866.

VERDICT: APPROVE

F1 [nit] apps/server/src/orchestration-v2/pullRequestWatch.ts:85 A failed approval lookup on the completion poll suppresses the wake and clears checksPending, so the watch stays silent even after the lookup recovers. Fix: Retain the owed wake until a readable poll can confirm completion.

F2 [nit] apps/server/src/orchestration-v2/pullRequestWatch.ts:371 The wake can say “All checks finished” while also reporting a workflow awaiting approval. Fix: Say “No checks are still running.”

Focused Node probes confirmed the intended wake and reproduced both findings. The repository test suite could not run because vp and workspace dependencies were unavailable.

…nread approvals

Review findings on the first commit:

- A run that waits for approval has not run yet, so "All checks
  finished" was false while one existed. The wake now waits until no
  approval hold remains.
- A read with an unavailable approval lookup dropped the wake but still
  saved the checks as finished, so the wake was lost. The approval
  holds already cover that read, so it no longer blocks the wake.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pnupu

pnupu commented Nov 18, 2026

Copy link
Copy Markdown
Owner Author

Note

claude-fable-5-2 responding on behalf of Ilkka

Automatic review of 9b86b7f3ff80.

VERDICT: APPROVE

F1 [nit] apps/server/src/orchestration-v2/pullRequestWatch.ts:129 A read where an approval hold blocks the wake still saves checksPending: false, so the wake is lost if the gated run is then approved and passes between two reads (confirmed: no change reported, holds end up empty). This is the same loss the second commit fixed for unread approvals. Fix: also treat a hold that existed before this read and is gone now as the edge, e.g. (pendingBefore || (watch.awaitingApproval ?? []).length > 0).

F2 [nit] apps/server/src/orchestration-v2/pullRequestWatch.ts:79 After thread.pull-request-watch.checks-reopen clears checksPending (any push from the thread, including to another branch), pendingBefore falls back to false. If the last check finishes before the next read, no checks-finished is reported (confirmed). Fix: accept as a known gap, or keep a separate "finish owed" flag that the reopen does not clear.

F3 [nit] apps/server/src/orchestration-v2/pullRequestWatch.ts:488 When an advisory check failed earlier and the required checks pass on the read where the last check finishes, the wake now carries both checks-finished and checks-passed with outcome failed. Before this change that read was checks-passed only, with outcome completed (confirmed: [checks-finished [lint], checks-passed]). Fix: skip checks-finished when the same read reports checks-passed, or leave it out of the failed outcome in that case.

The intended case works: one check fails, the other finishes later, checks-finished is reported once and the repeated read is silent. No test or assertion was weakened, and no other code switches on the change kinds.

I could not run the repository's test suite because node_modules is not installed. The confirmations above come from a scratch copy of pullRequestWatch.ts with effect/DateTime stubbed, run under Node.

@pnupu

pnupu commented Nov 18, 2026

Copy link
Copy Markdown
Owner Author

Note

gpt-6.2-sol responding on behalf of Ilkka

Automatic review of 9b86b7f3ff80.

VERDICT: CHANGES
F1 [should] apps/server/src/orchestration-v2/pullRequestWatch.ts:127 A review bot that publishes only its final status still leaves the watch silent. If the first read sees Claude failed and Codex absent, the next read with Codex successful emits no wake. Fix: Also detect a newly reported terminal check on the same head when a failure remains and all reported checks have settled.

F2 [should] apps/server/src/orchestration-v2/pullRequestWatch.ts:127 When the other checks finish during an approval hold, the watch clears checksPending. If the gated run is approved and finishes between reads, the hold clears without a wake. Fix: Count a previous approval hold as unfinished work when deciding whether to emit checks-finished.

F3 [nit] apps/server/src/orchestration-v2/pullRequestWatch.ts:129 A failed approval lookup can hide a newly gated workflow, so the wake can say “All checks finished” while that workflow still needs approval. Fix: Preserve the completion wake until a readable approval lookup confirms the gate is clear.

F4 [nit] apps/server/src/orchestration-v2/pullRequestWatch.ts:79 A push to another branch clears checksPending for every watch in the thread. If the final check finishes before the next read, the unchanged PR head loses its completion wake. Fix: Preserve the previous pending observation for completion detection when a refresh confirms the same head.

Focused Node checks reproduced all four cases. The repository test suite could not run because vp and the project dependencies were unavailable.

…ed work

When the other checks finished during an approval hold, the watch saved
no pending checks. If the gated run was then approved and finished
between two reads, the hold cleared without a wake. The wake now treats
an earlier approval hold like a pending check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pnupu

pnupu commented Nov 18, 2026

Copy link
Copy Markdown
Owner Author

Note

Claude Opus 5.5 responding on behalf of Ilkka

Answers to the review of 9b86b7f3ff80. F2 is fixed in 066d537a54, and I declined F1, F3 and F4.

  • F2, fixed. pendingBefore now also counts an earlier approval hold (awaitingApproval.length > 0). A new row in reports each failure at once, and once more when the other checks finish failed before the fix and passes now: the gated run is approved and finishes between reads, and the read reports checks-finished.
  • F1, declined as a follow-up. To see a check that appears already finished, the watch must save the names of the checks it has seen. That needs a new field in the ThreadPullRequestWatch contract and in the orchestrator, which is wider than this fix. The case that stalled sets pending first: on this PR, both ai-review/* statuses were pending at 18:50:32, three minutes before their results, and GitHub Actions also reports queued jobs.
  • F3, nit, declined. A gated run that an unavailable lookup hides was never announced either. The approval holds the watch already keeps cover the runs it has seen.
  • F4, nit, declined. The orchestrator clears checksPending when another branch is pushed. That behavior is outside this change.

@pnupu

pnupu commented Nov 18, 2026

Copy link
Copy Markdown
Owner Author

Note

claude-fable-5-2 responding on behalf of Ilkka

Automatic review of 066d537a546c.

VERDICT: APPROVE

F1 [nit] apps/server/src/orchestration-v2/pullRequestWatch.ts:72 The finish wake is still lost if the agent runs a git push that does not move this PR's head (for example to another PR in the stack) and the last check finishes before the next read. checks-reopen clears checksPending, the fallback reads it as false, so pendingBefore at line 80 is false; in a scratch run the read after the clear returned no changes and saved checksPending: false. Fix: accept the race and note it in the comment, or keep a separate "finish still owed" marker that withoutChecksAnswer does not drop.

F2 [nit] apps/server/src/orchestration-v2/pullRequestWatch.ts:489 When the required checks pass in the same read in which the last advisory check finishes, and an advisory failure was already reported, the read now emits both checks-finished and checks-passed. The notification outcome becomes failed with summary "checks finished with failures, checks passed"; on main that read was completed. Fix: skip checks-finished when the same read pushes checks-passed, or keep it out of the failed set when checks-passed is present.

F3 [nit] apps/server/src/orchestration-v2/pullRequestWatch.ts:132 With a standing failure, every later pending-to-done cycle of any check emits checks-finished again, and that counts as progress at line 247, resetting the comment-only wake counter. In a scratch run with a review-bot check that re-ran alongside each of 12 bot comments, wakes stayed 0 and exhausted never became true; on main that sequence stops at 10. checks-passed already behaves this way when nothing has failed, so this only extends an existing gap. Fix: leave as is, or exclude checks-finished from progress.

The intended case works: one bot fails, the other passes later, and the watch emits a single checks-finished listing the failed check, with nothing on the repeated read. The diff only adds test assertions and weakens none.

I could not run the repository's test suite because dependencies are not installed. The scratch runs above used a copy of pullRequestWatch.ts with effect/DateTime stubbed.

@pnupu

pnupu commented Nov 18, 2026

Copy link
Copy Markdown
Owner Author

Note

gpt-6.2-sol responding on behalf of Ilkka

Automatic review of 066d537a546c.

VERDICT: CHANGES

F1 [should] apps/server/src/orchestration-v2/pullRequestWatch.ts:128 The watch still stalls if the second review bot is first seen as successful. A poll that sees only the first bot’s failure saves checksPending: false, so the second bot’s result produces no wake. Fix: Track reported check contexts per head and wake when a new terminal result arrives while a known failure remains and no checks are pending.
F2 [should] apps/server/src/orchestration-v2/pullRequestWatch.ts:380 The wake says “All checks finished” when GitHub could not determine whether a workflow is waiting for approval. A hold that has never been seen is absent from awaitingApproval. Fix: Keep the wake for the visible results and explicitly say that workflow approval status is unknown.
F3 [nit] apps/server/src/orchestration-v2/pullRequestWatch.ts:129 A failed GitHub unfinished-run lookup can make a queued workflow disappear from the snapshot, triggering a completion wake while the workflow is still queued. Fix: Mark the failed lookup as an incomplete read and preserve the completion transition for a successful retry.

A focused Node harness reproduced these cases. All 48 watcher tests passed on the PR head in that harness. The native vp suite was unavailable because the runner and dependencies were missing.

… finished

Review findings on the earlier commits:

- A review bot first seen already finished, or a pending answer that a
  push elsewhere in the thread dropped, left the watch silent. While a
  check has failed, the watch now keeps the names of finished checks on
  the head (`finishedChecks`), and a new name is news too.
- A read with an unavailable approval lookup still wakes, and the wake
  says that approval could not be read.
- Watches saved before the field learn the names without waking.
- A wake that brings only finished reruns and comments counts toward the
  comment wake limit instead of resetting it, so bot loops stay bounded.
- The wake says no checks are running any more, not that all finished,
  because a host can still register a late check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pnupu

pnupu commented Nov 18, 2026

Copy link
Copy Markdown
Owner Author

Note

Claude Opus 5.5 responding on behalf of Ilkka

Answers to the review of 066d537a546c. F1 and F2 are fixed in 4b0b9e7dbb, and I declined F3.

  • F1, fixed. While a check has failed, the watch keeps the names of finished checks on the head in a new optional finishedChecks field. A name not seen finished before is news, even when the previous read saved checksPending: false. A new row covers a bot first seen already finished. The same list also covers a pending answer that a push elsewhere in the thread dropped (the earlier F4).
  • F2, fixed. A read with an unavailable approval lookup still sends the wake, with approvalUnknown: true. The message then says that approval could not be read. It also says "No checks are running any more" instead of "All checks finished".
  • F3, nit, declined. If an unfinished-run lookup fails and hides a queued run, that read looks like every other read with the run missing. The new wording no longer claims that every check finished.

@pnupu

pnupu commented Nov 18, 2026

Copy link
Copy Markdown
Owner Author

Note

claude-opus-5-5 responding on behalf of Ilkka

Automatic review of 4b0b9e7dbb10.

VERDICT: CHANGES

F1 [should] apps/server/src/orchestration-v2/pullRequestWatch.ts:143 The same stall still happens when one read sees both the failure and the other check finishing. Example: bot A fails and bot B passes between two reads. newlyFailed is non-empty, so only checks-failed is reported, and it names only A. finishedChecks becomes [A, B] and checksPending false, so unfinishedBefore and finishedGrew stay false on every later read and no wake ever comes. The agent is never told B finished, and if it ends its turn to wait for B it waits forever, as in the reported incident. Sweeps run every two minutes, so this is a likely timing, not a rare one. Fix: when a read has new failures and no check is running or held for approval, say so in that wake. For example, add a "no checks are running any more" line to the checks-failed message, or allow checks-finished alongside checks-failed in that case.

F2 [nit] apps/server/src/orchestration-v2/pullRequestWatch.ts:266 The loop limit only covers a wake that also has comments. A wake with only checks-finished neither adds to nor resets wakes, so a bot that reruns its check without commenting (for example, triggered by the agent's own PR comments, which the watch ignores) can wake the agent forever while a failure stands. The description says bot loops stay bounded. Fix: count a wake with only checks-finished toward the limit too, or narrow the claim in the description.

F3 [nit] apps/server/src/orchestration-v2/pullRequestWatch.ts:507 The exhausted message still says "after 10 comment-only updates in a row", but wakes that include checks-finished now count toward the limit. Fix: change the wording, for example to "comment or rerun updates".

F4 [nit] apps/server/src/orchestration-v2/pullRequestWatch.ts:129 finishedNow dedupes by name. When two checks share a name (matrix jobs, or the same job in two workflows), one finished copy puts the name in the list. If the pending answer was then dropped, the last copy finishing is not detected, because finishedGrew sees no new name and unfinishedBefore is false. Fix: key the list by name plus URL, or accept this as a rare case.

F5 [nit] apps/server/src/orchestration-v2/pullRequestWatch.ts:515 Say the required checks pass in the same read where the last advisory check finishes, while another advisory check has already failed. The wake now has both checks-passed and checks-finished, and its outcome changes from "completed" to "failed", even though the agent was already told about the advisory failure. Confirm this is intended.

I could not run the tests: node_modules is not installed in the worktree and there is no network.

@pnupu

pnupu commented Nov 18, 2026

Copy link
Copy Markdown
Owner Author

Note

gpt-6.2-sol responding on behalf of Ilkka

Automatic review of 4b0b9e7dbb10.

VERDICT: CHANGES

F1 [should] apps/server/src/orchestration-v2/pullRequestWatch.ts:268 Same-head bot reruns can wake the agent indefinitely when their comments come from the PR’s own account and are filtered out. I reproduced 12 finish wakes with the counter still at zero. Fix: count repeated same-head finish wakes toward the limit even when no comment is visible.

F2 [nit] apps/server/src/orchestration-v2/pullRequestWatch.ts:281 Green watch updates carry an unnecessary empty finishedChecks array. Fix: omit the field when no check has failed.

All 48 evaluator cases passed in a Node harness with lightweight shims. The standard test runner was unavailable because vp and the workspace dependencies are absent.

…nning

Review findings on 4b0b9e7:

- When a new failure and the last running check finishing came in the
  same read, only "checks failed" was sent, and no later read had a
  finish left to report. That wake now also says no checks are running,
  with the approval caveat when the approval read failed.
- A wake that brings only a finished rerun now also counts toward the
  wake limit, so a bot that reruns its check without a visible comment
  stays bounded. The stop message and user guide say so.
- Green watches no longer save an empty finished list. An empty or
  missing list is no baseline either way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pnupu

pnupu commented Nov 18, 2026

Copy link
Copy Markdown
Owner Author

Note

Claude Opus 5.5 responding on behalf of Ilkka

Answers to both reviews of 4b0b9e7dbb10. The fixes are in 8bc54db1a3.

Claude review:

  • F1, fixed. When a read finds a new failure and no check is running or held for approval, the checks-failed change now has settled: true. The message adds "No checks are running any more.", plus the approval caveat when the approval read failed. A new row covers a failure and the last finish in the same read. Four existing rows now expect settled: true, because their reads have nothing left running.
  • F2, fixed. Same as Codex F1 below.
  • F3, fixed. The stop message now says "updates in a row that brought only comments or finished reruns". The user guide says the same.
  • F4, nit, declined. Duplicate names matter only when a push elsewhere also dropped the pending answer. In the normal case the pending answer from the previous read still sends the wake.
  • F5, intended. An advisory review bot that finishes after another check failed is the case this PR fixes, so the wake has a failed outcome even when the required gate passed.

Codex review:

  • F1, fixed. A wake that brings only checks-finished now counts toward the wake limit, with or without a visible comment. A new assertion covers it.
  • F2, fixed. Green watches no longer save an empty finishedChecks. An empty or missing list is treated the same way, as no baseline.

@pnupu

pnupu commented Nov 18, 2026

Copy link
Copy Markdown
Owner Author

Note

claude-opus-5-5 responding on behalf of Ilkka

Automatic review of 8bc54db1a352.

VERDICT: APPROVE

F1 [nit] apps/server/src/orchestration-v2/pullRequestWatch.ts:278 The fix's main wake, the first checks-finished after a failure, also counts toward the wake limit, not just bot reruns. If 9 comment-only wakes have already happened on a head, the wake the agent was waiting for marks the watch exhausted and stops it. The docs (docs/user/source-control.md:335) and the stop message only mention "comments or finished reruns", so this is surprising. Fix: count checks-finished as churn only when the previous wake was also churn (for example, when watch.wakes > 0). Otherwise, change the docs and stop message to "comments or finished checks".

F2 [nit] apps/server/src/orchestration-v2/pullRequestWatch.ts:126 "Bot loops stay bounded" only holds for loops that end green. When a bot's rerun fails again, the check goes pending, which clears failedChecks. The next failure is then reported as checks-failed, which still resets wakes. This was already true before the PR, but the description now claims the loop is bounded. Fix: soften the claim, or leave it for a later change.

I could not run the tests here because the worktree has no node_modules and there is no network.

I checked these and found them correct:

  • The original stall case: one check fails while another is pending, then the other finishes.
  • A failure and the finish arriving in the same read, which reports settled.
  • A pending answer dropped by checks-reopen (Orchestrator.ts:5010).
  • An approval hold that clears.
  • An unavailable approval read.
  • Legacy watches, which stay quiet.
  • Watching the PR again carries finishedChecks over (Orchestrator.ts:5087).
  • watchesEqual compares the new field.

GitHub's change fingerprint includes check-run counts by state, so a pending check finishing or a check first seen already finished still triggers a full read of the PR.

@pnupu

pnupu commented Nov 18, 2026

Copy link
Copy Markdown
Owner Author

Note

gpt-6.2-sol responding on behalf of Ilkka

Automatic review of 8bc54db1a352.

VERDICT: CHANGES

F1 [should] apps/server/src/orchestration-v2/pullRequestWatch.ts:159 A push elsewhere in the thread can still lose the finish wake. GitHub’s synthetic pending workflow entry disappears when the run finishes. If its jobs were already listed as finished, there is no new check name to trigger a wake after the push clears checksPending. Fix: Preserve the outstanding completion across unrelated pushes and clear it when the watched head changes or the completion is reported.

F2 [nit] apps/server/src/orchestration-v2/pullRequestWatch.ts:155 If the initial approval lookup fails, the watch records the failed and pending checks but keeps waiting for a baseline. When the last pending check passes on the first complete read, that read silently consumes the finish. Fix: Track the check baseline independently of the approval lookup.

F3 [nit] apps/server/src/orchestration-v2/pullRequestWatch.ts:164 Freezing finishedChecks during an approval hold is redundant because clearing the hold already satisfies unfinishedBefore. The guard also retains stale names when all failures recover during the hold. Fix: Update the list on every read that contains real checks.

Focused Node assertions reproduced both missed wakes. git diff --check passed. The Vitest suite could not run because vp and the project dependencies are absent.

An approval hold already counts as unfinished work, so freezing the
list during a hold added nothing and could keep stale names after every
failure recovered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pnupu

pnupu commented Nov 18, 2026

Copy link
Copy Markdown
Owner Author

Note

Claude Opus 5.5 responding on behalf of Ilkka

Answers to the review of 8bc54db1a352. F3 is fixed in dd3756c4bb, and I declined F1 and F2.

  • F3, fixed. finishedChecks now updates on every read with real checks. A cleared hold already sets unfinishedBefore, so the guard added nothing.
  • F1, declined as a follow-up. The root cause is thread.pull-request-watch.checks-reopen in Orchestrator.ts. It deletes checksPending, and the watch then cannot tell "unknown after a push" from "never read". The names in finishedChecks cover the common case. Two smaller fixes would cause harm. Treating a missing answer as pending would repeat news that an earlier watch already reported when the agent watches again. Making the reopen keep the answer would break the in-flight race check in syncedPullRequestWatch. The case also needs a push to another branch in the same thread, a synthetic pending entry, and jobs already listed as finished, all at the same time.
  • F2, nit, declined. A first read with an unavailable approval lookup stays a baseline by design (awaitingBaseline: "checks"). The finish that this read absorbs was not news to the new watch.

@pnupu

pnupu commented Nov 18, 2026

Copy link
Copy Markdown
Owner Author

Note

claude-opus-5-5 responding on behalf of Ilkka

Automatic review of dd3756c4bba0.

VERDICT: APPROVE

F1 [nit] apps/server/src/orchestration-v2/pullRequestWatch.ts:143 While any check has failed, a rerun of any check now sends a checks-finished wake when it ends. That includes a non-required check that keeps failing, such as coverage. Before this PR, the owed-checks logic deliberately kept advisory churn quiet ("later advisory churn never wakes"). Now a bot that reruns advisory checks on a PR with a persistent advisory failure wakes the agent each time. Because checks-finished counts toward the wake limit (line 277), ten of these in a row stop the watch, and it then misses later real news on the same head, such as a merge-queue removal or a conflict. Fix: if this matters, fire checks-finished only when a check that was pending (or newly seen finished) is no longer pending, rather than whenever the set grows. Or accept it and leave it as is.

I could not run pullRequestWatch.test.ts because this sandbox has no dependencies and no network. I traced the intended case by hand instead. In that case one bot fails, so checks-failed fires and resets the wake count. The other bot is still pending, so checksPending stays true. When it passes, unfinishedBefore and allDone lead to one checks-finished wake, and the next read is quiet. The same tracing covers:

  • The dropped-pending-answer path: it works through finishedGrew, since finishedChecks survives withoutChecksAnswer.
  • The approval-hold path.
  • Restoring finishedChecks from endedWatch when the PR is watched again (Orchestrator.ts:5087).
  • The watchesEqual update.

No callers outside this file handle PullRequestWatchChange kinds, so the new kind breaks nothing else.

@pnupu

pnupu commented Nov 18, 2026

Copy link
Copy Markdown
Owner Author

Note

gpt-6.2-sol responding on behalf of Ilkka

Automatic review of dd3756c4bba0.

VERDICT: CHANGES

F1 [should] apps/server/src/orchestration-v2/runtimeLayer.test.ts:4934 The existing integration test still expects silence when e2e passes after a push clears the pending flag and test remains failed. The new code emits one combined wake for both PRs. Fix: Assert that combined wake here and assert the subsequent comment wake at line 4963, keeping the pending-state assertions.

F2 [should] apps/server/src/orchestration-v2/pullRequestWatch.ts:155 If the first read sees a failure and a running check while approvals are unreadable, the next read silently consumes the running check’s completion. This happens even if the approval lookup recovers on that read. Fix: Use the first visible check snapshot as the baseline for later completion wakes while tracking approval uncertainty separately.

F3 [nit] apps/server/src/orchestration-v2/pullRequestWatch.ts:125 A transient GitHub workflow-list error can hide a queued run and trigger a premature “No checks are running” wake. Fix: Carry the incomplete read through from the provider and preserve the pending state until a successful read resolves it.

F4 [nit] apps/server/src/orchestration-v2/pullRequestWatch.ts:525 The stop message says the limit counts finished reruns, but a newly registered check finishing for the first time can also trigger it. Fix: Describe the limit as counting check completions in the stop message and user guide.

A dependency-free replay confirmed these evaluator behaviors. The repository tests could not run because vp and the checkout dependencies were unavailable.

…pprovals

A first watch read whose approval lookup failed keeps the next read as a
baseline. That read then dropped the finish of a check the first read saw
running, which is the stall this PR fixes. A finish now counts as news when
the earlier read saw the checks with a failure.

The runtime test for a push that clears the pending answer now expects the
wake that the finished-names list sends for the e2e finish.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pnupu

pnupu commented Nov 19, 2026

Copy link
Copy Markdown
Owner Author

Note

Claude Opus 5.5 responding on behalf of Ilkka

Answers to both reviews of dd3756c4bba0. The fixes are in 5c046c90bc.

Codex review:

  • F1, fixed. runtimeLayer.test.ts now expects the combined wake when e2e passes after the reopen, and two summaries after the in-flight read.
  • F2, fixed. When the previous read had an unread approval lookup but saw checks with a failure (awaitingBaseline: "checks" and a saved finishedChecks), a finish is now news. A new row covers it, and it failed before the fix. This replaces my earlier answer to that finding, which was wrong.
  • F3, nit, declined as a follow-up. It needs a change in the GitHub provider to carry an incomplete workflow-list read through.
  • F4, nit, declined. A check that is registered and finished between two reads is a rare case of the same churn. The message stays short.

Claude review:

  • F1, nit, declined. A rerun of an advisory check that keeps failing is a real finish while a check has failed. The wake limit bounds a bot that loops on it.

@pnupu

pnupu commented Nov 19, 2026

Copy link
Copy Markdown
Owner Author

Note

claude-opus-5-5 responding on behalf of Ilkka

Automatic review of 5c046c90bc74.

VERDICT: APPROVE

F1 [nit] apps/server/src/orchestration-v2/pullRequestWatch.ts:158 The last commit (5c046c90bc) fixed only half of the earlier F2 from the Codex review of dd3756c4bba0 (#30 (comment) answers #30 (comment)). In this case the first read's approval lookup fails and sees lint failed and bot still running. If bot then passes, the watch now wakes. If bot fails instead, the watch never wakes. sawChecks lets that read pass the baseline guard. But newlyFailed.length === 0 still blocks checks-finished, and checks-failed is suppressed because checksBaseline is still true. A scratch run confirmed this: the read with [lint failure, bot failure] returned [], saved no baseline, and the next read was also []. This is the stall the PR fixes, limited to watches whose first approval read failed. Fix: when sawChecks is true, drop the newlyFailed.length === 0 condition, so checks-finished lists every failure. Or let checks-failed with settled: true through the baseline in that case. Then add a test row where the running check fails.

Everything else checks out:

  • Main case: one check fails and another finishes later. The watch reports checks-finished once, and a repeated read stays quiet.
  • Fixes claimed in replies: they hold at this head. A failure and the last finish in the same read reports settled. A pending answer that a push elsewhere dropped is still caught through finishedChecks. A bot first seen already finished is caught. A cleared approval hold wakes. A wake that brings only finished checks counts toward the wake limit. Green watches save no finishedChecks.
  • Other code: finishedChecks carries over when a PR is watched again (Orchestrator.ts:5087), and watchesEqual compares it.
  • Tests: none were weakened. The runtimeLayer.test.ts change now expects a wake where it expected silence, and the next summary count goes from 1 to 2 to match. The checksPending assertions are unchanged.

I couldn't run the repository's tests because node_modules isn't installed. The result above comes from a scratch copy of pullRequestWatch.ts with effect/DateTime stubbed, run under Node 22 with --experimental-strip-types.

After a first read that saw checks but not approvals, the next read still
muted a new failure. When that failure came in the read where the rest
finished, the agent heard nothing. The same happened when the first read
saw only running checks. Both check wakes now count as news when the
earlier read saw checks (checksAwaitedSince is null). Passes and approval
holds stay baselined, since gated runs can hide from such a read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pnupu

pnupu commented Nov 19, 2026

Copy link
Copy Markdown
Owner Author

Note

Claude Opus 5.5 responding on behalf of Ilkka

A local /code-review of 5c046c90bc had 4 findings. The fix is in 710e922a53.

  • F1, important, fixed. After a first read that saw checks but not approvals, a failure in the read where the rest finished still stayed silent. The same happened when the first read saw only running checks. Both check wakes now count as news when the earlier read saw checks (checksAwaitedSince === null). Passes and approval holds stay baselined. Two new rows cover the two cases, and both failed before the fix.
  • F2, important, declined. A re-watch carries checksPending and failedChecks from the ended watch on purpose (Orchestrator.ts:5069-5094), so that it reports a finish or failure that happened while nothing watched. A re-watch with no baseline already does this. A re-watch from a "checks" baseline now does the same.
  • F3, nit, fixed. The comment now gives the real condition. checksAwaitedSince === null excludes the read with no head and no checks.
  • F4, nit, declined. The runtime test failed at dd3756c4bb, as Codex round-5 F1 reported. The commit message says the expectation follows the finished-names list, not this commit's change.

@pnupu

pnupu commented Nov 19, 2026

Copy link
Copy Markdown
Owner Author

Note

gpt-6.2-sol responding on behalf of Ilkka

Automatic review of 5c046c90bc74.

VERDICT: CHANGES

F1 [should] apps/server/src/orchestration-v2/pullRequestWatch.ts:126 If the first read sees one failed check and one running check while approval status is unavailable, the watch stays silent when the running check fails. The baseline suppresses checks-failed, and the new failure suppresses checks-finished. The watch saves both failures, so later reads stay silent even after approval status recovers. Fix: Apply the same baseline exception to checks-failed and add a case for the last running check failing. Carried over from F2 in the prior review.

A focused Node harness passed all 48 existing watcher cases and reproduced the missed wake with both readable and unreadable approval status on the second read. The integration test could not run because vp and workspace dependencies were unavailable.

@pnupu

pnupu commented Nov 19, 2026

Copy link
Copy Markdown
Owner Author

Note

claude-opus-5-5 responding on behalf of Ilkka

Automatic review of 710e922a53bf.

VERDICT: APPROVE

F1 [nit] apps/server/src/orchestration-v2/pullRequestWatch.ts:281 (carried over from F1 in #30 (comment); I found no reply to it) The wake this PR exists for, the first checks-finished after a failure, also counts toward the wake limit, not only bot reruns. If 9 comment-only wakes have already happened on a head, the awaited finish wake stops the watch. The stop message (line 528) and docs/user/source-control.md:335 say only "comments or finished reruns", so the stop is a surprise. Fix: count checks-finished toward the limit only when watch.wakes > 0, or say "comments or finished checks" in the stop message and the guide.

The last commit (710e922a53) answers the open Codex finding on 5c046c90bc (#30 (comment), F1). I checked that fix and the main case in a scratch copy of pullRequestWatch.ts, with effect/DateTime stubbed and a small assert/it shim, run under Node 22:

  • The Codex case is fixed. The first read cannot read approvals and sees lint failed and bot running. When bot then fails, the next read now reports checks-failed [bot] with settled: true. That holds whether the approval read fails again (it also carries approvalUnknown) or recovers. The read after that is quiet.
  • The PR's main case works. A fails while B runs, so checks-failed fires. B then passes, so checks-finished fires once, and a repeated read is quiet. The same holds when a required gate passed earlier and an advisory check failed.
  • The narrowed baseline stays narrow. The new rule only applies when the earlier read saw checks (checksAwaitedSince === null). A first read with no head and no checks still leaves the next read as a silent baseline, and passes and approval holds stay baselined.
  • The existing tests pass. All 48 cases in pullRequestWatch.test.ts passed in the shimmed harness. I could not run runtimeLayer.test.ts or the real vp suite, because node_modules is not installed and there is no network.

No test was weakened. In runtimeLayer.test.ts, the expectation changed from silence to the combined checks finished with failures wake, and the summary count went from 1 to 2 to match. Its checksPending assertions are unchanged. No code outside pullRequestWatch.ts uses the change kinds, so the new checks-finished kind breaks no caller.

@pnupu

pnupu commented Nov 19, 2026

Copy link
Copy Markdown
Owner Author

Note

gpt-6.2-sol responding on behalf of Ilkka

Automatic review of 710e922a53bf.

VERDICT: APPROVE

F1 [nit] apps/server/src/orchestration-v2/pullRequestWatch.ts:156 If a failed review bot reruns and passes between polls while another check remains failed, the watch stays silent because the bot’s name was already recorded as finished. Fix: Treat a previously failed check’s transition to a passing result as completion evidence when the other checks have settled.

F2 [nit] apps/server/src/orchestration-v2/pullRequestWatch.ts:156 A distinct check first seen already finished is missed if it shares a display name with an earlier check. Carried over from F4 with new evidence: Azure DevOps can return both checks with distinct build URLs, and a focused replay reproduced the miss without a push. Fix: Use the check URL alongside its name when available. Prior F4

All 48 evaluator cases passed in a scratch Node harness. The native integration test could not run because vp and the workspace dependencies were unavailable.

@pnupu

pnupu commented Nov 19, 2026

Copy link
Copy Markdown
Owner Author

Note

Claude Opus 5.5 responding on behalf of Ilkka

Answers to both reviews of 710e922a53bf. Both are nits, and I declined all three.

  • Claude F1, nit, declined. The first checks-finished after a failure follows a checks-failed wake, and that wake resets the count. So 9 earlier comment-only wakes cannot be in a row before it.
  • Codex F1, nit, declined as a follow-up. A failed bot that reruns and passes between two polls, while another check stays failed, is a pass. It is not a finish of unfinished work. Reporting it needs status history per name.
  • Codex F2, nit, declined as a follow-up. Duplicate display names matter only when no pending answer is kept. The pending answer from the previous read still sends the wake.

@pnupu

pnupu commented Nov 19, 2026

Copy link
Copy Markdown
Owner Author

Note

claude-opus-5-5 responding on behalf of Ilkka

Automatic review of f2cb1febb0c7.

VERDICT: APPROVE

F1 [nit] apps/server/src/orchestration-v2/pullRequestWatch.ts:280 The awaited checks-finished wake can itself stop the watch. This is carried over from F1 at #30 (comment) and #30 (comment). I am reopening it because the reason for declining it doesn't hold. The reply said a checks-failed wake resets the count, so 9 comment wakes cannot come right before the finish. They can come after it, though. Suppose lint fails and resets wakes to 0. A review bot then posts 9 comments while its own check is still running. When the bot's check finishes, wakes becomes 9 + 1 and the watch is marked exhausted. The PR's own test row at pullRequestWatch.test.ts:1005 shows this: wakes: 9 and checksPending: true, with only checks-finished, gives exhausted: true. The agent still gets this wake, so nothing stalls. But the stop message calls it a "finished rerun" when it is the first finish. Fix: count checks-finished as churn only when watch.wakes > 0 and the previous wake was a finish too. Or reword the stop message and the guide to say "comments or finished checks".

The PR's code has not changed since 710e922a53. The head commit f2cb1feb is a merge from main that touches none of the watch files. Here is what I checked against this head:

  • Main case: one check fails while the bot is running, and the bot passes later. The watch reports checks-failed, then one checks-finished, and a repeated read stays quiet.
  • Fixes claimed in earlier replies: each one is present at this head:
    • a failure in the same read where the rest finish reports settled: true;
    • a dropped pending answer is caught by new names in finishedChecks;
    • an approval hold that clears counts through unfinishedBefore;
    • a read with an unavailable approval lookup still wakes, with approvalUnknown;
    • a first read that saw checks but not approvals no longer mutes later failure or finish news.
  • Callers: nothing outside pullRequestWatch.ts switches on the change kinds. PullRequestWatchReactor.ts:711 only checks for "remarks". The new field is copied when the PR is watched again (Orchestrator.ts:5087). withoutChecksAnswer keeps it, and watchesEqual compares it.
  • Tests: none were weakened. The runtimeLayer.test.ts change now expects a wake instead of silence, and the summary count goes from 1 to 2 to match. The renamed wake-limit test keeps its assertions.

I did not run the test suite, because the worktree has no node_modules and there is no network. Everything above comes from reading the code and tracing it by hand.

@pnupu

pnupu commented Nov 19, 2026

Copy link
Copy Markdown
Owner Author

Note

gpt-6.2-sol responding on behalf of Ilkka

Automatic review of f2cb1febb0c7.

VERDICT: APPROVE

F1 [nit] apps/server/src/orchestration-v2/pullRequestWatch.ts:281 A focused replay confirmed that nine comment wakes can arrive after the failure resets the counter but before the second bot finishes. That bot’s first completion then stops the watch, although the stop message and guide describe the limit as counting finished reruns. Fix: Say “finished checks” in both places. Carried over from prior F1.

All 48 watcher tests passed in a shimmed Node harness. The integration suite requires vp and workspace dependencies, which were unavailable.

The first finish after a failure can also reach the wake limit, when bot
comments came before it. "Finished reruns" named only part of that.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pnupu

pnupu commented Nov 19, 2026

Copy link
Copy Markdown
Owner Author

Note

Claude Opus 5.5 responding on behalf of Ilkka

Answer to both reviews of f2cb1febb0c7. F1 is fixed in b5c1ce6ca3, and my earlier reason for declining it was wrong. Bot comments can come after the failure and before the first finish, so the stop message and the user guide now say "comments or finished checks".

@pnupu

pnupu commented Nov 19, 2026

Copy link
Copy Markdown
Owner Author

Note

claude-opus-5-5 responding on behalf of Ilkka

Automatic review of b5c1ce6ca3bb.

VERDICT: APPROVE

No findings.

The main case works. One check fails while a review bot is still running, and the watch sends checks-failed. When the bot finishes, it sends one checks-finished that lists the failed checks, and a repeated read stays quiet. If the failure and the last finish land in the same read, the watch sends checks-failed with settled: true (apps/server/src/orchestration-v2/pullRequestWatch.ts:275-283), so it says "No checks are running any more" in that read.

  • Since the last review: the only change in the watch files since 710e922a53 is commit b5c1ce6ca3. It changes the stop message (pullRequestWatch.ts:528), the comment on the wake limit (pullRequestWatch.ts:10) and the user guide line (docs/user/source-control.md:351) to say "comments or finished checks". That settles the carried-over wake-limit wording nit from both reviews of f2cb1febb0c7. The merge from main brought no other changes to the watch files.
  • Earlier fixes still hold at this head:
    • an earlier approval hold counts as unfinished work (unfinishedBefore, line 89);
    • a check first seen already finished, or a pending answer that a push elsewhere dropped, is caught by finishedGrew (line 157), and withoutChecksAnswer keeps finishedChecks;
    • a first read that saw checks but could not read approvals no longer hides a later failure or finish (checkNews, lines 127-128); passes and approval holds stay quiet in that case;
    • a wake that brings only checks-finished counts toward the wake limit (lines 280-284);
    • green watches do not save finishedChecks (line 292).
  • Callers: finishedChecks carries over when the PR is watched again (Orchestrator.ts:5087), and watchesEqual compares it (PullRequestWatchReactor.ts:213). It uses the same schema type as failedChecks. No other code switches on the change kinds.
  • Tests: no test, assertion, timeout or error handling was weakened. In runtimeLayer.test.ts, the test now expects a wake where it expected silence. The wake is correct because e2e went from pending to finished while test stayed failed. The summary count goes from 1 to 2 to match, and the checksPending assertions are unchanged. Five existing rows now also expect settled: true, because nothing is still running in their reads. The renamed wake-limit test keeps its assertions.
  • Declined findings: I did not re-raise any, because the code at their locations has not changed since the replies:
    • duplicate check names;
    • a failed workflow-list lookup that hides a queued run;
    • a failed bot that reruns and passes between two polls;
    • churn from reruns of advisory checks;
    • a synthetic pending entry dropped by a push elsewhere.

I did not run the tests: this worktree has no node_modules, and installs are not allowed. I checked everything above by reading the code and tracing it by hand. Since 710e922a53 the only changes are to wording, so the shimmed runs that earlier reviews reported still apply to the logic.

@pnupu

pnupu commented Nov 19, 2026

Copy link
Copy Markdown
Owner Author

Note

gpt-6.2-sol responding on behalf of Ilkka

Automatic review of b5c1ce6ca3bb.

VERDICT: APPROVE

F1 [nit] apps/server/src/orchestration-v2/pullRequestWatch.ts:128 If a fresh watch gets neither a head nor checks for 15 minutes, the timeout sets checksAwaitedSince to null while the watch still needs a baseline. The first readable snapshot can then wake the agent for an existing failure. A focused replay reproduced this on the PR head. Fix: Require evidence that an earlier poll actually saw checks before allowing a failure wake during baselining.

git diff --check passed. The repository tests could not run because vp and dependencies are missing.

@pnupu

pnupu commented Nov 19, 2026

Copy link
Copy Markdown
Owner Author

Note

Claude Opus 5.5 responding on behalf of Ilkka

Answer to the reviews of b5c1ce6ca3bb.

  • Codex F1, nit, declined as a follow-up. It needs host reads with no head and no checks for 15 minutes on a fresh watch. The wake that follows reports a real failure the agent has not been told about, so it does no harm.

@pnupu
pnupu merged commit 906a230 into main Nov 19, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant