Python: preserve functional workflow state on response-only HITL resume - #8300
Open
CoralGarden52 wants to merge 1 commit into
Open
Python: preserve functional workflow state on response-only HITL resume#8300CoralGarden52 wants to merge 1 commit into
CoralGarden52 wants to merge 1 commit into
Conversation
CoralGarden52
marked this pull request as ready for review
September 11, 2026 14:16
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The implementation consistently extends the existing replay lifecycle and directly covers the reported regression.
Pull request overview
Preserves functional workflow user state during response-only HITL resumes.
Changes:
- Saves, restores, and clears replay state alongside step caches.
- Adds regression coverage confirming cached steps are not rerun and state remains available.
File summaries
| File | Description |
|---|---|
python/packages/core/agent_framework/_workflows/_functional.py |
Adds response-only state persistence lifecycle. |
python/packages/core/tests/workflow/test_functional_workflow.py |
Tests state restoration through cached-step replay. |
Review details
- Files reviewed: 2/2 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.
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
Functional workflow state is documented as persisting across HITL interruptions, but response-only resumes currently restore only cached step results. When a cached step wrote user state before requesting input, the resumed workflow completes with missing state and can silently produce an incorrect result.
This is reproducible through the public
FunctionalWorkflow.runAPI on the upstream commit used for this change:The same scenario resumed with a
checkpoint_idalready preservedok:seeded:ok, confirming that state persistence is intended. The issue is tracked in #8299, and the original functional workflow review in #4238 identified the same unresolved response-only state restoration gap.Description & Review Guide
What are the major changes?
responses={...}without a checkpoint.@step, pauses for HITL input, verifies the step is not executed again, and verifies the state remains available after response-only resume.What is the impact of these changes?
['ok:seeded:ok']withseed_calls == 1.5039 passed, 131 skipped, 2 xfailed), formatting, linting, and changed-file Pyright checks pass.What do you want reviewers to focus on?
WorkflowInterruptedand normal completion without allowing stale state to cross independent workflow runs.Related Issue
Fixes #8299
Contribution Checklist
breaking changelabel (or add "[BREAKING]" to the title prefix) — a workflow keeps the label and title prefix in sync automatically.