Repository navigation
Conversation
There was a problem hiding this comment.
🟢 Approval recommended
The focused test changes consistently address the documented races without altering production behavior.
Pull request overview
Stabilizes activity pause tests by reducing timing races around heartbeats, retries, and cold starts.
Changes:
- Uses fixed 300 ms heartbeat throttling without short heartbeat timeouts.
- Accepts completed activities as successfully unpaused.
- Strengthens cancellation assertions and extends pending-activity polling to 10 seconds.
File summaries
| File | Description |
|---|---|
tests/worker/test_workflow.py |
Adjusts heartbeat timing and cancellation assertions. |
tests/helpers/__init__.py |
Makes pending and unpause assertions race-resistant. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
DABH
left a comment
There was a problem hiding this comment.
Recommend keeping this PR and rebasing it onto current main. The exact two-file patch applies cleanly to 76875b8, and I found no actionable P1/P2 regression.
Using Python 3.14.3, a freshly built matching Core 472f94e bridge, and the pinned Server 1.32.0-162.0:
| Controlled case | Current main | With this patch |
|---|---|---|
| Observe pending activity 1.7s after successful unpause | Fails | Passes |
| Delay the first workflow poll by 6s | Fails | Passes |
| Suppress heartbeats for 2.6s and delay pause observation | Activity times out before pause; test fails | Passes |
| Make the external heartbeat return without cancellation | Incorrectly passes | Correctly fails |
Normal repetitions passed 30/30 before and 30/30 after; no natural flake occurred in that sample. The controlled cases demonstrate the timing mechanisms rather than an empirical CI failure rate.
The implementation preserves the behavior under test. Histories show real paused=True cancellation delivery with no heartbeat failure deadline; both unpaused activities complete on attempt 2. Disabling heartbeats entirely still fails the patched test. Removing the short heartbeat failure deadlines while keeping prompt heartbeat delivery is appropriate for testing pause behavior.
Please update the rationale for drift: current main already gives the first pause/unpause readiness poll 10s, although the helper default and other paths remain 5s. Also, pause/unpause already capped heartbeat throttling at 300ms; the new throttle setting is needed by the cancellation-details worker. The heartbeat fault produced an activity timeout followed by "workflow execution already completed", rather than the exact pending-activity error quoted in the description.
af9f09d to
a77a719
Compare
Accept an activity that has already finished after a successful unpause RPC. The tests still await and verify the workflow result. Remove the pause-specific workflows' short heartbeat failure deadlines while keeping prompt heartbeat delivery. Add the 300ms throttle to the cancellation- details worker; the pause/unpause worker already had that cap. Raise the shared pending-activity wait to 10s for paths that still use its default. The first pause/unpause readiness call already explicitly allows 10s. Require the external heartbeat to raise the expected paused cancellation.
a77a719 to
31e2120
Compare
|
CI is now green on The macOS Python 3.10 timeout was in |
What was changed
The unpause helper accepts an activity that has already completed after a successful unpause RPC. Pause-specific activities keep their 10s start-to-close deadlines and heartbeat delivery, but drop the unrelated 1–2s heartbeat failure deadlines. The cancellation-details worker now caps heartbeat throttling at 300ms; pause/unpause already used that cap.
The shared pending-activity wait defaults to 10s, covering paths that still used 5s. The first pause/unpause readiness call already explicitly allows 10s on current main. The external cancellation test now requires the heartbeat to raise
AsyncActivityCancelledErrorwithpaused=True.Why
An unpaused retry can finish before the next describe response. Short heartbeat failure deadlines can also time an activity out before the pause request reaches it. These tests verify pause behavior, so heartbeat delivery should stay prompt without introducing a competing heartbeat timeout. The final workflow-result assertions still verify successful completion.
Testing
Rebased on main
76875b8; Python 3.14.3, SDK 1.34.0, freshly built matching Core472f94e, pinned Server 1.32.0-162.0.poe lintpasses, including all three type checkers.CI run 38442762780 is green on commit
31e21203. Its first macOS 3.10 attempt timed out in the unchangedtest_alternate_async_loop_ordering; rerunning that one job passed without a source change. Side-by-side runs of that unchanged test also passed on main and this patch under Python 3.10.20 and 3.14.3.These bounded reproductions verify the timing mechanisms; they do not measure the current CI flake rate.