Python: Synchronize workflow preemption test startup - #8525
Eduard van Valkenburg (eavanvalkenburg) merged 1 commit into
Conversation
Wait for the inner stream to block before signalling shutdown or cancellation, independently of the retained preemption deadline. Drain pending test tasks and verify that the blocked call is cancelled before cleanup. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟢 Approval recommended
The focused test-only changes correctly isolate startup timing while preserving preemption assertions and cleanup.
Pull request overview
Separates workflow startup synchronization from preemption deadlines in shutdown and cancellation tests.
Changes:
- Adds readiness and cancellation signals to the mock stream.
- Centralizes pending-task and handler cleanup.
- Preserves one-second post-signal deadlines and verifies actual cancellation.
File summaries
| File | Description |
|---|---|
python/packages/foundry_hosting/tests/test_responses.py |
Synchronizes blocked-call startup and validates preemption cleanup. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Code Coverage OverviewLanguages: Python Python / code-coverage/pythonThe overall line coverage in commit 92582ee in the Show a line coverage summary of the most covered files.
|
There was a problem hiding this comment.
MAF Automated Review — Iteration 1
Result: No findings
Scope: full PR (1 commit(s)): 92582ee738ac
Model: gpt-5.6-sol-fast
Overview
This test-only change moves readiness signaling to the point where the mock stream is actually entering its blocked call, keeping workflow startup outside the one-second preemption deadline. The helper surfaces early handler completion, drains its tasks, closes the handler, and the tests assert cancellation before helper cleanup can cause it. No publishable correctness, architectural, or security risk remains after reconciliation.
Reviewed the supplied pull-request change set across correctness, security/reliability, architecture, and failure behavior.
No publishable findings remained after source verification for this scope.
Motivation & Context
The workflow shutdown test can time out waiting for the inner agent to start, before shutdown is signalled. Both the shutdown and cancellation tests currently impose a one-second deadline on workflow startup as well as on preemption. Startup includes checkpoint storage work and should not be measured as shutdown or cancellation latency.
Separate readiness synchronization from the post-signal deadline so these tests exercise interruption of an already-blocked call without requiring startup to finish within one second.
Description & Review Guide
Related Issue
N/A - small test-only correction; no linked issue.
Contribution Checklist
The affected response tests, test type checks, and changed-file hooks pass locally. Full CI is pending, and existing test dependency warnings remain.
breaking changelabel (or add "[BREAKING]" to the title prefix, before or after any language prefix) — a workflow keeps the label and title prefix in sync automatically.