Skip to content

Python: send_and_wait() always runs into timeout #389

@Azuna1

Description

@Azuna1

python3.13
inside WSL

from copilot import CopilotClient
import asyncio

async def main():
    # Create a client with default options (spawns CLI server)
    #client = CopilotClient({"cli_url": "localhost:4321"})
    client = CopilotClient()
    await client.start()

    # Create a session and send a message
    session = await client.create_session({"model": "gpt-4"})
    session.on(lambda event: print(event.type))
    response = await session.send_and_wait({"prompt": "What is 2+2?"})
    if response:
        print(response.data.content)

    # Clean up
    await session.destroy()
    await client.stop()

asyncio.run(main())

#########

SessionEventType.PENDING_MESSAGES_MODIFIED
SessionEventType.PENDING_MESSAGES_MODIFIED 

File "/mnt/c/GIT/argo-events-tasks/github-actions-pin/test.py", line 13, in main
    response = await session.send_and_wait({"prompt": "What is 2+2?"})
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/mnt/c/GIT/argo-events-tasks/github-actions-pin/.venv/lib/python3.13/site-packages/copilot/session.py", line 183, in send_and_wait
    raise asyncio.TimeoutError(
        f"Timeout after {effective_timeout}s waiting for session.idle"
    )
TimeoutError: Timeout after 60.0s waiting for session.idle

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions