Skip to content
TheChatArchiveThe Chat Archive
QwenQwen/Qwen3.6-27B· alibabaHugging 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. Qwen Assistant

    Let me analyze the issue:

    1. The bug is about team.acontinue_run losing dependencies or session_state
    2. The user reports that when using acontinue_run after a paused event, the session_state (passed as dependencies) is not being restored in the run context
    3. The possible solution points to _aroute_requirements_to_members_stream in agno/team/_run.py around line 5145, where run_context has not been restored

    Let me start by exploring the repository structure and finding the relevant files.

  3. Qwen Assistant

    Now let me look at the _run.py file, specifically around line 5145 where the issue is reported.

  4. Qwen Assistant

    Let me look at the _aroute_requirements_to_members_stream function more closely and understand the context. Let me search for this function definition.

  5. Qwen Assistant

    Now I can see the issue. When calling member.acontinue_run() in _aroute_requirements_to_members_stream, the function doesn't pass run_context or dependencies to the member's acontinue_run call. Let me look at how the similar issue was fixed elsewhere and understand what parameters acontinue_run accepts.

  6. Qwen Assistant

    Now I can see that acontinue_run accepts both run_context and dependencies parameters. But in _aroute_requirements_to_members_stream, when calling member.acontinue_run(), neither of these is passed. Let me look at the function more carefully and check how the run_context is used.

  7. Qwen Assistant

    Now let me check where _aroute_requirements_to_members_stream is called from to understand what run_context is passed:

  8. Qwen Assistant

    Now I can see the issue clearly. In _aroute_requirements_to_members_stream, the run_context is received as a parameter but it's not being passed when calling member.acontinue_run(). Let me see the exact lines:

  9. Qwen Assistant

    I can see the bug. Both member.acontinue_run() calls (lines 5171-5177 and 5179-5186) do not pass run_context. The run_context parameter contains dependencies (like session_state) which is needed by the member agents.

    Let me check how similar code in other parts of the file handles this:

  10. Qwen Assistant

    Let me also look at a similar function that delegates tasks to members and see how it passes run_context:

  11. Qwen Assistant

    I can see that in the adelegate_task_to_member function, when calling member_agent.arun(), it passes dependencies=run_context.dependencies and session_state=member_session_state_copy.

    Now let me understand what the fix should be. In _aroute_requirements_to_members_stream, the member.acontinue_run() calls should also pass run_context so that dependencies and session_state are available.

    Let me check the acontinue_run signature again to confirm it accepts run_context:

  12. Qwen Assistant

    The acontinue_run method accepts run_context parameter. Let me look at the _aroute_requirements_to_members_stream function more closely and fix it by adding run_context=run_context to both member.acontinue_run() calls.

    Let me first confirm the exact lines that need to be modified.

  13. Qwen Assistant

    Now I need to add run_context=run_context to both member.acontinue_run() calls. Let me make the fix:

  14. Qwen Assistant

    I need to use the correct syntax for the open command.

  15. Qwen Assistant

    Now I can see the issue clearly. I need to add run_context=run_context to both member.acontinue_run() calls (lines 5171-5177 and 5180-5187).

    Let me fix the first call:

  16. Qwen Assistant

    Now let me fix the second member.acontinue_run() call:

  17. Qwen Assistant

    Both calls now include run_context=run_context. Let me verify my changes are correct by looking at the modified section:

  18. Qwen Assistant

    The changes look correct. Now let me check if there are any existing tests related to this functionality that I should run:

  19. Qwen Assistant

    Let me look at the unit tests related to team acontinue_run and run requirements.

  20. Qwen Assistant

    I've made the fix by adding run_context=run_context to both member.acontinue_run() calls in the _aroute_requirements_to_members_stream function. Now let me run the existing tests to make sure I didn't break anything. Let me first run the team-related unit tests. )

  21. Qwen Assistant

    Let me run the tests to verify my changes don't break anything.

  22. Qwen Assistant

    The tests pass. Let me also run the other team-related unit tests to make sure my changes don't break anything.

    <tool_call> <function=bash_terminal> <parameter=command> cd /agno && python -m pytest libs/agno/tests/unit/team/test_continue_run_requirements.py -v 2>&1 | head -80 </tool_call>

  23. Qwen Assistant

    Let me run the test correctly.

  24. Qwen Assistant

    All tests pass. Let me run all unit tests for the team module to make sure everything is working:

  25. Qwen Assistant

    The 2 failures are unrelated to my changes - they're about missing database drivers (sqlite, postgres). All 412 other tests passed. My fix doesn't break any existing tests.

    Let me also check if there are any other places in the codebase that might have a similar issue - calling member.acontinue_run() without passing run_context:

  26. Qwen Assistant

    Let me check the other two member.acontinue_run() calls (lines 5069 and 5075) to see if they also need the run_context parameter:

  27. Qwen Assistant

    There are two more member.acontinue_run() calls that also don't pass run_context. Let me check what function they belong to:

  28. Qwen Assistant

    This is the non-streaming version _aroute_requirements_to_members that has the same bug. I need to fix those two calls as well.

  29. Qwen Assistant

    There are two more member.acontinue_run() calls in _aroute_requirements_to_members that also need run_context passed. Let me fix them as well.

  30. Qwen Assistant

    Let me verify the changes look correct:

  31. Qwen Assistant

    Good. Now let me run the tests again to make sure everything still passes:

  32. Qwen Assistant

    Now let me run the existing tests to make sure my changes don't break anything.

  33. Qwen Assistant

    All 352 tests passed. Let me verify the complete changes I made:

  34. Qwen Assistant

    Now let me verify the changes are complete and correct. Let me run a few more tests to make sure everything is working properly:

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