Repository navigation
test(threads): fix flaky purge cancellation test by releasing the gated child after purge - #8413
Conversation
…settles it purging_threads_cancels_driver_children_and_discards_completions released its gated model 100 ms after a timer started before threads_purge. Purge admits, lists and fences the threads before it cancels the child, and whenever that took longer than 100 ms the child completed on its own, so the job settled Completed and the Cancelled assertion failed (about 1 in 4 runs on main). The product is consistent: once cancel_owned has requested cancellation, a later Ok from the child still settles the job as Cancelled, and the harness races the in-flight model call against the job's cancellation token. So the child needs no release to unwind. Keep it gated until purge returns; if cancellation ever stopped reaching the model call, purge would now hit the test's 6 s timeout instead of passing on timing.
Tiny Sweeper reviewReviewed head: Verdict: Ready for maintainer review · Priority: none Diagnostics and supporting detailsFull summaryPull request purpose (title): test(threads): fix flaky purge cancellation test by releasing the gated child after purge. The prior 100 ms timer could fire before purge's admission/fencing preamble completed, letting the child settle `Completed` instead of the asserted `Cancelled`. No production behavior changes; the latest-push delta is unavailable. Review snapshot
Completeness: Complete What changedA comment explains that the harness races the in-flight model call against the job's cancellation token, so purge's cancel unwinds the child deterministically. The diffstat is 1 file, +6/-11. FeaturesNone identified with supported citations. TestsNo supported feature-to-test mapping was produced. Test execution is not inferred. FindingsNo active actionable findings. Before mergeNone. Agent review detailscritique
security
tests
commits
description
Evidence and run details
|
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Caution Review failedThe pull request is closed. Walkthrough
Merge Risk:
|
Summary
thread_delete_tests::purging_threads_cancels_driver_children_and_discards_completions. It failed in roughly 1 of 4 runs on main, withleft: Some(Completed), right: Some(Cancelled).Problem
threads_purge.threads_purgefirst closes thread admission (spawn_blocking), lists the threads and fences each one. Only then doesrunning_subagents::cancel_allcancel the live driver job.Completed, and theCancelledassertion failed.SubAgentJobRegistry, oncecancel_ownedsetscancellation_requestedunder the controls lock, a laterOkfrom the child still settles asCancelled(mark_driver_result/settle). A child that genuinely finishes before purge cancels it is correctlyCompleted, and its completion is still discarded.Solution
tinyagents-harnessagent_loop/model_call.rs). Purge's cancel therefore unwinds the child deterministically without a release.Submission Checklist
_tests.rsfile changes.Impact
Related
Summary by CodeRabbit