[P0] Stream events carry no session_id → cross-conversation token bleed #32

Open
opened 2026-05-23 21:52:20 +00:00 by thabeta · 0 comments
Owner

Problem
The engine emits llm:delta (and other stream events) without a session_id/job_id in the payload, so the SSE bus forwards them to every subscriber. The web UI therefore routes tokens by a single global heuristic (currentStreamingId / jobStreamJobId). With two conversations/jobs active, one job's tokens can land in another conversation's message.

Evidence

  • crates/hero_shrimp_runtime/src/llm/completion/mod.rsemit_scoped("llm:delta", {stream_id, kind, text, model, alias, phase}) — no session_id.
  • crates/hero_shrimp_web/ui/src/store.ts — SSE handler routes by global currentStreamingId / jobStreamJobId; comments already call this a "best-effort bandaid".

Proposed fix (root)
Stamp every stream event with session_id (+ artifact_job_id for jobs) at emit time, and have the UI subscribe/route per conversation. This is the single change that removes most of the streaming whack-a-mole.

Related: #29, #31.


Filed from a comparative audit of Hero Shrimp vs Qwen-Code / kimi-cli / picoclaw (2026-05-23). Severity in title: P0=correctness/trust, P1=reliability/UX, P2=cleanup.

**Problem** The engine emits `llm:delta` (and other stream events) **without a `session_id`/`job_id` in the payload**, so the SSE bus forwards them to every subscriber. The web UI therefore routes tokens by a single global heuristic (`currentStreamingId` / `jobStreamJobId`). With two conversations/jobs active, one job's tokens can land in another conversation's message. **Evidence** - `crates/hero_shrimp_runtime/src/llm/completion/mod.rs` — `emit_scoped("llm:delta", {stream_id, kind, text, model, alias, phase})` — no session_id. - `crates/hero_shrimp_web/ui/src/store.ts` — SSE handler routes by global `currentStreamingId` / `jobStreamJobId`; comments already call this a "best-effort bandaid". **Proposed fix (root)** Stamp every stream event with `session_id` (+ `artifact_job_id` for jobs) at emit time, and have the UI subscribe/route **per conversation**. This is the single change that removes most of the streaming whack-a-mole. Related: #29, #31. --- _Filed from a comparative audit of Hero Shrimp vs Qwen-Code / kimi-cli / picoclaw (2026-05-23). Severity in title: P0=correctness/trust, P1=reliability/UX, P2=cleanup._
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
lhumina_code/hero_shrimp#32
No description provided.