Skip to content

fix(workflows): keep stage chat wheel scroll local by default - #1530

Merged
flora131 merged 1 commit into
mainfrom
fix/workflow-stage-chat-copy-mode
Jun 27, 2026
Merged

fix(workflows): keep stage chat wheel scroll local by default#1530
flora131 merged 1 commit into
mainfrom
fix/workflow-stage-chat-copy-mode

Conversation

@flora131

@flora131 flora131 commented Jun 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

Flips the default for workflow stage-chat mouse capture so wheel/trackpad scroll stays inside the active stage transcript or prompt out of the box, rather than falling through to terminal or main-chat scrollback. `ctrl+t` is reframed as a copy mode toggle — turning mouse reporting off when you need to drag-select or copy text, then restoring it on the next press.

Changes

  • Default on: mouseScrollCaptureEnabled now initializes to true so scroll is captured the moment a stage chat opens.
  • Button-event SGR tracking: Added \x1b[?1002h to the tracking sequence on overlay open/close, enabling comprehensive button-event reporting alongside existing normal (?1000h) and SGR (?1006h) codes.
  • Copy mode UX: ctrl+t now disables mouse reporting (copy mode on) so terminal/tmux text selection works, and re-enables it on the next press. Footer hint updated from mouse scroll on/offcopy mode on/off to match.
  • Docs: Updated packages/coding-agent/docs/workflows.md and packages/workflows/README.md to describe the new default and copy-mode semantics.
  • CHANGELOG: Revised the [Unreleased] ### Fixed entry for Enhancement: support text selection and copying in workflow chats #1519 to reflect the inverted default.
  • Tests: Updated stage-chat-view-13, workflow-attach-pane-10, and stage-chat-view-helpers to match the new default; added integration test asserting the button-event SGR escape sequences are written on open/close.

Notes

Refs #1519

Validation:

  • AGENT=1 bun test test/unit/stage-chat-view-13.test.ts test/unit/workflow-attach-pane-10.test.ts test/integration/overlay-entrypoints-open-focus.test.ts
  • Commit/push hooks ran bun run lint, bun run check:file-length, and bun run test:unit successfully.

Capture terminal mouse wheel input in attached workflow stage chats by default so scroll gestures stay inside the active transcript or prompt.

Expose ctrl+t as a copy-mode toggle that disables workflow-chat mouse reporting for terminal text selection, and document the updated behavior.

Assistant-model: GPT-5.5
@mintlify

mintlify Bot commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
bastani 🟢 Ready View Preview Jun 27, 2026, 6:58 AM

💡 Tip: Enable Workflows to automatically generate PRs for you.

@claude claude Bot changed the title fix(workflows): keep stage chat wheel scroll local fix(workflows): keep stage chat wheel scroll local by default Jun 27, 2026
@claude

claude Bot commented Jun 27, 2026

Copy link
Copy Markdown

Review: fix(workflows): keep stage chat wheel scroll local (#1530)

Reviewed end-to-end — the escape-sequence change in overlay-adapter.ts, the default flip in stage-chat-view-state.ts, the footer/copy-mode relabeling, and how the new ?1002h events flow through both SGR mouse parsers. Overall a clean, well-tested behavior change.

What looks solid

  • The ?1002h addition is safe against the existing parsers. Both mouse handlers defensively guard against motion events: graph-view-input.ts _sgrLeftMousePress() returns null when (buttonCode & 32) !== 0 (the motion bit), so button-event drag motions from ?1002h will NOT trigger spurious node activation/hit-testing; and stage-chat-view-input.ts isMouseSequence() swallows any SGR mouse sequence (press/release/motion), so motion reports will not leak into the chat/prompt input buffer. This is the main correctness risk in switching from ?1000h to ?1000h?1002h, and the code already handles it.
  • Toggle is correctly re-applied to the terminal. WorkflowAttachPane.handleInput compares wantsMouseScrollTracking() before/after and calls _syncMouseScrollTracking() only on change — so ctrl+t actually emits the enable/disable sequence rather than just flipping a flag.
  • Symmetric enable/disable ordering. ON = 1000h 1002h 1006h, OFF = 1006l 1002l 1000l (reverse order) — correct teardown.
  • Docs/README/CHANGELOG all updated per the CLAUDE.md requirement to keep packages/coding-agent/docs current, and the old (now-inverted) changelog line was rewritten rather than duplicated. The new overlay-entrypoints-open-focus test asserting the exact open/close escape sequences is a good regression guard.

Suggestions / nits

  1. Internal naming now reads as a double-negative. The user-facing concept flipped to copy mode, but the internal field stayed mouseScrollCaptureEnabled and the const is still STAGE_CHAT_MOUSE_SCROLL_TOGGLE_LABEL. The footer is now copyModeState = mouseScrollCaptureEnabled ? off : on — an inversion that is easy to misread on a future edit. Consider a derived copyModeEnabled = !mouseScrollCaptureEnabled accessor or a one-line comment. Not blocking.
  2. Confirm this is the intended final default direction. This reverses the prior default from Enhancement: support text selection and copying in workflow chats #1519 (the previous changelog line explicitly said stage chats leave terminal text selection enabled by default). The rewrite reads as deliberate — just flagging that the default now means terminal-native text selection requires ctrl+t first, the opposite of the main chat. Worth a final sanity check against the Enhancement: support text selection and copying in workflow chats #1519 discussion that capture-by-default is the desired end state.
  3. Missing a regression test for the parser interaction. The new tests cover the toggle state machine and the open/close sequences, but nothing asserts that the newly-emitted ?1002h motion events are ignored (do not activate a graph node or insert junk into the prompt). Given how central the parser guards are to this change safety, a small test feeding a motion event and asserting no activation / no buffer mutation would lock in the behavior. Optional but high-value.
  4. Trivial: a stray blank line was added before the closing brace in test/unit/stage-chat-view-13.test.ts.

Test coverage

Good — toggle behavior, default state, footer hint text, and the raw escape sequences are all covered. The only gap is the parser-interaction case noted in #3. Nice, focused fix.

@flora131
flora131 merged commit d6241ad into main Jun 27, 2026
11 checks passed
@flora131
flora131 deleted the fix/workflow-stage-chat-copy-mode branch June 27, 2026 07:05
lavaman131 pushed a commit that referenced this pull request Jun 29, 2026
Capture terminal mouse wheel input in attached workflow stage chats by default so scroll gestures stay inside the active transcript or prompt.

Expose ctrl+t as a copy-mode toggle that disables workflow-chat mouse reporting for terminal text selection, and document the updated behavior.

Assistant-model: GPT-5.5
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