Repository navigation
fix(stream): reconnect with backoff when the connection drops - #16
Open
harshpuri84 wants to merge 1 commit into
Open
harshpuri84 wants to merge 1 commit into
harshpuri84 wants to merge 1 commit into
Conversation
bee stream connected once and exited on any drop or timeout, then wrote its usage text to stdout, corrupting --json output. It now reconnects on transient failures with 1s to 30s backoff, stops on other HTTP errors and on Ctrl+C (connected or waiting), and sends reconnect notices to stderr in --json and --agent mode. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
bee streamconnects once. When the connection times out or drops, the command exits and writes its usage text to stdout, so a consumer piping--jsongets help text in its event feed. A long-running consumer then loses every event until someone restarts it.This change keeps the stream up:
--jsonand--agentmode, reconnect notices go to stderr, so stdout stays parseable. Pretty mode prints them to stdout as before.Events sent while disconnected are still lost, because the stream has no resume cursor. That needs a server change.
Testing
sources/commands/stream/index.test.ts: backoff steps, which errors retry, reconnect then stop on a 401, Ctrl+C while connected, Ctrl+C while waiting.bun run typecheck,bun run buildandbun test(316 pass, 0 fail) are clean.bee proxy: killing the proxy mid-stream produced "Reconnecting in 1s, 2s, 4s" on stderr, the stream resumed when the proxy came back, and Ctrl+C exited with code 0. Released 0.7.3 exited on the same drop and wrote its usage text to stdout.🤖 Generated with Claude Code