Skip to content

Fix dropped events when run streams finish during subscription - #28

Merged
Hydralerne merged 1 commit into
mainfrom
fix/release-stream-completion
Oct 4, 2026
Merged

Hydralerne merged 1 commit into
mainfrom
fix/release-stream-completion

Conversation

@Hydralerne

Copy link
Copy Markdown
Member

What & why

A fast run can finish after a client subscribes but before it finishes replaying events. The Go SDK then rereads the terminal status and exits without draining its live channel, dropping queued text and tool results. This caused TestStreamOrderAndWait to fail in the v0.1.39 release gate: https://github.com/oblien/mindwire/actions/runs/37165823800/job/111328736927.

Share the supervisor's subscription lifecycle between the Go SDK and HTTP SSE endpoint. Subscribers drain until the producer closes the stream, including events published after the terminal record is saved. Completed runs whose buffers expired or disappeared after a restart close without creating an orphaned live topic.

Component

  • daemon (Go)
  • mindwire (TypeScript)
  • docs
  • repo / CI

Type of change

  • Bug fix
  • New feature
  • New agent adapter
  • Breaking change
  • Docs only

Validation

  • Deterministic regression reproduced missing output before the fix and passes afterward, including completion during replay and during the open sentinel.
  • 100 repetitions under the race detector of the original failing test and new stream regressions passed.
  • go test -race ./... -skip '^TestLiveClaude$' -timeout 5m passed. Only the host-authenticated external Claude test was excluded locally; CI runs the normal suite.
  • gofmt, go vet ./..., go build ./..., and govulncheck passed.
  • SDK typecheck, build, and unit tests passed: 195 pass, 20 skip, 0 fail.

Checklist

  • I read CONTRIBUTING.md.
  • Daemon build, vet, and tests pass as detailed above.
  • SDK typecheck, build, and tests pass.
  • Added regression coverage for queued events, post-terminal notifications over SDK/HTTP, and subscriptions after restart.
  • No public API/schema or documentation changes needed; restores the documented stream completion behavior.
  • New adapter registration: not applicable.

@Hydralerne
Hydralerne merged commit 968606a into main Oct 4, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant