test(a2a): lock in that CancelTask halts the running turn - #341
Conversation
Investigated under #338, which claimed the stop button was cosmetic. It isn't: `ActiveTask.cancel` cancels the producer task before calling `ProtoPenExecutor.cancel`, so CancelledError propagates into our stream and the turn stops. The original report was confounded — during the #337 runaway I cancelled 8 tasks while ~2,000 turns ran concurrently, so nothing observable changed and I misread that as a no-op. Nothing covered the property, and it rests entirely on a2a-sdk internals that `a2a_registry` already documents as liable to move on an SDK bump. So pin it: start a long turn, cancel it mid-flight, assert the stream stops advancing and observes CancelledError. Verified to bite — neutering the producer cancellation (leaving only the status write, i.e. exactly what #338 described) fails this with "turn kept working after cancel (18 → 44 ticks)". Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Warning Review limit reached
Next review available in: 53 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Follow-up to #338 — which I filed wrongly and have closed as invalid. This ships the regression test instead of a fix.
What happened
I reported that
CancelTaskonly marked the row canceled while inference kept running. That was a misread. Verified against a real a2a-sdk app wired exactly asserver/a2a.pymounts it:ActiveTask.cancel(a2a-sdkactive_task.py:702-711) cancels the producer task before callingProtoPenExecutor.cancel, so CancelledError propagates into our stream. Our executor only publishing the status is correct, not cosmetic.The original evidence was confounded: during the #337 runaway I cancelled 8 tasks while ~2,000 turns were running concurrently (every
SendMessagegets its own producer task; they serialize under contention, which is why throughput looked like ~1 cycle/min). Cancelling 8 of 2,000 changed nothing observable.Why ship anything
The property is real but entirely dependent on SDK internals, and
a2a_registry.pyalready documents that an SDK bump can move exactly these internals (protoAgent #1713) — it degrades to a logged warning rather than a crash, so a regression here would be silent. Nothing covered it.The test starts a long turn, cancels it mid-flight, and asserts the stream stops advancing and observes
CancelledError.Verified to bite: neutering the producer cancellation — leaving only the status write, exactly the behavior #338 described — fails it with
turn kept working after cancel (18 → 44 ticks), with the task still reportingTASK_STATE_CANCELED.36 passedintest_a2a_handler.py; ruff check + format clean.🤖 Generated with Claude Code