Skip to content

test(agent): wait for cancel ack before releasing the gated round-2 response - #5293

Open
Chessing234 wants to merge 1 commit into
block:mainfrom
Chessing234:fix/cancelled-turn-usage-flaky-4945
Open

test(agent): wait for cancel ack before releasing the gated round-2 response#5293
Chessing234 wants to merge 1 commit into
block:mainfrom
Chessing234:fix/cancelled-turn-usage-flaky-4945

Conversation

@Chessing234

@Chessing234 Chessing234 commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

cancelled_turn_with_usage_emits_notification_before_response failed 1-4 of 20
runs. h.send(session/cancel) only writes the request to stdin; it does not prove
the agent processed it. Releasing the round-2 HTTP gate immediately afterward
let the gated response resolve before the cancel was handled, so the prompt
could return a race-driven error stopReason instead of cancelled.

Drain frames until the cancel acknowledgement (collecting any usage frames that
arrive first) before releasing the gate, so stopReason: cancelled is
deterministic and the usage-before-response ordering still holds.

Closes #4945

@Chessing234
Chessing234 requested a review from a team as a code owner August 8, 2026 06:07
…esponse

cancelled_turn_with_usage_emits_notification_before_response failed 1-4 of 20
runs. h.send(session/cancel) only writes the request to stdin; it does not prove
the agent processed it. Releasing the round-2 HTTP gate immediately afterward
let the gated response resolve before the cancel was handled, so the prompt
could return a race-driven error stopReason instead of cancelled.

Drain frames until the cancel acknowledgement (collecting any usage frames that
arrive first) before releasing the gate, so stopReason: cancelled is
deterministic and the usage-before-response ordering still holds.

Closes block#4945

Signed-off-by: Taksh <takshkothari09@gmail.com>
@Chessing234
Chessing234 force-pushed the fix/cancelled-turn-usage-flaky-4945 branch from 706a659 to 5ceab12 Compare August 8, 2026 14:02
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.

Intermittent test panic in cancelled_turn_with_usage_emits_notification_before_response

1 participant