Skip to content

Stabilize abort task follow-up handling#13874

Merged
aibrahim-oai merged 5 commits intomainfrom
dev/flaky-abort-interrupt-follow-up
Mar 8, 2026
Merged

Stabilize abort task follow-up handling#13874
aibrahim-oai merged 5 commits intomainfrom
dev/flaky-abort-interrupt-follow-up

Conversation

@aibrahim-oai
Copy link
Collaborator

@aibrahim-oai aibrahim-oai commented Mar 7, 2026

What changed

  • The interrupt path now cancels the running task before clearing pending turn state.
  • Follow-up model requests are suppressed once cancellation has won the race.
  • The tests were rewritten to assert on stabilized outbound request counts instead of sleeping and then checking whatever state happened to exist.

Why this fixes the flake

  • The flake was partly a real bug and partly a test-design issue.
  • In production, clearing state before task cancellation finished still left a window where a background path could emit an unwanted follow-up /responses request or record the wrong history entry.
  • In tests, fixed sleeps made that race show up nondeterministically because the assertion sometimes ran before cancellation had fully propagated.
  • Reordering cancellation before cleanup removes the underlying bug, and polling request counts makes the tests wait for the actual invariant: no extra requests after interrupt.

Scope

  • Production logic change with matching test coverage.

aibrahim-oai added a commit that referenced this pull request Mar 7, 2026
aibrahim-oai added a commit that referenced this pull request Mar 7, 2026
@aibrahim-oai aibrahim-oai force-pushed the dev/flaky-abort-interrupt-follow-up branch from d7a8dc3 to a382a97 Compare March 7, 2026 19:10
@aibrahim-oai aibrahim-oai force-pushed the dev/flaky-abort-interrupt-follow-up branch from ce4e540 to 8657e11 Compare March 8, 2026 04:08
@charley-oai
Copy link
Collaborator

@codex review this

@aibrahim-oai aibrahim-oai merged commit dc19e78 into main Mar 8, 2026
51 of 53 checks passed
@aibrahim-oai aibrahim-oai deleted the dev/flaky-abort-interrupt-follow-up branch March 8, 2026 06:56
@github-actions github-actions bot locked and limited conversation to collaborators Mar 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants