Skip to content

fix: handle None state values in skill_toolset after session rewind#5204

Closed
enjoykumawat wants to merge 1 commit intogoogle:mainfrom
enjoykumawat:fix/load-skill-tool-none-guard
Closed

fix: handle None state values in skill_toolset after session rewind#5204
enjoykumawat wants to merge 1 commit intogoogle:mainfrom
enjoykumawat:fix/load-skill-tool-none-guard

Conversation

@enjoykumawat
Copy link
Copy Markdown
Contributor

Summary

Fixes #5193 — After session rewind, LoadSkillTool.run_async crashes with TypeError: 'NoneType' object is not iterable.

Root cause: Session rewind sets adk_activated_skill_{agent_name} to None as a deletion marker. dict.get(key, default) only returns the default when the key is absent — when the key exists with value None, it returns None. So list(None) raises TypeError.

Fix: Change state.get(state_key, []) to state.get(state_key) or [] at both call sites (lines 155 and 794) so that explicit None values fall back to an empty list.

As identified by @surajksharma07 in the issue comments and confirmed in production by @SAMFVH.

Changes

  • src/google/adk/tools/skill_toolset.py: Fix both state.get() calls to handle explicit None

Test plan

  • All 78 test_skill_toolset.py tests pass
  • No regressions

Session rewind sets state keys to None as deletion markers. dict.get()
returns None (not the default) when the key exists with value None,
causing list(None) to raise TypeError.

Change `state.get(key, [])` to `state.get(key) or []` at both call
sites so that explicit None values fall back to an empty list.

Github-Issue: google#5193
Reported-by: SAMFVH
@adk-bot adk-bot added the tools [Component] This issue is related to tools label Apr 8, 2026
@rohityan rohityan self-assigned this Apr 9, 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 @enjoykumawat, 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.

@xuanyang15 xuanyang15 self-assigned this Apr 15, 2026
@xuanyang15
Copy link
Copy Markdown
Collaborator

Started internal review

copybara-service bot pushed a commit that referenced this pull request Apr 16, 2026
Merge #5204

Co-authored-by: Xuan Yang <xygoogle@google.com>
COPYBARA_INTEGRATE_REVIEW=#5204 from enjoykumawat:fix/load-skill-tool-none-guard ad027fc
PiperOrigin-RevId: 900930037
@adk-bot
Copy link
Copy Markdown
Collaborator

adk-bot commented Apr 16, 2026

Thank you @enjoykumawat for your contribution! 🎉

Your changes have been successfully imported and merged via Copybara in commit a977aa3.

Closing this PR as the changes are now in the main branch.

@adk-bot adk-bot closed this Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs review [Status] The PR/issue is awaiting review from the maintainer tools [Component] This issue is related to tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeError in LoadSkillTool.run_async after session rewind: 'NoneType' object is not iterable

4 participants