Repository navigation
Python: Apply caller-supplied run kwargs over checkpoint kwargs on restore - #9853
Open
Abhinav Maurya (Fire162) wants to merge 1 commit into
Open
Abhinav Maurya (Fire162) wants to merge 1 commit into
Abhinav Maurya (Fire162) wants to merge 1 commit into
Conversation
Abhinav Maurya (Fire162)
requested review from
SergeyMenshykh,
Eduard van Valkenburg (eavanvalkenburg) and
Roger Barreto (rogerbarreto)
as code owners
October 29, 2026 22:34
Abhinav Maurya (Fire162)
temporarily deployed
to
github-app-auth
October 29, 2026 22:34 — with
GitHub Actions
Inactive
Abhinav Maurya (Fire162)
requested review from
Darren Cohen (dargilco),
Jose Alvarez (jpalvarezl),
sophia-ramsey and
westey (westey-m)
as code owners
October 29, 2026 22:34
Abhinav Maurya (Fire162)
temporarily deployed
to
github-app-auth
October 29, 2026 22:34 — with
GitHub Actions
Inactive
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Checkpoint restoration occurs outside the tracing/error boundary, so restore failures bypass failure events and error tracing and leave workflow status unchanged.
1 open issue
What changed in this PR
This PR addresses #9850 by restoring Python workflow checkpoints before applying caller-supplied run kwargs, so continuation overrides take precedence over checkpoint values.
Changes:
- Moves checkpoint restoration ahead of run-kwargs application.
- Separates initial-message setup from checkpoint and response dispatch.
- Adds regression coverage for both kwargs channels across checkpoint-only, subsequent-response, and combined resumptions.
| File | Description |
|---|---|
python/packages/core/tests/workflow/test_workflow_kwargs.py |
Tests caller-kwargs precedence when resuming checkpoints. |
python/packages/core/agent_framework/_workflows/_workflow.py |
Reorders restoration and refactors execution-mode setup. |
Review effort: Balanced
| "or build workflow with WorkflowBuilder(checkpoint_storage=checkpoint_storage)." | ||
| ) | ||
|
|
||
| await self._runner.restore_from_checkpoint(checkpoint_id, checkpoint_storage) |
This branch was previously deployed
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.

Motivation & Context
When resuming a workflow from a checkpoint, passing
function_invocation_kwargsorclient_kwargsdid not take effect because checkpoint restoration ran after_run_workflow_with_tracingcommitted the caller kwargs, wiping state withcheckpoint.state. The contract specifies that checkpoint-restored kwargs should be preserved unless the caller explicitly supplies new kwargs on continuation.Description & Review Guide
Workflow._run_core, restore the checkpoint (restore_from_checkpoint) before_run_workflow_with_tracingbegins (matching the pattern incancel_pending_requests)._execute_with_messageto seed the entry message, and updated_resolve_execution_modeto handle message dispatch and responses cleanly.test_caller_kwargs_override_checkpoint_kwargs_on_restoreintest_workflow_kwargs.pycovering standalonecheckpoint_idresumption, subsequent response resumption, and combinedcheckpoint_id+responsesresumption for bothfunction_invocation_kwargsandclient_kwargs._run_coreand backward compatibility of_resolve_execution_mode.Related Issue
Fixes #9850
AI Assistance
AI assistance details: Analysis of checkpoint restoration ordering, implementation in
_workflow.py, and regression test intest_workflow_kwargs.py.Contribution Checklist