docs: drop ring buffer mentions from ws spec and plan

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
tao.chen
2026-07-03 14:12:35 +08:00
co-authored by Claude
parent 4a4028486c
commit 0cfe8955a4
2 changed files with 11 additions and 15 deletions
@@ -12,7 +12,7 @@
**Decisions (from spec, confirmed):**
- WebSocket library: `gorilla/websocket`
- Replay buffer: not in v1 (deferred; ring buffer is implemented but not exposed)
- Replay buffer: not in v1 (deferred; a future task can add it behind a separate accessor)
- Reconnect: up to 3 attempts with exponential backoff on transport error; never on exit banner
## File Structure Map
@@ -88,7 +88,7 @@
2. Modify internal/process/session.go: add Stdin io.WriteCloser, Subscribers []Subscription, Exit process.ExitInfo (Code int, Signal string), mu sync.Mutex. Use a slice, not a map.
3. Modify internal/process/manager.go:
- In LocalManager.Start: open a pipe for cmd.Stdin, capture the write end. Open a pipe for cmd.Stdout AND cmd.Stderr, point both at the same reader, capture the reader.
- Spawn goroutine A: read from the merged pipe in a 4 KiB loop, append to a 64 KiB ring buffer (truncate oldest when full, do not expose the buffer in this task), and for each Subscription in session.Subscribers do a non-blocking send (select with default that drops the chunk). Stop when the pipe returns EOF.
- Spawn goroutine A: read from the merged pipe in a 4 KiB loop, and for each Subscription in session.Subscribers do a non-blocking send (select with default that drops the chunk). Stop when the pipe returns EOF. No replay buffer in v1.
- Spawn goroutine B: call cmd.Wait(), populate session.Exit (use ProcessState.ExitCode() and Sys().(syscall.WaitStatus).Signal() if signal), then close every Subscription's channel exactly once. Do not delete the session from the map.
- Add LocalManager.Subscribe(workspaceID) (Subscription, error): if no session, return util.New(util.CodeNotFound, "no running process"). Allocate a channel, append a subscription backed by it, return it.
4. Keep existing tests compiling. New Subscribe method is additive.
@@ -472,7 +472,7 @@ Reconnect: 1s, 2s, 4s backoff. Stop after 3 failed attempts → "error". Reset o
- Process model grows `Subscribe` and `Stdin`: Tasks 1, 2.
- 409 when process not running: Task 3.
- Exit banner on close: Task 3.
- Replay buffer: explicitly deferred (Task 1 implements it but does not expose it).
- Replay buffer: not in v1. The manager's reader goroutine reads and fans out directly; no history is kept.
- Frontend hook with reconnect policy: Task 4.
- TerminalPanel wired to live process: Task 5.
- Backward compatibility: existing routes unchanged, Manager interface is additively grown, no wire format changes.