Fix streaming subscription race

This commit is contained in:
2026-07-18 13:18:18 -07:00
parent de14d57634
commit 5113a953db
5 changed files with 246 additions and 9 deletions

View File

@@ -86,6 +86,11 @@ reply.reasoning_text # => the model's hidden reasoning, if any
reply.parts_json # => the full ordered parts array, ready for persistence
```
`stream` waits for OpenCode's initial `server.connected` SSE readiness frame
before it submits the asynchronous prompt. If the event connection drops
afterward, the client reconnects only the subscription; it never reposts the
prompt. This prevents both missed fast responses and duplicate turns.
### Synchronous send (no streaming)
```ruby
@@ -187,7 +192,9 @@ bundle install
bundle exec rake test
```
The smoke suite covers Client end-to-end against WebMock-stubbed OpenCode endpoints.
The smoke suite covers Client end-to-end against WebMock-stubbed OpenCode
endpoints, including subscription-before-prompt ordering and
reconnect-without-repost.
## License