Skip to content

fix(herdr): fetch captures as ansi to avoid 0.8.0's scroll-based history harvest - #2373

Open
alexlopespereira wants to merge 1 commit into
kunchenguid:mainfrom
alexlopespereira:fix/herdr-080-capture-ansi
Open

fix(herdr): fetch captures as ansi to avoid 0.8.0's scroll-based history harvest#2373
alexlopespereira wants to merge 1 commit into
kunchenguid:mainfrom
alexlopespereira:fix/herdr-080-capture-ansi

Conversation

@alexlopespereira

Copy link
Copy Markdown

Problem

On herdr 0.8.0, a text-format pane read --source recent against an idle alternate-screen agent triggers the new history harvest: herdr injects real ScrollUp wheel events into the pane for up to 15s and then snaps back to the bottom (herdrdev/herdr#2669, closed as a dup of herdrdev/herdr#2387; the mechanism lives in herdr's src/server/alt_screen_read.rs).

Since fm_backend_herdr_capture polls agent panes with exactly that read, every visible pane kept scrolling up and snapping back on its own, all day, on herdr 0.8.0.

Fix

--format ansi reads skip the harvest entirely and return herdr's retained rows instantly — the same content the text format returned before 0.8.0 (the harvest did not exist then). The capture now fetches ansi and strips escapes locally with the shared fm_composer_strip_ansi (already sourced by the adapter).

The capture test now pins --format ansi so a regression cannot quietly reintroduce the scrolling.

herdr has merged a mitigation upstream (herdrdev/herdr#2426, speeds the harvest from ~8.6s to ~0.7s, unreleased as of 2026-08-14), but skipping the harvest on firstmate's high-frequency polls remains the right call regardless.

Validation

tests/fm-backend-herdr.test.sh: 132/132 pass.

🤖 Generated with Claude Code

…ory harvest

On herdr 0.8.0, a text-format `pane read --source recent` against an idle
alternate-screen agent triggers the history harvest: herdr injects real
ScrollUp wheel events into the pane for up to 15s and then snaps back to
the bottom (herdrdev/herdr#2669, closed as dup of kunchenguid#2387). Since firstmate
polls panes with exactly that read, visible panes kept scrolling on their
own all day.

The ansi format skips the harvest entirely and returns herdr's retained
rows instantly - the same content the text format returned before 0.8.0.
fm_backend_herdr_capture now fetches ansi and strips escapes locally with
the shared fm_composer_strip_ansi, and the capture test pins --format ansi
so a regression cannot quietly reintroduce the scrolling.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 696624d6a4

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread bin/backends/herdr.sh
Comment on lines +2604 to +2605
out=$(fm_backend_herdr_cli "$FM_BACKEND_HERDR_SESSION" pane read "$FM_BACKEND_HERDR_PANE" --source recent --lines "$fetch" --format ansi 2>/dev/null) || return 1
printf '%s' "$out" | tail -n "$lines" | fm_composer_strip_ansi

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Record live verification for ANSI capture

Captain, for Herdr 0.8.0 idle alternate-screen panes, the fix depends on vendor-specific behavior that the updated fake test cannot exercise: it only confirms that --format ansi appears in argv and returns an already-plain fixture. The maintained verification matrix still records the old text command at docs/verification/runtime-backends.md:231-238, so there is no live evidence that this path both avoids the history harvest and produces escape-free plain captures after local stripping. Update the real-Herdr guard/evidence with the new command and observed output so future Herdr upgrades cannot silently restore scrolling or leak control sequences.

Useful? React with 👍 / 👎.

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.

1 participant