Untitled conversation
- User
[Bug] team.acontinue_run loss dependencies or session_state
Description
team.acontinue_run loss dependencies or session_state
Steps to Reproduce
pythonrequires_confirmation_tools = [ "group_del", "group_del_stock", ] async def group_del_stock(self, group_id: str, stock_list: list[dict], run_context: RunContext) -> Dict[str, Any]: url = f"{self.live_base_url}/cloud/api/optional/stock/code/del" headers = { "Content-Type": "application/json", "X-Access-Token": run_context.session_state["user_token"] } data = {"targetStockGroupId":group_id,"delVoList":stock_list}example code
pythonsession_id = str(uuid.uuid4()) user_id= '00bgh2' session_state = {"user_token":"Bearer "} asyncio.run(main()) async def main(): async for run_event in stock_team.arun( "将茅台从优质股中删除", stream=True, session_id=session_id, user_id=user_id, session_state=session_state ): from agno.run.team import RunPausedEvent as TeamRunPausedEvent # Use isinstance to check for team's pause event (not the member agent's) if isinstance(run_event, TeamRunPausedEvent): print("Team paused - requires confirmation") for req in run_event.active_requirements: if req.needs_confirmation: print(f" Tool: {req.tool_execution.tool_name}") print(f" Args: {req.tool_execution.tool_args}") req.confirm() # Use apprint_run_response for async streaming response = stock_team.acontinue_run( run_id=run_event.run_id, session_id=run_event.session_id, requirements=run_event.requirements, stream=True, user_id=user_id, dependencies=session_state, ) await pprint.apprint_run_response(response) - Assistant
I’ll trace the async team continuation and requirement-routing paths, compare them with sync and agent behavior, then patch the context restoration and add a focused regression test.
- Assistant
rgisn’t installed in this workspace, so I’m switching to targetedgrep/file inspection. I’ll also preserve any existing worktree changes before editing. - Assistant
The failure is confirmed in all four member-routing variants: the initial delegation forwards both dependency values and a copy of team session state, but continuation calls the member with only
session_id. I’m aligning continuation with initial delegation while keeping a member-specific run context (so the team’s run ID and mutable state aren’t reused incorrectly). - Assistant
The regression coverage now exercises both async continuation modes, including the user’s streaming path. It verifies that the member receives an isolated context with the member run ID, dependencies, session state, user ID, and that member state updates merge back into the team context.
- Assistant
The repository’s documented
.venvis absent, so the first test command could not start. I’m checking the available local Python/test tooling and will run the focused suite with what is already installed; I won’t fetch dependencies. - Assistant
Both new regression tests and the entire continuation-requirements test file pass (51 tests). I’m doing the repository-required formatting/validation pass now, plus the broader team unit suite to catch compatibility issues in the sync paths that share this fix.
- Assistant
The broader suite is clean for the changed behavior, with 414 passing and 2 unrelated database-module import failures in the incomplete local environment. Static typing found two pre-existing overload declarations that omit the runtime-supported
run_contextkeyword on sync continuation; I’m narrowing the existing call-site suppressions to that overload mismatch, then rerunning validation. - Assistant
The mandated formatter completed, but it mechanically touched unrelated files elsewhere in the repository; I’m isolating and removing only those formatter-generated changes while retaining the two intended files. Full validation reached mypy and stopped on an unrelated existing type error in
knowledge/embedder/jina.py; targeted lint and mypy for the fix already pass.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.