tests: fix pr_events race between the eval result and the closed webhook #19

Closed
kris wants to merge 1 commit from fix-flaky-pr-closed into main
Owner

pr_events::closed_cancels_the_graph_but_lets_an_effectful_task_finish failed in 3 of 8 local runs once all the control-plane suites share one test process (#18). It passed 10/10 when run alone.

The extra Cancel it saw was for the eval instance, not the effectful deploy. The eval's Succeeded event travels over the agent WebSocket, while the closed webhook arrives over HTTP and can overtake it. The control plane then correctly cancels an eval it still sees as running. So this is a race in the test, not a control-plane bug.

The fix adds common::wait_task_state and waits for the eval to be terminal before posting closed.

🤖 Generated with Claude Code

`pr_events::closed_cancels_the_graph_but_lets_an_effectful_task_finish` failed in 3 of 8 local runs once all the control-plane suites share one test process (#18). It passed 10/10 when run alone. The extra Cancel it saw was for the **eval** instance, not the effectful `deploy`. The eval's `Succeeded` event travels over the agent WebSocket, while the `closed` webhook arrives over HTTP and can overtake it. The control plane then correctly cancels an eval it still sees as running. So this is a race in the test, not a control-plane bug. The fix adds `common::wait_task_state` and waits for the eval to be terminal before posting `closed`. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
tests: wait for the eval before closing the PR in pr_events
Some checks failed
krisbuild/kris/krisbuild/nix/workspace-deps cached
krisbuild/kris/krisbuild/nix/hello cached
krisbuild/kris/krisbuild/nix/world cached
krisbuild/kris/krisbuild/nix/build cached
krisbuild/kris/krisbuild/nix/clippy cached
krisbuild/kris/krisbuild/nix/kb-check cached
krisbuild/kris/krisbuild/nix/test failed on nuxbox (timeout)
krisbuild/kris/krisbuild krisbuild kris/krisbuild: one or more tasks failed
krisbuild/queue the pull request was closed
70c9a8c3b3
The agent's eval `Succeeded` travels over the WebSocket while the
`closed` webhook arrives over HTTP; under load the webhook overtakes it,
the control plane correctly cancels the still-running eval, and the
"never yanked" assertion sees that extra Cancel. Failed 3 of 8 runs
with all control-plane suites in one process; wait for the eval to be
terminal first.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Author
Owner
@krisbuild r+
Collaborator

The pull request head's own build failed (graph 600).

  • nix/test: exit-code on nuxbox, exit 1 — log

Push a fix, or comment @krisbuild retry to rerun the failed tasks and requeue.

The pull request head's own build failed ([graph 600](http://192.168.0.2:1337/ui/graphs/600)). - `nix/test`: exit-code on nuxbox, exit 1 — [log](http://192.168.0.2:1337/ui/instances/17689) Push a fix, or comment `@krisbuild retry` to rerun the failed tasks and requeue.
Author
Owner

Superseded by #20, which landed the same pr_events eval wait (plus common::wait_task_state). Closing.

Superseded by #20, which landed the same `pr_events` eval wait (plus `common::wait_task_state`). Closing.
kris closed this pull request 2026-09-27 22:00:13 +02:00
Collaborator

Removed from the merge queue: the pull request was closed.

Removed from the merge queue: the pull request was closed.
Some checks failed
krisbuild/kris/krisbuild/nix/workspace-deps cached
krisbuild/kris/krisbuild/nix/hello cached
krisbuild/kris/krisbuild/nix/world cached
krisbuild/kris/krisbuild/nix/build cached
krisbuild/kris/krisbuild/nix/clippy cached
krisbuild/kris/krisbuild/nix/kb-check cached
krisbuild/kris/krisbuild/nix/test failed on nuxbox (timeout)
krisbuild/kris/krisbuild krisbuild kris/krisbuild: one or more tasks failed
krisbuild/queue the pull request was closed

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kris/krisbuild!19
No description provided.