This repository was archived by the owner on Aug 17, 2026. It is now read-only.
Repository navigation
Commit 4d0f65f
committed
fix(grunt/tui): attach explicitly subscribes to /global/event SSE (#2)
Without this, externally-triggered session activity (a wake fired via
POST /session/<id>/prompt_async from another peer) never renders in
attach client TUIs. The wake processes server-side (LLM runs, message
written to db), but the attach client has no way to learn about it.
## Root cause
attach.ts called tui() without passing `events`. The SDKProvider had a
fallback path (startSSE() in context/sdk.tsx onMount) that should have
subscribed to /global/event when props.events was undefined. In practice
that fallback is silent on failure — its async IIFE catches every error.
This patch explicitly creates an EventSource in attach.ts that subscribes
to /global/event via the SDK and forwards events to the SDKProvider,
mirroring how the local-worker case in thread.ts wires `events: createEventSource(client)`.
## Verification
Local typecheck passes (`bun typecheck` from packages/opencode).
Manual end-to-end test plan (requires rebuilt binary):
1. Start `opencode serve --port 4096` in one terminal
2. `opencode attach http://127.0.0.1:4096 --dir <project>` in another
3. From a third terminal: `curl -X POST 'http://127.0.0.1:4096/session/<id>/prompt_async' -H 'Content-Type: application/json' -d '{"parts":[{"type":"text","text":"wake test"}]}'`
4. The attach client TUI should render the new user message + assistant response
Refs hivemind anomalyco#221 (wake-up display bug verified in production) and anomalyco#222
Phase 2 patch 2c.1 parent 33ae4fd commit 4d0f65f
1 file changed
Lines changed: 41 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
8 | 48 | | |
9 | 49 | | |
10 | 50 | | |
| |||
94 | 134 | | |
95 | 135 | | |
96 | 136 | | |
| 137 | + | |
97 | 138 | | |
98 | 139 | | |
99 | 140 | | |
| |||
0 commit comments