Skip to content

fix(Stream): Resume an unfinished replay, ask again for an empty one and retry refused follow-ups - #33

Merged
szemyd merged 1 commit into
claude/stream-replayfrom
claude/elegant-heisenberg-s0s9ya
Nov 13, 2026
Merged

szemyd merged 1 commit into
claude/stream-replayfrom
claude/elegant-heisenberg-s0s9ya

Conversation

@szemyd

@szemyd szemyd commented Nov 13, 2026

Copy link
Copy Markdown
Contributor

This PR is stacked on #31 and merges into its branch. It fixes review findings checked against the server in dream-faster/unravel-router#1149 and dream-faster/unravel-router#1199.

What changes

  • A drop during a catch-up resumes where the replay got to. The live rows held during a replay arrive before replayed, so lastBar runs ahead of a replay that is still catching up. A reconnect used to resume from it and skip the rest of the gap. replayFrom now tracks each unfinished replay's bar, advanced by each replay frame's time, and a reconnect resumes from there first.
  • An empty truncated replay (to null) is asked for again from from. If it comes back empty again from the same bar, that bar is larger than the server's cap. Stderr then says so instead of "more to come", and the stream stops asking. StreamReplay.FollowedUp tells the CLI whether a follow-up was sent.
  • A refused follow-up is sent again. A follow-up refused with limit_exceeded is sent again after a jittered pause, up to streamBusyRetries times, then the stream warns. Running out of the 50 follow-ups also warns now, instead of stopping without a word.
  • Docs: the streamMessageLimit comment is updated (replayed bars now come in small frames), and so is the README's replay paragraph.

Tests

go test -run 'TestStream_' ./... passes. New tests:

  • an empty truncated replay is asked for again from from, then given up with a message;
  • a drop during a catch-up resumes from where the replay got to;
  • a refused follow-up is sent again, with no warning.

go vet and gofmt are clean. The full go test ./... has the same 8 failures as this PR's base branch: they are the *_live_test.go suites, which need APERIODIC_API_KEY and network access.

https://claude.ai/code/session_01MoDcuxddwYnzAPetT7cR5r


Generated by Claude Code

…and retry refused follow-ups

- A drop while a replay is catching up resumes from the bar it reached, not
  from the newest live row, which arrives before `replayed`.
- A truncated replay with no bars (`to` null) is asked for again from
  `from`; empty a second time from the same bar, that bar is larger than the
  server's cap, and stderr says so instead of "more to come".
- A follow-up refused with limit_exceeded is sent again after a jittered
  pause, up to the busy retries, then the rest is left to REST with a
  warning. Running out of follow-ups now warns too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MoDcuxddwYnzAPetT7cR5r
@szemyd
szemyd added this pull request to stack #34 November 13, 2026 13:24
@szemyd
szemyd merged commit 072bb7c into main Nov 13, 2026
3 checks passed
@szemyd
szemyd deleted the claude/elegant-heisenberg-s0s9ya branch November 13, 2026 13:25
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.

2 participants