Repository navigation
fix: fullscreen mouse ownership and trackpad scroll jitter - #16
Conversation
Pi 0.84 replaced CreateAgentSessionOptions.modelRegistry with the shared ModelRuntime and changed the ModelSelectorComponent constructor. The ExtensionContext still only exposes the synchronous ModelRegistry facade, so resolveModelRuntime() reuses the runtime behind it; sharing the Primary's runtime keeps extension-registered providers and runtime credentials available to Advisor sessions. BREAKING: peerDependencies now require pi >= 0.84.4.
Two overlay input bugs: - The overlay toggled terminal mouse reporting (1000/1006) directly, which is required under the regular TUI but permanently disabled pi's own mouse support (transcript scroll, selection, scrollbar) after the overlay closed in fullscreen mode. The overlay now only manages mouse reporting when tui.mode is regular; fullscreen pi owns the mouse and forwards wheel input to the focused overlay. - Horizontal trackpad wheel events (SGR buttons 66/67) were misread as vertical scroll, so diagonal swipes yanked the transcript up three lines and broke follow; subsequent wheel-down events snapped it back to the bottom, producing visible bounce at the bottom. Only buttons 64/65 scroll now, other mouse events are consumed without leaking into the input, and scroll offsets are clamped at input time so no-op scrolls no longer trigger redundant repaints. Also adds PI_ADVISOR_DEBUG_SCROLL to capture the raw input stream for terminal-specific scroll diagnosis, plus a BDD regression scenario that fails on the old misreading.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 21da344d9a
ℹ️ 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".
Pi 0.84 RPC message_update events carry assistantMessageEvent deltas without the accumulated message, so the visibility step now reassembles text_delta content instead of matching on event.message.
The variable holds a log file path (GIT_TRACE-style) and captures all overlay input, not just scroll events; name it after the artifact so future debug capture points share the same log.
Fullscreen pi enables button-motion mouse tracking, which tmux reports via mouse_any_flag rather than mouse_standard_flag; add a matching assertion helper. The new scenario opens and closes the overlay under --tui-mode fullscreen and requires pi's mouse reporting to survive, which fails when the overlay writes mouse-disable sequences itself.
|
@codex review |
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
Summary
两个 Advisor Overlay 输入 bug 的修复,以及配套的 pi 依赖升级。
1. Fullscreen 模式下 Overlay 破坏 pi 的鼠标支持
Overlay 直接写终端序列开关 mouse reporting(
1000/1006)——这在 regular 模式是必要的(pi 不管鼠标),但在 fullscreen 模式下,Overlay 关闭时写的1000l/1006l会把 pi 自己启用的鼠标永久关掉(pi 只在 start/stop 管理),导致本会话 transcript 滚轮滚动、文本选择、滚动条拖拽全部失效。修复:只在
tui.mode !== "fullscreen"时由 Overlay 管理 mouse reporting;fullscreen 下 pi 会把滚轮事件透传给聚焦的 Overlay,滚动功能不受影响(已实测)。2. 触控板滚动到底部时持续抖动
真实环境日志(
PI_ADVISOR_DEBUG_SCROLL)定位:Ghostty 触控板斜向滑动会发出水平滚轮事件(SGR 按钮 66/67),而getMouseScrollDelta的button & 1判断把 66 误读为向上滚 3 行。每个水平微事件都把视图向上拽 3 行并打断 follow,后续向下事件再拉回底部,形成持续抖动。修复:
maxScroll钳制 offset,滚动爆发不会在帧间越过底部3. 升级 @earendil-works/pi-* 到 0.84.4
tui.mode需要 0.84+,且 0.84 有 API 破坏:createAgentSession的modelRegistry选项换成modelRuntime,ModelSelectorComponent构造签名变更。ExtensionContext只暴露ModelRegistry兼容门面,resolveModelRuntime()复用其背后的共享ModelRuntime,保持 Advisor 与 Primary 共享扩展注册 provider 和凭据。BREAKING: peerDependencies 现在要求 pi >= 0.84.4。
Test plan
just fmt/just check/just test通过mouse_any_flag/mouse_sgr_flag保持1 1(修复前归 0);Overlay 内滚轮上下滚动正常