Skip to content

fix(terminal): draw a late joiner of a busy pane from herdr's own screen - #1018

Closed
devswha wants to merge 4 commits into
mainfrom
fix/late-joiner-screen-carry
Closed

devswha wants to merge 4 commits into
mainfrom
fix/late-joiner-screen-carry

Conversation

@devswha

@devswha devswha commented Oct 14, 2026

Copy link
Copy Markdown
Owner

Supersedes #939

Problem

A tab that attaches to a pane another client already holds gets only the attachment's replay: the last 256 KiB of the terminal stream. herdr draws a screen whole once and then sends only the cells that change, so once a busy pane pushes that first whole frame out of the tail, a late joiner never gets the rows nothing has rewritten since (the prompt and status line under a working agent). Reproduced on main today with two tabs: tab A showed the footer rows, the late tab B showed only the churning rows.

Change

This carries @Noobear's #939 onto current main; their two commits are kept as they wrote them, with @Noobear as author:

  • ReplayBuffer.whole says whether the tail still holds the stream from its start; ReplayBuffer.state() gives the private modes and modifyOtherKeys level the whole stream leaves.
  • When the replay is no longer whole, a joiner is drawn from pane.read (visible, ansi) the way the mirror draws a screen (mirrorFrame), led by that state and followed by the stream's own cursor mode. Everything the stream sends while the read is in flight is held for that joiner and sent after the screen, in order. If the read fails, the joiner gets the tail as before. A short stream and mirrored panes are unchanged.
  • New server/late-joiner.contract.test.ts and a whole/state() case in server/output-window.test.ts.

On top, in a separate commit:

Validation

Run in the carry worktree on this branch:

  • bun run typecheck: pass.
  • HERDR_TEST_MODE=unit bun test ./server/output-window.test.ts ./src/conventions.test.ts ./scripts/conventions.test.ts ./server/conventions.test.ts ./scripts/changelog-fold.test.ts: 55 pass, 0 fail.
  • bun run check run bun test --timeout 15000 ./server/late-joiner.contract.test.ts (isolated test herdr): 1 pass, 0 fail.

Not run: the full unit suite, the other contract tests (including server/output.contract.test.ts and server/attach-held.contract.test.ts), browser scripts, and a hands-on two-tab browser check on this branch.

tmshdnaos45-dotcom and others added 4 commits October 14, 2026 10:44
herdr's terminal stream draws a screen whole once and then only the cells that
change. A client joining an attachment late gets the last 256 KiB of that stream,
so once a working agent pushed the whole frame out, a tab coming back (a phone or
iPad returning to a pane a desktop tab holds) got only the cells a spinner and a
timer rewrote: the prompt, its rule and the status line stayed blank, and no later
frame brought them back.

ReplayBuffer now says whether its tail still holds the stream's start (whole) and
the modes the whole stream leaves (state). A joiner whose replay is no longer whole
is drawn from pane.read (ansi, as the mirror draws it), then everything the stream
sent meanwhile, in order; those frames write cells in place, so one the read
already shows draws the same again.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
… screen; assert the screen path in its test

mirrorFrame hides the cursor while it draws, so a late joiner of a pane whose cursor was visible kept it hidden until the next frame that set it. The contract test now also checks the joiner got far less than the 256 KiB tail, so a fall back to the tail cannot pass it.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…e the changelog entry to a fragment

Carrying #939 onto main: main now sizes a late joiner's first-ACK budget to its replay
frame (OutputWindow.join). The screen joinFromScreen sends is that frame, so it gets the
same budget. The CHANGELOG.md entry moves into changelog.d/.
@coderabbitai

coderabbitai Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 37 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository: devswha/herdr-web-ui/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 58c86293-370d-40fd-97b4-503e7cad78c2
📥 Commits

Reviewing files that changed from the base of the PR and between 3381f66 and 989be0a.

📒 Files selected for processing: 5
  • changelog.d/late-joiner-busy-pane-screen.md
  • server/index.ts
  • server/late-joiner.contract.test.ts
  • server/output-window.test.ts
  • server/output-window.ts
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devswha

devswha commented Oct 15, 2026

Copy link
Copy Markdown
Owner Author

Closing: not reproducible in day-to-day use, and the Integration tests check was failing. Can be reopened if the late-joiner blank-footer issue shows up.

@devswha devswha closed this Oct 15, 2026
@devswha
devswha deleted the fix/late-joiner-screen-carry branch October 17, 2026 14:08
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