You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(herdr-core): read a full-screen program a shell started from its own screen - #4323
On herdr-core, the herdr-core adapter takes a screen's colors from the first paint of a watch-only attach (paintedScreen), and Claude Code's send check uses them only while their text matches hc's plain read (viewportShowsLive). hc paints a terminal's main screen first, then switches to the alternate screen (CSI ?1049h) and paints that. Measured on hc 0.1.21: for a program on the alternate screen the first paint is the same with history: 0 and history: rows, and it holds the main screen's modes, tab stops and lines before the switch.
For a program typed at a shell prompt (Claude Code or Codex started from a shell, rather than as the terminal's own command), those lines are the shell's: its prompt and the line that started the program. paintedScreen split the paint at the clears and ran the shell's last line into the screen's top row. So the colored read never matched the text read, and every chat message sent while Claude showed its grey tip or a suggested prompt was refused: "Not sent: Claude Code's input box in the terminal may not be empty. It shows “Try "…"”."
onAlternateScreen had the same blind spot. It looked for the switch only right after the first clear, so such a program counted as on the main screen, and pane.read with source: "recent" asked hc for history, which hc scrolls the program for (#3128).
paintedScreen reads only what follows the switch when the paint has one (alternateScreenAt). The main screen's history handling is unchanged.
onAlternateScreen finds the switch anywhere in the first paint, before its end.
Validation
bun test server/herdr-core/adapter.test.ts in the self-hosted CI runner image, built from this branch's scripts/self-hosted-runner/Dockerfile (Bun 1.4.4): 107 pass.
A new test feeds a paint in hc 0.1.21's shape (a shell's line, the switch, Claude's box with a dim suggestion). It expects the colored screen to be that screen alone, viewportShowsLive to be true and claudeInputDraft false.
bun run check fast in the same image: workflow syntax, generated types and themes, typecheck and build pass. Unit tests have 20 failures, all in scripts/plugin.test.ts (18) and scripts/relay-ios-sim.test.ts (2). The same 20 fail on main (83f99fd) in the same image.
Downstream, this change has run since 2026-11-20 against hc 0.1.21 with Claude Code tabs typed at a shell prompt. Before it, every send over Claude's grey tip was refused as input_draft. With it, the colored read matches the screen and those sends go through. The draft check itself is unchanged.
Not run: the browser lanes (no UI change), the Windows and macOS jobs.
…own screen
hc paints a terminal's main screen first, then switches to the alternate
screen and paints that (measured on hc 0.1.21). For a program typed at a
shell prompt (Claude Code, Codex), the shell's modes, tab stops and lines
come before the switch, so paintedScreen ran the shell's last line into the
screen's top row: the colored read never matched hc's text read, and every
chat message while Claude showed its grey tip or a suggested prompt was
refused as input_draft. onAlternateScreen looked for the switch only right
after the first clear, so such a program was read with history too, which
hc scrolls it for (devswha#3128).
paintedScreen now reads only what follows the switch, and onAlternateScreen
finds the switch anywhere in the first paint.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Auto incremental reviews are disabled on this repository.
Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.
You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.
Use the checkbox below for a quick retry:
Trigger review
No actionable comments were generated in the recent review.
Summary
Summary by CodeRabbit
Bug Fixes
Fixed how Ovis displays Claude Code sessions that switch to a full-screen interface after shell output. The display now reflects the current full-screen view rather than including earlier shell content.
Improved live-screen detection for these sessions and prevented dimmed suggestions from being mistaken for draft messages.
The adapter now detects alternate-screen switches that follow shell output. It reads the alternate-screen content without including main-screen history and uses the same switch detection when classifying the screen.
Changes: Alternate-screen paint handling
Layer / File(s)
Summary
Detect and read alternate-screen content server/herdr-core/adapter.ts, server/herdr-core/adapter.test.ts
The adapter identifies a valid alternate-screen switch and reads that content instead of main-screen history. A regression test covers a shell output followed by Claude Code’s alternate screen.
Alternate-screen detection uses the parsed switch position. The history test adds a shell-before-switch case, and the changelog records the Claude Code scenario.
Issue 4321: The changes address the reported mismatch between adapter screen reads and hc terminal reads in an alternate-screen scenario. The issue’s main-screen redraw case may differ from the case covered here.
Suggested reviewers:devswha
Merge Risk: Minimal · previous review 7f7cf
This fixes how Ovis reads full-screen programs such as Claude Code when they start from a shell prompt. The change is narrow and has regression tests. No merge-blocking risk was found.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: herdr-core now reads a full-screen program that a shell started from its own screen. The adapter changes in paintedScreen and onAlternateScreen match this. The title i…
Description check
The description follows the repository template. It has a Change section that explains the problem, the cause (paintedScreen splitting at clears, onAlternateScreen missing the switch), and the fix. It…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: herdr-core now reads a full-screen program that a shell started from its own screen. The adapter changes in paintedScreen and onAlternateScreen match this. The title is specific and follows the fix(scope) convention. It is 79 characters, which is slightly long but acceptable.
Full details: Description check
Explanation
The description follows the repository template. It has a Change section that explains the problem, the cause (paintedScreen splitting at clears, onAlternateScreen missing the switch), and the fix. It has a Validation section listing the commands run, their results, pre-existing failures on main, and skipped lanes. It also states that the change includes a regression test and links the issue #3128. The changelog entry in changelog.d/ is covered by the raw summary. The description does not show an explicit CONTRIBUTING.md checklist or a contract-test statement, but the template does not strictly require them for this non-HTTP change.
Finishing Touches
Generate unit tests (beta)
Create a new PR
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.
Reviewing files that changed from the base of the PR and between a79d6ca and 7f7cfdf.
Files selected for processing: 3
changelog.d/herdr-core-alternate-paint.md
server/herdr-core/adapter.test.ts
server/herdr-core/adapter.ts
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.
…th history before it, and of one that is the terminal's own
hc 0.1.21 paints the main screen before switching to the alternate one for
every full-screen program, not only one a shell started: a program that is
the terminal's own command gets its blank main screen painted first, and a
watch-only attach that asks for history (the colored read) gets the main
screen's history and a second clear before the switch. Both shapes were
measured on a real hc 0.1.21; main reads the shell's lines into the colored
screen and asks hc for 400 lines of history of the program's own screen.
Co-Authored-By: Claude Opus <[email protected]>
…hine's line came back
When another machine's line drops in the middle of a watch-only attach's
first paint, hc writes its "line lost" notice and attaches again on the
same channel with a fresh paint (remote/viewers.rs `reattach`). The adapter
kept the cut paint in front of the new one, and since the alternate screen
is now looked for anywhere before the paint's end, a switch in the cut
paint made the colored read the stale full-screen rows, the notice and the
new screen run together, and counted the terminal as on the alternate
screen after its program had left it. Only the last paint that began
before the screen's end is read now.
Co-Authored-By: Claude Opus <[email protected]>
…ry full-screen program's history read
On hc 0.1.21 the main screen is painted before the switch for a program
that is the terminal's own command too, so main asked hc for history of
every full-screen program there, not only one a shell started; on hc 0.1.20
and older nothing changes.
Co-Authored-By: Claude Opus <[email protected]>
Merged through pr-merge at head 444d15c1e. Seen before the merge was asked for: required checks green, no unresolved thread, no conflict, no hold, main not red, no release in progress. CodeRabbit said it did not review (a limit or a skip) since this head.
Reviews of head 444d15c, on the maintainer's standing word for outside fix PRs (fix-issue-pr session, 2026-11-22). CodeRabbit left no open point on the contributor's head and did not review this one (skipped), so these stand in:
An Opus review of the PR merged with main (no conflicts). The bug was reproduced on main: hc 0.1.21 paints the main screen before it switches to the alternate one, so the colored read took the shell's lines into the full-screen program's screen and Claude's grey tip was refused as a draft ("[0m~/code ❯ claude[0m where "[0m was expected), and history was asked of every full-screen program, bringing Terminal (herdr-core): a held drag in a Codex pane stops scrolling when the pane's stream re-initialises mid-drag #3128 back (the Terminal (herdr-core): a held drag in a Codex pane stops scrolling when the pane's stream re-initialises mid-drag #3128 test got [400] for [0]). Checked live on isolated hc 0.1.21 and 0.1.18 cores, not the maintainer's session: with this PR the colored read equals hc's text read on 0.1.21; on 0.1.18 every output is byte-identical to main; a program that is the terminal's own reads right, and nothing stale is left after a program leaves the alternate screen. Readers of this screen (Claude's input-row guard, prompt reading, OpenCode skill attach, the mirror) keep their fixtures and tests green.
A Codex gpt-6.2-sol adversarial review. Confirmed and fixed: a line drop in the middle of a paint followed by a fresh paint on the same channel took stale text and the drop notice into the screen; the adapter reads only the last paint (e1b5ed5, a little beyond the contributor's scope, with a test that fails without it). 0cdb3ee adds 0.1.21's history-before-switch and own-program paints, both failing on main. The changelog fragment now says the bug is hc 0.1.21's and that the history fix covers every full-screen program (444d15c). Its claim that Codex loses stitched history is Terminal (herdr-core): a held drag in a Codex pane stops scrolling when the pane's stream re-initialises mid-drag #3128's intended behaviour.
Checks on 444d15c: bun test server/herdr-core/ and bun run check fast green locally; CI green.
Users see a change only with hc 0.1.21 (Ovis installs 0.1.17). #4321 is a different main-screen drift and stays open.
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
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.
Change
On herdr-core, the herdr-core adapter takes a screen's colors from the first paint of a watch-only attach (
paintedScreen), and Claude Code's send check uses them only while their text matches hc's plain read (viewportShowsLive). hc paints a terminal's main screen first, then switches to the alternate screen (CSI ?1049h) and paints that. Measured on hc 0.1.21: for a program on the alternate screen the first paint is the same withhistory: 0andhistory: rows, and it holds the main screen's modes, tab stops and lines before the switch.For a program typed at a shell prompt (Claude Code or Codex started from a shell, rather than as the terminal's own command), those lines are the shell's: its prompt and the line that started the program.
paintedScreensplit the paint at the clears and ran the shell's last line into the screen's top row. So the colored read never matched the text read, and every chat message sent while Claude showed its grey tip or a suggested prompt was refused: "Not sent: Claude Code's input box in the terminal may not be empty. It shows “Try "…"”."onAlternateScreenhad the same blind spot. It looked for the switch only right after the first clear, so such a program counted as on the main screen, andpane.readwithsource: "recent"asked hc for history, which hc scrolls the program for (#3128).paintedScreenreads only what follows the switch when the paint has one (alternateScreenAt). The main screen's history handling is unchanged.onAlternateScreenfinds the switch anywhere in the first paint, before its end.Validation
bun test server/herdr-core/adapter.test.tsin the self-hosted CI runner image, built from this branch'sscripts/self-hosted-runner/Dockerfile(Bun 1.4.4): 107 pass.viewportShowsLiveto be true andclaudeInputDraftfalse.adapter.tsput back, both tests fail.bun run check fastin the same image: workflow syntax, generated types and themes, typecheck and build pass. Unit tests have 20 failures, all inscripts/plugin.test.ts(18) andscripts/relay-ios-sim.test.ts(2). The same 20 fail on main (83f99fd) in the same image.input_draft. With it, the colored read matches the screen and those sends go through. The draft check itself is unchanged.🤖 Generated with Claude Code