Repository navigation
Follow continue-as-new in result() instead of returning None (#356) - #357
Merged
Merged
Conversation
A handle bound to a run that continued as new read that run's history, found no completed/failed/terminated/cancelled/timed-out event (it ends with WorkflowContinuedAsNew) and returned None. Follow the chain through each WorkflowContinuedAsNew event's continued_to_run_id (falling back to the newest run the status read names) to the run that ended, as PHP and Rust do, and return its result or raise its typed failure. A chain that cannot be followed raises WorkflowFailed. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
rmcdaniel
added a commit
that referenced
this pull request
Nov 20, 2026
Co-Authored-By: Claude Opus 5.5 <[email protected]>
rmcdaniel
added a commit
that referenced
this pull request
Nov 20, 2026
Keeps both: this branch's transient retries, committed-completion rule and outage logs, and main's decoded response cap and continue-as-new result. Only CHANGELOG.md conflicted; both entries are kept. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Fixes #356.
Bug
get_resultreads the history ofhandle.run_id or desc.run_id. For a handle bound to run 1, which continued as new to run 2, run 1's history ends withWorkflowContinuedAsNew. That is not one of the terminal events the scan looks for, soresult()returnedNone. It returnedNonewhether run 2 completed or failed. The new tests reproduce this on main: one returnsNonewhere{"final": True}was expected, and another expectedWorkflowFailedand got no exception.Fix
get_resultnow follows the continue-as-new chain to the run that actually ended, the same way PHP'sworkflowResult(followCurrentRun: true)and the Rust SDK do:WorkflowContinuedAsNewevent'scontinued_to_run_id, which native Server records.WorkflowFailedinstead of returningNone.The per-run history scan moves into
_run_terminal_outcome; its behavior for completed, failed, terminated, cancelled and timed-out runs is unchanged.Interaction with #354: the history-free fast path in #354 applies only when the status read names the handle's run. A handle on run 1 therefore takes this history path and follows the chain. The two changes compose.
Tests (
tests/test_result_continue_as_new.py)WorkflowFailedwith run 2's messageWorkflowFailedFive of these fail on main.
Local results (Python 3.14):
pytest tests/ -m "not integration": 7813 passed, 3 skipped.ruff: clean.mypy: clean.🤖 Generated with Claude Code