Fix BUG-026: forward mouse wheel to full-screen agents#812
Merged
Conversation
The native Hera view's mouse-wheel scroll routes through HeraPage.MouseHandler -> regionAt -> the pane under the cursor. If a wheel event misses the pane rects it falls through to FocusRail, where the rail has no MouseHandler, so Box.MouseHandler does not consume it and tview never redraws (Application redraws a mouse event only when consumed) -- scroll-up silently does nothing. The existing TestPanes_MouseRoutingByRegion scrolls over the agent region but never asserts the scroll landed. Add two assertions that close that gap: - TestPanes_MouseScrollRoutesToWorkerPane: wheel over the agent region scrolls the selected live worker's TerminalPane (consumed + scrollOffset increases). - TestPanes_MouseScrollRoutesToCoordPane: with a coordinator selected (Details mode), wheel over the coord region scrolls the coordinator pane. Investigation note: the BUG-026 report (cannot mouse-scroll-up in new/active Hera sessions) could not be reproduced on this base -- routing and scrollback both behave correctly for live worker and coordinator panes. These tests pin that correct behavior as a regression guard while a precise repro is gathered. Test-only; no behavioral change. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…ty scrollback Agents like Claude Code / Codex run as full-screen TUIs: they take the alternate screen (ESC[?1049h) and redraw in place via cursor-home (ESC[H) instead of emitting scrolling output, so the terminal pane's own scrollback stays near-empty. The native Hera coord/agent panes (and the shared Tasks-tab agent view) scroll that scrollback on the mouse wheel, so wheel-up was a silent no-op whenever the agent rendered in place -- maxScroll clamps to 0 with no history to reveal. Confirmed by feeding two real session logs through the replay emulator: a coordinator that emitted scrolling output yielded ~2791 scrollback lines (scrollable); a worker that redrew in place yielded 0. Both were on the alternate screen, so alt-screen presence is not the discriminator -- committed scrollback depth is. NOT a routing/click-to-focus bug: the wheel reaches the pane (scroll-down visibly redrew); there was simply nothing in scrollback. Fix (matches how a real terminal hands the wheel to the foreground full-screen app, and the existing plugin-view forwarder #681): when the live agent is on the alternate screen, TerminalPane.MouseHandler forwards wheel events to the agent as SGR mouse frames (ESC[<64|65;Cx;Cy M) via sess.WriteInput so the agent scrolls its own view. Main-screen agents and finished/replay sessions keep the pane's own terminal scrollback unchanged. Mouse-only -- no keybinding/help changes. Specs: openspec/changes/fix-bug-026 (terminal-rendering delta). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
…ding to full-screen agents) Base spec updated atomically with the merged fix per CLAUDE.md. The lone incomplete task (6.1 live dogfood) is the pending runtime verification on Aaron's relaunch.
Merging this branch will decrease overall coverage
Coverage by fileChanged files (no unit tests)
Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code. Changed unit test files
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
In the Hera panes and the Tasks-tab agent view, the mouse wheel did nothing on a freshly-started agent session — you couldn't scroll up. Older sessions scrolled fine.
Root cause (not an argus regression): Claude Code (and Codex) recently default to a fullscreen mode — the alternate screen (
ESC[?1049h) with in-place cursor-home redraws. A full-screen TUI has no terminal scrollback by definition (sbLen=0,maxScroll=0), so the pane's wheel-scroll had nothing to reveal. This is faithful terminal behavior — you can't wheel-scroll a full-screen TUI in any terminal. Old sessions scrolled only because they had accumulated main-buffer scrollback (a bug-bash-2 coordinator measuredsbLen≈2791vs a fresh worker'ssbLen=0, both on the alternate screen). The "recent regression" was the upstream Claude Code default change, not an argus commit.Fix
TerminalPane.MouseHandlernow forwards the wheel to a live, alternate-screen agent as SGR mouse frames (ESC[<64;Cx;Cy Mwheel-up,65wheel-down) over the session input, so the agent scrolls its own view — exactly how a real terminal hands the wheel to a foreground full-screen app (mirrors the plugin-view forwarder, #681). Agents enable SGR mouse reporting (1000h/1002h/1003h/1006h), so the frames are understood.TerminalPane, so this fixes both the Hera coord/agent panes and the Tasks-tab agent view.Verification
forward_wheel_test.go(forwards-when-alt-screen, scrolls-scrollback-when-not) + Hera routing regression tests.make pre-pr: build / vet / fmt-check / lint-pr (0 issues) / test-cover-gate (89.5% ≥ 88 floor) all green. Thevulngate flags two Go stdlib CVEs (net/textproto,crypto/x509; fixed in go1.26.4) — toolchain-only, not this change, and advisory (continue-on-error) in CI.Spec
OpenSpec
terminal-renderingcapability gains a "Mouse wheel forwarded to full-screen agents" requirement (changefix-bug-026, archived into base specs in this PR).🤖 Generated with Claude Code