From 6ec39988f47b115449586521d378da20ea721c54 Mon Sep 17 00:00:00 2001 From: Ishaan Jaffer Date: Wed, 6 May 2026 15:51:36 -0700 Subject: [PATCH] fix(session_endpoints): drive session busy state on /followup new-run path When /followup creates a fresh queued run (terminal-or-absent latest_run branch), call refresh_session_status_from_runs so the session moves 'ready' -> 'busy'. Match the same hook added to POST /runs. Greptile P1 (review #PRR_kwDOKALCgc78u9En). --- litellm/proxy/agent_session_endpoints/session_endpoints.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/litellm/proxy/agent_session_endpoints/session_endpoints.py b/litellm/proxy/agent_session_endpoints/session_endpoints.py index ad404f2c60f..194f0214bb8 100644 --- a/litellm/proxy/agent_session_endpoints/session_endpoints.py +++ b/litellm/proxy/agent_session_endpoints/session_endpoints.py @@ -58,6 +58,9 @@ from litellm.proxy.agent_session_endpoints.serialization import ( event_row_to_message, session_row_to_response, ) +from litellm.proxy.agent_session_endpoints.session_status import ( + refresh_session_status_from_runs, +) from litellm.proxy.agent_session_endpoints.vm_providers.registry import ( get_vm_provider, ) @@ -562,6 +565,10 @@ async def followup( detail="run_busy: another run is queued/running for this session", ) from exc raise + # Run was just queued — flip session ``ready`` -> ``busy`` so SDK + # consumers see the right status without waiting for the daemon to + # claim the run. + await refresh_session_status_from_runs(prisma_client, session_id) return FollowupResponse(run_id=new_run.id, action="new_run")