[P1] Single-process streaming is fragile — global stream target, remount flicker, flush races #37

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

Problem
The live-streaming layer relies on a single global currentStreamingId, which is nulled the instant the dispatch RPC returns (so background-job tokens get dropped), plus messages is a createSignal<Msg[]> so any setMessages remounts the LiveJobPanel (the "card keeps refreshing" flicker), plus a 60ms flush timer that can clobber the final reply. We've band-aided each of these repeatedly this session.

Evidence

  • crates/hero_shrimp_web/ui/src/store.tscurrentStreamingId, jobStreamJobId, flushStreamBuffer, trackJobUntilDone (non-terminal must NOT setMessages, by comment).

Proposed fix
Re-architect to a per-session typed event channel (cf. kimi-cli's "wire" SPMC protocol / Qwen-Code's typed event generator): events scoped by session, UI subscribes per conversation, message body updated via fine-grained store paths (not array replacement). Depends on the session_id fix.

Related: this is the root behind #29 and #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 live-streaming layer relies on a single global `currentStreamingId`, which is nulled the instant the dispatch RPC returns (so background-job tokens get dropped), plus `messages` is a `createSignal<Msg[]>` so any `setMessages` remounts the `LiveJobPanel` (the "card keeps refreshing" flicker), plus a 60ms flush timer that can clobber the final reply. We've band-aided each of these repeatedly this session. **Evidence** - `crates/hero_shrimp_web/ui/src/store.ts` — `currentStreamingId`, `jobStreamJobId`, `flushStreamBuffer`, `trackJobUntilDone` (non-terminal must NOT setMessages, by comment). **Proposed fix** Re-architect to a per-session typed event channel (cf. kimi-cli's "wire" SPMC protocol / Qwen-Code's typed event generator): events scoped by session, UI subscribes per conversation, message body updated via fine-grained store paths (not array replacement). Depends on the session_id fix. Related: this is the root behind #29 and #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#37
No description provided.