Skip to content

Commit d6f6ba1

Browse files
markturanskyAmbient Code Botclaude
authored
fix(runner): use unbounded SSE tap queue (#1220)
## Summary - SSE tap queues were bounded at `maxsize=100`, causing silent event drops when no consumer was connected (CLI sessions, background agent runs, slow frontends) - Each queue is ephemeral — created per session, drained or GC'd when the run ends — so unbounded buffering is safe - Worst case: transient memory growth during a long Claude turn with no SSE consumer; acceptable within the 4Gi pod memory limit ## Test plan - [ ] Start a session via CLI (no SSE consumer) and verify no "SSE tap queue full" warnings in runner logs - [ ] Confirm session messages are delivered correctly end-to-end 🤖 Generated with [Claude Code](https://claude.ai/code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Enhanced reliability of real-time event streaming by removing queue capacity limitations, preventing potential event loss during high-volume scenarios. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Ambient Code Bot <bot@ambient-code.local> Co-authored-by: Claude <noreply@anthropic.com>
1 parent 8329cad commit d6f6ba1

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)