Skip to content

Commit 71aa365

Browse files
Ambient Code Botclaude
andcommitted
fix(runner): use unbounded SSE tap queue
The bounded queue (maxsize=100) dropped events when no SSE consumer was connected (e.g. CLI sessions, background agent runs). Each session queue is ephemeral and drained or GC'd at run end, so unbounded buffering is safe — worst case is transient memory growth during a long turn with no consumer, which is acceptable given pod memory limits (4Gi). 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 8329cad commit 71aa365

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

components/runners/ambient-runner/ambient_runner/app.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ async def lifespan(app: FastAPI):
150150
# This closes the race between listener.ready and the first event fan-out.
151151
active_streams = getattr(bridge, "_active_streams", None)
152152
if active_streams is not None and session_id not in active_streams:
153-
active_streams[session_id] = asyncio.Queue(maxsize=100)
153+
active_streams[session_id] = asyncio.Queue()
154154
logger.info("Pre-registered SSE queue for session=%s", session_id)
155155

156156
# Auto-execute prompts when present (skipped only for resumes,

components/runners/ambient-runner/ambient_runner/endpoints/events.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ async def get_events(thread_id: str, request: Request):
6969
)
7070
queue: asyncio.Queue = existing
7171
else:
72-
queue = asyncio.Queue(maxsize=100)
72+
queue = asyncio.Queue()
7373
active_streams[thread_id] = queue
7474
logger.info(
7575
"[SSE TAP] Queue registered: thread=%s (active_streams count=%d)",

0 commit comments

Comments
 (0)