You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix continue-as-new handling in workflow_streams subscribe (#1581)
* Fix continue-as-new detection in workflow_streams subscribe
_follow_continue_as_new described the workflow with no run id, which returns
the current run. After a continue-as-new that is the new RUNNING run, never
CONTINUED_AS_NEW (which only sits on the old, closed run), so the check never
fired and subscribe() stopped during a rollover instead of following the stream.
Capture the run id each poll's update is admitted to (start_update with
WaitForStage ACCEPTED, read workflow_run_id, then await result) and describe
that specific run on failure. A rolled-over run reports CONTINUED_AS_NEW, a
terminal run reports a terminal status, and a still-RUNNING run is a transient
error that should surface. This also avoids mistaking an unrelated new execution
that reused the workflow id for a successor.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Retry poll rejected while stream is draining for continue-as-new
The poll update's validator rejected new polls during detach-for-CAN with an
untyped RuntimeError, which subscribe() did not classify and re-raised — ending
the subscription with an error during a routine rollover.
Give the validator the well-known StreamDraining ApplicationError type and have
subscribe() back off and retry on it, so the poll lands on the successor run
once the rollover completes.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* Add CODEOWNERS entries for workflow_streams
* Address review feedback on workflow_streams continue-as-new fix
- Hoist StreamDraining/TruncatedOffset error types to constants in
_types.py so the raise sites (_stream.py) and handling sites
(_client.py) cannot diverge.
- Annotate _describe_polled_run return type.
- Drop dead non_retryable=True flags: all three ApplicationErrors are
raised from update validators/handlers, where retry policy does not
apply, so the flag was a no-op.
- Document poll_cooldown semantics and warn against timedelta(0).
- Add test verifying the subscribe flow captures the polled run id.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0 commit comments