Skip to content

Stop the watchdog before a parked run resumes its step - #121

Merged
swerner merged 1 commit into
mainfrom
fix-watchdog-pause-test
Oct 13, 2026
Merged

swerner merged 1 commit into
mainfrom
fix-watchdog-pause-test

Conversation

@swerner

@swerner swerner commented Oct 13, 2026

Copy link
Copy Markdown
Contributor

What

Fixes the flaky a_pause_parks_the_watchdog test, and the same shape in a_pending_question_parks_the_watchdog, in crates/petri/lib/tests/controls.rs.

Why

Main's CI is red on a_pause_parks_the_watchdog after #117, and the same test failed main on October 7 after #78. It has also tripped locally under full parallel load. Neither change touched the watchdog or the controls.

The test pauses a run with a 400 ms stall budget, waits 1.2 s, then unpauses. The unpause restarts the full budget, and the run's next action is a host step, which launches the host plugin and creates a sandbox. The CI output shows the plugin starting 60 ms after the unpause and the test ending with the watchdog tripped 850 ms later: the launch took longer than the budget with no activity record in between. That is wall-clock latency on a loaded runner, not idleness, and not what the test is proving.

The question test has the same shape with a 1 s budget. It has not been seen failing, but it would under the same conditions.

Fix

Each test stops the watchdog before it unparks the run: the pause test before its unpause, the question test before its answer. The three parked budgets with nothing running remain the proof that a pause or a pending question parks the clock. An unpause restarting the full budget is covered by the watchdog's own unit test, which runs under paused time.

No engine code changes.

Verification

  • mise run fmt:check, cargo clippy -p petri --all-targets --all-features -D warnings
  • Both tests six times in a row, and the whole controls binary three times, all green.
  • Twelve CPU burners did not reproduce the old failure on an M-series Mac, so the CI evidence above is the basis for the diagnosis.

🤖 Generated with Claude Code

The two watchdog integration tests prove that a pause or a pending
question parks the stall clock: the run waits for three budgets with
nothing running and is not cancelled. Both then let the run continue
into a host step with the watchdog still armed, so the step's sandbox
launch was measured against the budget too. On a loaded CI runner that
launch took longer than the 400 ms budget and the pause test tripped,
on main as well as on unrelated branches.

Now each test stops the watchdog before it unparks the run: the pause
test before its unpause, the question test before its answer. The three
parked budgets remain the proof. An unpause restarting the full budget
is covered by the watchdog's own unit test with paused time.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@swerner
swerner merged commit 560d819 into main Oct 13, 2026
4 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