From d51f04a17629b5c3dcb8db7c3c9c4f2c43b853e2 Mon Sep 17 00:00:00 2001 From: Rob Ballantyne Date: Tue, 12 May 2026 11:07:32 +0100 Subject: [PATCH] Await endpoint.session() in null pyworker client MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit endpoint.session() forwards to start_endpoint_session, which is async def — so the call returns a coroutine, not a Session, despite the SDK's return-type annotation. Use 'async with await endpoint.session(...)' so the coroutine resolves to a Session before entering the context. Co-Authored-By: Claude Opus 4.7 (1M context) --- workers/null/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/workers/null/client.py b/workers/null/client.py index a39de0e..50d6c5b 100644 --- a/workers/null/client.py +++ b/workers/null/client.py @@ -40,7 +40,7 @@ async def reserve( lifetime = hold_for + 60 start = time.monotonic() log.info("[%s] creating session (lifetime=%.0fs, hold=%.0fs)", label, lifetime, hold_for) - async with endpoint.session(cost=SESSION_COST, lifetime=lifetime) as s: + async with await endpoint.session(cost=SESSION_COST, lifetime=lifetime) as s: log.info("[%s] session %s open", label, s.session_id) try: await asyncio.sleep(hold_for)