Skip to content

fix(agents): ignore placeholder resume state - #5126

Closed
pandego wants to merge 3 commits into
google:mainfrom
pandego:fix/5102-resume-placeholder
Closed

pandego wants to merge 3 commits into
google:mainfrom
pandego:fix/5102-resume-placeholder

Conversation

@pandego

@pandego pandego commented Apr 3, 2026

Copy link
Copy Markdown
Contributor

Related issue

Closes #5102

Summary

  • treat an empty BaseAgentState placeholder as "no resumable state" when an agent expects a specialized state model
  • let SequentialAgent resume from the beginning instead of failing on BaseAgentState() -> SequentialAgentState validation
  • add focused regression coverage for the generic loader guard and the sequential resume path

Problem / solution

InvocationContext.populate_invocation_agent_states() can synthesize an empty base placeholder when an agent emitted content without an explicit state payload. That is fine for agents that really use BaseAgentState, but workflow agents like SequentialAgent later validate against a specialized state model and crash on resume.

This change keeps the placeholder behavior but teaches _load_agent_state() to treat an empty base placeholder as absent state when the caller expects a custom state type. In that case, the workflow resumes cleanly from its normal initial path instead of raising a ValidationError.

Testing plan

  • uv run pytest tests/unittests/agents/test_base_agent.py tests/unittests/agents/test_sequential_agent.py

Checklist

  • Added or updated unit tests
  • Added manual E2E evidence if needed
  • Kept the change focused to one bug

@adk-bot adk-bot added the core [Component] This issue is related to the core interface and implementation label Apr 3, 2026
@rohityan rohityan self-assigned this Apr 6, 2026
@rohityan rohityan added the needs review [Status] The PR/issue is awaiting review from the maintainer label Apr 13, 2026
@rohityan

Copy link
Copy Markdown
Collaborator

Hi @pandego ,Thank you for your contribution! We appreciate you taking the time to submit this pull request. Your PR has been received by the team and is currently under review. We will provide feedback as soon as we have an update to share.

@rohityan

Copy link
Copy Markdown
Collaborator

Hi @wukath , can you please review this.

@GWeale
GWeale self-requested a review June 17, 2026 00:32
@GWeale GWeale self-assigned this Jun 17, 2026
@GWeale

GWeale commented Jun 17, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the fast turnaround and the clean repro/tests! This was already resolved on main: populate_invocation_agent_states() now stores the placeholder as BaseAgentState().model_dump(mode="json") (a dict) instead of a raw BaseAgentState() object, so a SequentialAgent reading it back no longer raises the ValidationError (#5102 is closed). Closing as already resolved.

@GWeale GWeale closed this Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core [Component] This issue is related to the core interface and implementation needs review [Status] The PR/issue is awaiting review from the maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Resume can populate BaseAgentState for SequentialAgent and fail with ValidationError

4 participants