fix(herdr): fetch captures as ansi to avoid 0.8.0's scroll-based history harvest - #2373
fix(herdr): fetch captures as ansi to avoid 0.8.0's scroll-based history harvest#2373alexlopespereira wants to merge 1 commit into
Conversation
…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>
There was a problem hiding this comment.
💡 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".
| 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 |
There was a problem hiding this comment.
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 👍 / 👎.
Problem
On herdr 0.8.0, a text-format
pane read --source recentagainst 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'ssrc/server/alt_screen_read.rs).Since
fm_backend_herdr_capturepolls 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 ansireads 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 sharedfm_composer_strip_ansi(already sourced by the adapter).The capture test now pins
--format ansiso 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