Skip to content

Commit ad027fc

Browse files
committed
fix: handle None state values in skill_toolset after session rewind
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: #5193 Reported-by: SAMFVH
1 parent 23bd95b commit ad027fc

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/google/adk/tools/skill_toolset.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ async def run_async(
152152
agent_name = tool_context.agent_name
153153
state_key = f"_adk_activated_skill_{agent_name}"
154154

155-
activated_skills = list(tool_context.state.get(state_key, []))
155+
activated_skills = list(tool_context.state.get(state_key) or [])
156156
if skill_name not in activated_skills:
157157
activated_skills.append(skill_name)
158158
tool_context.state[state_key] = activated_skills
@@ -791,7 +791,7 @@ async def _resolve_additional_tools_from_state(
791791

792792
agent_name = readonly_context.agent_name
793793
state_key = f"_adk_activated_skill_{agent_name}"
794-
activated_skills = readonly_context.state.get(state_key, [])
794+
activated_skills = readonly_context.state.get(state_key) or []
795795

796796
if not activated_skills:
797797
return []

0 commit comments

Comments
 (0)