Skip to content

fix(prompt): read a question card from the pane's bottom when its terminal is scrolled up - #402

Merged
devswha merged 4 commits into
devswha:mainfrom
nahwan-kim:fix/prompt-scrolled-pane
Oct 3, 2026
Merged

devswha merged 4 commits into
devswha:mainfrom
nahwan-kim:fix/prompt-scrolled-pane

Conversation

@nahwan-kim

Copy link
Copy Markdown
Contributor

Change

When a pane's terminal is scrolled up into its history (a drag or the wheel in the terminal lens), every later omo or pi question shows in the chat as the last-resort card with only Enter and Esc, instead of the question with its options. The first question in a session usually renders fine; once the terminal has been scrolled, the following ones do not.

Cause: the prompt reader parsed herdr's visible read, which is the pane's viewport. herdr keeps a scrolled viewport where it is while the agent draws its next menu at the bottom, so the reader got history, recognised no menu, and, with herdr reporting the pane blocked, fell back to the generic card (prompt: pi pane … is blocked on a screen no reader knows; fallback card (2 options) in the server log).

The reader now uses herdr's detection source, the bottom screen herdr itself detects agents from, wherever the viewport is. One helper (liveScreen in server/prompt.ts) serves every screen read the prompt flow parses: the card, the check before an answer is typed, the fallback card, and Codex's queue open/close. Claude's grey suggestion keeps its visible ANSI read, since detection returns text only.

Validation

  • Regression test: server/omo-prompt.contract.test.ts now scrolls the pane a whole screen up into its history after the first answer, then expects the second question's card. Without the change it fails (no card); with it, it passes.
  • Real omo (5.1.13) on herdr 0.9.3, in an isolated test session: several questions in a row each got their real card while the pane stayed at the bottom. With the pane scrolled up, the server before this change returned the Enter/Esc fallback card and logged the same line as above. After this change the same scrolled pane returned the question with its three options, and answering it from the card reached omo.
  • detection vs visible (scratch test, not committed): an idle alternate-screen TUI (mouse reporting on) and a main-screen program, each polled three times. Unscrolled, detection equals visible. Scrolled, only detection still shows the menu. The program's stdin received nothing.
  • Fast checks: generate:types --check, typecheck and build pass. test:unit: 1100 pass; the 14 failures (Codex resume-selection argv and pi's /var vs /private/var tmpdir, macOS-specific) are the same set on upstream/main without this change.
  • test:integration on macOS: the failing set with this change is the same as on upstream/main (Codex/omo session binding and a few others that fail on this Mac either way); the prompt, pi, secret and omo-prompt suites pass.

Not verified: Linux and Windows CI (fork CI waits for approval), and a real phone. The scroll was driven through herdr's pane.scroll, the same call the terminal lens makes.

…minal is scrolled up

The prompt reader parsed herdr's `visible` read, which is the pane's
viewport. A pane whose terminal was scrolled up into its history (a drag
or the wheel in the terminal lens) stays scrolled while the agent draws
its next menu at the bottom, so the reader saw history, no known menu,
and a blocked pane: every later omo or pi question became the fallback
card with only Enter and Esc.

Read herdr's `detection` source instead, the bottom screen herdr detects
agents from, for the card, the check before an answer, and Codex's queue.
An alternate-screen TUI cannot be scrolled, so it reads the same as before.
@coderabbitai

coderabbitai Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: devswha/herdr-web-ui/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: eaf6c378-8e11-4a9f-b8f7-ea72ac13ba72
📥 Commits

Reviewing files that changed from the base of the PR and between 1470ed1 and 77cfc5a.

📒 Files selected for processing (1)
  • CHANGELOG.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • CHANGELOG.md

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review.


📝 Summary

Summary by CodeRabbit

  • Bug Fixes
    • Omo and Pi question cards now read correctly when their menus are outside the visible area of a scrolled terminal, instead of falling back to a later question with only Enter and Esc available.
    • Prompts and Codex queue actions can be detected and used when their content is outside the visible terminal area, including while reviewing earlier output.

Walkthrough

Prompt parsing and Codex question-queue checks now read pane text from the detection buffer. The contract test scrolls the pane before checking its offset. The changelog describes question-card behavior when omo or pi panes are scrolled into history.

Changes

Prompt screen reading

Layer / File(s) Summary
Detection-source prompt and queue reads
server/prompt.ts, server/omo-prompt.contract.test.ts, CHANGELOG.md
liveScreen reads pane text from the detection buffer. Prompt parsing and Codex queue checks use that screen. The contract test scrolls the pane by 60 rows, and the changelog records the fix.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Low

Merge Risk: ⚪ Minimal · up to 77cfc

The selected change is a changelog update describing the question-card fix for scrolled panes. No actionable merge-blocking risk is identified in what was reviewed.

Security Architecture Review

Security architecture risk: 🔵 Low · up to 991e9

The change is narrowly scoped and retains checks before sending answers. No introduced security vulnerability was established, but the external terminal service’s read behavior has not been independently verified during state changes.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The identified changed paths affect cards and input delivery for the selected pane. No new cross-pane addressing mechanism is shown. External read-source isolation and the downstream agent’s effective privileges were not established, so broader exposure cannot be bounded from this evidence.

Trust Boundaries and Controls

  • observed — Production answer routing uses per-pane serialization, and the answer handler retains identity and answer checks before input delivery. These controls constrain stale-card and concurrent-input errors; they do not independently prove that detection text represents the current terminal state.

Resilience and Maintainability Implications

  • inferred — Mismatch and partial-answer paths attempt to close an opened queue, while successful answers poll before closure. Cleanup remains dependent on parsed screen state, and failure cleanup suppresses close errors. The supplied comparison indicates this limitation predates the source substitution; whether detection changes its likelihood remains unresolved.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 2 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main fix: reading question cards from the pane’s bottom when the terminal is scrolled up.
Description check ✅ Passed The description includes the required Change and Validation sections. It explains the problem, implementation, regression coverage, test results, and remaining validation limits.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 6 functions across 2 files. (1 skipped: 1 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@nahwan-kim

Copy link
Copy Markdown
Contributor Author

@devswha
devswha merged commit 334d1bb into devswha:main Oct 3, 2026
14 of 15 checks passed
devswha added a commit that referenced this pull request Oct 3, 2026
Bumps package.json and herdr-plugin.toml to 0.3.48, moves the Unreleased
notes under [0.3.48] - 2026-10-04 (with the PR links #403, #405 and #406
lacked), and adds the compare link. Raises the remote PC bundle to 15
(the bridge starts herdr on a stale socket, #405; `/api/worktree/create`
takes `agent`, #401): push the `remote-v15` tag and let the bundle
workflow publish before running release.yml.

Carries #393, #376, #403, #405, #402, #400, #397, #406, #401, #407,
#408.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Fable 5.1 <[email protected]>
@nahwan-kim
nahwan-kim deleted the fix/prompt-scrolled-pane branch October 4, 2026 09:10
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