Repository navigation
test(runtime): stabilize early cancellation checks - #14849
xianlubird wants to merge 2 commits into
Conversation
Signed-off-by: xianlubird <xianlubird@gmail.com>
|
/ok to test 11ff4ef |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 12 included reviews per hour; 11 remain after this review. WalkthroughThe cancellation tests now use an event to acknowledge worker cancellation. A shared helper drains responses, waits for acknowledgement, and verifies context state. Two cancellation tests use the helper and 15-second timeouts. ChangesCancellation test synchronization
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to The cancellation tests synchronize with the worker acknowledgement without a supported regression or merge-blocking risk. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Comment |
Signed-off-by: xianlubird <xianlubird@gmail.com>
|
/ok to test 4b5f2ea |
|
This is covered by #14974, which has already landed on main. It drains responses that were already in flight and waits for the worker to observe cancellation, so the fix in this PR would duplicate it. I'm closing this PR rather than carrying the duplicate change through the merge conflict. |
Summary
Make the early-cancellation tests wait for stream closure and worker acknowledgement instead of assuming cancellation prevents every response from reaching the client.
I encountered this while running CI for #14846 (
fix(responses): preserve text instead of inferring tool calls), at headf41e5dcd531c3d4116b7238535b5111658104484. That PR changes the Responses converter and its Rust coverage; the failing test uses the runtime client directly. This follow-up keeps the cancellation-test fix separate from the Responses change.CI failure
The failed job was
dynamo-runtime / test / sequential cuda13.0, amd64. It reported:The worker log shows the ordering:
The cancellation reached the worker about 120 ms after the request. The mock yields every 100 ms, so a response was already in flight.
dynamo-status-checkthen failed because this job failed. Rust tests, Clippy, the arm64 sequential job, and the backend tests passed. The matching job passed in the three main runs inspected, so this is not a claim that the exact CI failure was also reproduced on main.Why this changes the assertion
client.generate()schedules the Rust future immediately; awaiting the returned Python future does not start the request.stop_generating()signals cancellation asynchronously, and the response stream may still deliver buffered data. Requiring zero responses therefore depends on cancellation winning a scheduling race.Both the already-cancelled and cancel-before-await tests now drain in-flight responses and require stream closure plus an explicit event from the mock worker when it observes cancellation, within a shared 5-second deadline. They retain the stopped/not-killed assertions. A 15-second pytest timeout bounds the overall test, and the event replaces the fixed 200 ms wait. Production runtime behavior is unchanged.
Validation
Annotated(data=0)assertion failure. This demonstrates the ordering assumption rather than reproducing the exact CI scheduling delay.No workers availablediscovery error stopped the batch. A separate delayed TCP batch passed all 10 repetitions.git diff --checkpassed.These checks used macOS arm64, Python 3.12.7, the existing local Dynamo extension, NATS 2.12.14, and etcd 3.5.33. The exact private ECR CI image was unavailable without registry credentials; the extension was not rebuilt from the PR.
Related Issues
Summary by CodeRabbit