Skip to content
TheChatArchiveThe Chat Archive
xiaomi/mimo-v2.5-pro· unknownHugging Face ibragim-bad/swe_rebench_07_2026_trajectories

ISSUE DESCRIPTION [Bug] team.acontinuerun loss dependencies or sessionstate Description…

  1. User

    ISSUE DESCRIPTION

    [Bug] team.acontinue_run loss dependencies or session_state

    Description

    team.acontinue_run loss dependencies or session_state

    Steps to Reproduce

    requires_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

    session_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)
    

    Agent Configuration (if applicable)

    No response

    Expected Behavior

    in group_del_stock, dependencies["user_token"] or session_state["user_token"] should be not None

    Actual Behavior

    dependencies["user_token"] or session_state["user_token"] is None

    Screenshots or Logs (if applicable)

    No response

    Environment

    agno=2.6.9
    

    Possible Solutions (optional)

    in _aroute_requirements_to_members_stream, The run_context has not been restored https://github.com/agno-agi/agno/blob/55ba3edd1b4ea230afe8a3fcda39582f8a2178ad/libs/agno/agno/team/_run.py#L5145

    Additional Context

    No response

    ADDITIONAL ADVICE

    Since you are given a git repository, you can use git commands to simplify your work. For example, if you made a mistake and want to revert your changes, you can use git checkout <file> to restore the file to its original state. You can also reset all changes in the repository using git reset --hard command. Additionally, you can use git stash and git stash pop to temporarily save your changes and restore them later. Finally, you can see the changes that you've made (which will be submitted when you call submit) using git status or git diff commands. However you don't need to use git add or git commit before submitting your changes. In fact, submit only submits currently unstaged changes because it uses git diff to get the changes that need to be submitted.

    CHECKLIST

    Before submitting your solution, please go over the following checklist and make sure you've done everything:

    • If an error was reported in the issue description, I have successfully reproduced it.
    • If an error was reported in the issue description, I have confirmed that my fix resolves the error.
    • I have thought about edge cases and made sure my fix handles them as well.
    • I have run existing tests in the repository that might have been affected by the change I made and confirmed that they pass. I want you to list every bullet from this checklist and write your reasoning for why you think you did it or didn't need to.

    Repository has been uploaded and your shell is currently at the repository root. Time to solve the issue!

    (Current directory: /agno, current file: none) bash-$

  2. Assistant

    I'll start by exploring the repository structure to understand the codebase and locate the relevant files. Let's first get an overview.

  3. Assistant

    Let me explore the repository structure more to understand the layout and find the relevant file mentioned in the issue.

  4. Assistant

    Let me look at the libs directory to find the agno library.

  5. Assistant

    Let me look at the team/_run.py file that was referenced in the issue.

  6. Assistant

    Let me look at the specific line mentioned in the issue: line 5145 in _run.py. Let's first see what's around that line.

  7. Assistant

    Let me search for the function _aroute_requirements_to_members_stream that was mentioned in the issue. Let me search for it in the codebase.

  8. Assistant

    Let me look at the _aroute_requirements_to_members_stream function around line 5110.

  9. Assistant

    Let me continue reading the function to see where the issue might be. Let me also look at the acontinue_run method in the Team class. guzzle

  10. Assistant

    Let me make one call at a time.

  11. Assistant

    Let me look at the acontinue_run method to understand how it's called and what parameters it passes.

  12. Assistant

    Now let me look at the acontinue_run_dispatch function:

  13. Assistant

    Let me look at the acontinue_run_dispatch function to see how it handles dependencies and session_state.

  14. Assistant

    Now let me look at the _acontinue_run_stream function to see how it calls _aroute_requirements_to_members_stream:

  15. Assistant

    Let me examine the _acontinue_run_stream function:

  16. Assistant

    Now I can see the issue! In _aroute_requirements_to_members_stream, when calling member.acontinue_run(...), the run_context (which contains session_state and dependencies) is NOT being passed. Let me look at what parameters the member agent's acontinue_run accepts:

  17. Assistant

    Let me look at the agent's acontinue_run method to understand its signature.

  18. Assistant

    Now I understand the issue. The member agent's acontinue_run accepts a run_context parameter, but _aroute_requirements_to_members_stream is NOT passing it. Let me also check the synchronous counterpart _route_requirements_to_members_stream to see if it has the same issue:

  19. Assistant

    Let me look at the synchronous version:

  20. Assistant

    Now I can see the pattern. Both the sync and async streaming versions (_route_requirements_to_members_stream and _aroute_requirements_to_members_stream) do NOT pass run_context (which contains session_state and dependencies) to the member agent's continue_run/acontinue_run. Let me also look at the non-streaming async version _aroute_requirements_to_members:

    Actually, let me also check the non-streaming sync version _route_requirements_to_members:

  21. Assistant

    Now let me also look at the non-streaming sync version:

  22. Assistant

    Now I understand the issue clearly. All four routing functions (_route_requirements_to_members, _route_requirements_to_members_stream, _aroute_requirements_to_members, _aroute_requirements_to_members_stream) receive a run_context parameter but none of them pass it through to the member agent's continue_run/acontinue_run calls. This means the member agent loses access to session_state and dependencies that were set on the team level.

    Let me look at the RunContext class to understand what fields it carries:

  23. Assistant

    Let me look at the RunContext class to understand its structure.

  24. Assistant

    Now I have a complete understanding of the bug. Let me create a reproduction script first to verify the issue:

  25. Assistant

    Let me check the setup of the agno library.

  26. Assistant

    Let me look at all four functions that need fixing. First, let me understand the current code in all four functions:

  27. Assistant

    Now let me fix all four routing functions. The issue is clear: run_context is available in all four functions but not passed to the member agent's continue_run/acontinue_run calls.

    Let me start with the fix for _route_requirements_to_members (sync, non-streaming):

  28. Assistant

    Now let me fix the first function - _route_requirements_to_members (sync, non-streaming). I need to add run_context=run_context to both member.continue_run() calls:

  29. Assistant

    Now let me fix the first function. I'll edit the first continue_run call in _route_requirements_to_members:

  30. Assistant

    Good. Now let me fix the second function _route_requirements_to_members_stream (sync, streaming). Let me navigate to it:

  31. Assistant

    Now let me fix the two continue_run calls in _route_requirements_to_members_stream:

  32. Assistant

    Good. Now let me fix the async non-streaming version _aroute_requirements_to_members. Let me navigate to find the acontinue_run calls:

  33. Assistant

    Now let me fix the two acontinue_run calls in _aroute_requirements_to_members:

  34. Assistant

    Good. Now let me fix the last function _aroute_requirements_to_members_stream (async streaming). Let me navigate to find the acontinue_run calls:

  35. Assistant

    Now let me fix the two acontinue_run calls in _aroute_requirements_to_members_stream:

  36. Assistant

    All four routing functions are now fixed. Let me also check the agent's acontinue_run_dispatch to make sure it properly uses the run_context when passed:

  37. Assistant

    That's the team file. Let me search in the agent directory:

  38. Assistant

    Let me look at the agent's acontinue_run_dispatch:

  39. Assistant

    That's picking up the team file again. Let me search differently.

  40. Assistant

    Wait, that's weird. Let me check if there's an agent/_run.py file separately.

  41. Assistant

    Let me check the agent's _run.py for acontinue_run_dispatch.

  42. Assistant

    Let me try a different approach:

  43. Assistant

    Let me continue reading to see how it handles run_context and session_state:

  44. Assistant

    Let me understand how run_context gets passed to tool functions. Let me check how session_state and dependencies are made available to tool functions:

  45. Assistant

    Let me check how the session is set up in _acontinue_run_stream and how session_state flows:

  46. Assistant

    Let me look at _asetup_session to see how session_state is loaded:

  47. Assistant

    Now I can see that _asetup_session does properly load session_state from the DB. The key issue is simply that run_context (with both session_state and dependencies) is not being passed through to member agents in the routing functions. My fix addresses this.

    Let me verify all four functions have been fixed correctly by checking the diff:

  48. Assistant

    The diff looks correct. I've added run_context=run_context to all 8 continue_run/acontinue_run calls across the 4 routing functions.

    Now let me check if there are any existing tests related to this functionality:

  49. Assistant

    Let me also look for team-specific HITL tests:

  50. Assistant

    Let me run the unit tests related to continue_run to make sure my changes don't break anything:

  51. Assistant

    All 49 unit tests pass. Let me also run the background stream test:

  52. Assistant

    All tests pass. Let me also run the broader unit test suite for teams to ensure nothing is broken:

  53. Assistant

    The 3 failures are pre-existing and unrelated to my changes (they're about agno.db.sqlite module attribute missing and a skills path issue). All 411 passing tests still pass, and my changes don't break anything.

    Let me verify my changes once more:

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.