fix(tui): honor documented mouse_tracking config key#17188
Conversation
The TUI runtime was reading display.tui_mouse while docs and user-facing examples pointed users at display.mouse_tracking. That made persistent mouse-disable config look like a no-op for users trying to restore native terminal selection/copy behavior on Linux/SSH/tmux terminals. Use display.mouse_tracking as the canonical key, keep display.tui_mouse as a legacy fallback, and have /mouse write the documented key. Both gateway config.get and client-side config sync now share the same precedence: the canonical key wins, then the legacy key, then default on.
There was a problem hiding this comment.
Pull request overview
Aligns TUI mouse tracking with the documented config key by making display.mouse_tracking canonical (while still honoring display.tui_mouse for legacy configs), and ensures the /mouse command persists the documented key.
Changes:
- Add
display.mouse_trackingto the client config types and keepdisplay.tui_mouseas a legacy alias. - Update TUI config normalization to prefer
mouse_trackingovertui_mouse. - Update gateway
/mousehandling to read canonical-with-legacy-fallback and to writedisplay.mouse_tracking, plus add regression tests.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| ui-tui/src/gatewayTypes.ts | Adds mouse_tracking and documents tui_mouse as a legacy alias. |
| ui-tui/src/app/useConfigSync.ts | Normalizes mouse tracking with canonical-vs-legacy precedence and wires into UI state. |
| ui-tui/src/tests/useConfigSync.test.ts | Adds tests covering canonical vs legacy precedence for mouse tracking. |
| tui_gateway/server.py | Adds canonical/legacy resolution helper, updates config.get/config.set for mouse, and writes display.mouse_tracking. |
| tests/test_tui_gateway_server.py | Adds gateway test ensuring canonical key is written and legacy fallback still works. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Load gateway config once before deriving display.mouse_tracking state. - Use key-presence precedence on the TUI client too, so canonical mouse_tracking wins over legacy tui_mouse even when the value is null. - Treat numeric 0 as disabled on both gateway and client, matching the existing string "0" handling. - Widen ConfigDisplayConfig mouse fields because config.get full returns raw YAML, not normalized booleans.
There was a problem hiding this comment.
Pull request overview
This PR aligns TUI mouse-tracking behavior with the documented config key by treating display.mouse_tracking as canonical (with display.tui_mouse as a legacy fallback) across both the TUI client and the gateway, and ensures /mouse persists the canonical key.
Changes:
- Add
display.mouse_trackingto the TUI config wire types and keepdisplay.tui_mouseas a legacy alias with widened raw-YAML types. - Implement canonical-vs-legacy precedence and normalization in the TUI (
normalizeMouseTracking) and apply it inapplyDisplay. - Add client and gateway tests covering precedence, numeric/string falsey handling, and persistence of the canonical key.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| ui-tui/src/gatewayTypes.ts | Adds mouse_tracking and widens types for raw YAML compatibility; documents tui_mouse as legacy. |
| ui-tui/src/app/useConfigSync.ts | Introduces normalizeMouseTracking and uses it when fanning config into UI state. |
| ui-tui/src/tests/useConfigSync.test.ts | Adds unit tests for canonical precedence and normalization behavior. |
| tui_gateway/server.py | Adds _display_mouse_tracking, uses it for /mouse status, and makes /mouse persist display.mouse_tracking. |
| tests/test_tui_gateway_server.py | Adds gateway test ensuring canonical key persistence and legacy fallback behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
) * fix(tui): honor documented mouse_tracking config key The TUI runtime was reading display.tui_mouse while docs and user-facing examples pointed users at display.mouse_tracking. That made persistent mouse-disable config look like a no-op for users trying to restore native terminal selection/copy behavior on Linux/SSH/tmux terminals. Use display.mouse_tracking as the canonical key, keep display.tui_mouse as a legacy fallback, and have /mouse write the documented key. Both gateway config.get and client-side config sync now share the same precedence: the canonical key wins, then the legacy key, then default on. * review(copilot): align mouse tracking config coercion - Load gateway config once before deriving display.mouse_tracking state. - Use key-presence precedence on the TUI client too, so canonical mouse_tracking wins over legacy tui_mouse even when the value is null. - Treat numeric 0 as disabled on both gateway and client, matching the existing string "0" handling. - Widen ConfigDisplayConfig mouse fields because config.get full returns raw YAML, not normalized booleans.
) * fix(tui): honor documented mouse_tracking config key The TUI runtime was reading display.tui_mouse while docs and user-facing examples pointed users at display.mouse_tracking. That made persistent mouse-disable config look like a no-op for users trying to restore native terminal selection/copy behavior on Linux/SSH/tmux terminals. Use display.mouse_tracking as the canonical key, keep display.tui_mouse as a legacy fallback, and have /mouse write the documented key. Both gateway config.get and client-side config sync now share the same precedence: the canonical key wins, then the legacy key, then default on. * review(copilot): align mouse tracking config coercion - Load gateway config once before deriving display.mouse_tracking state. - Use key-presence precedence on the TUI client too, so canonical mouse_tracking wins over legacy tui_mouse even when the value is null. - Treat numeric 0 as disabled on both gateway and client, matching the existing string "0" handling. - Widen ConfigDisplayConfig mouse fields because config.get full returns raw YAML, not normalized booleans.
) * fix(tui): honor documented mouse_tracking config key The TUI runtime was reading display.tui_mouse while docs and user-facing examples pointed users at display.mouse_tracking. That made persistent mouse-disable config look like a no-op for users trying to restore native terminal selection/copy behavior on Linux/SSH/tmux terminals. Use display.mouse_tracking as the canonical key, keep display.tui_mouse as a legacy fallback, and have /mouse write the documented key. Both gateway config.get and client-side config sync now share the same precedence: the canonical key wins, then the legacy key, then default on. * review(copilot): align mouse tracking config coercion - Load gateway config once before deriving display.mouse_tracking state. - Use key-presence precedence on the TUI client too, so canonical mouse_tracking wins over legacy tui_mouse even when the value is null. - Treat numeric 0 as disabled on both gateway and client, matching the existing string "0" handling. - Widen ConfigDisplayConfig mouse fields because config.get full returns raw YAML, not normalized booleans.
) * fix(tui): honor documented mouse_tracking config key The TUI runtime was reading display.tui_mouse while docs and user-facing examples pointed users at display.mouse_tracking. That made persistent mouse-disable config look like a no-op for users trying to restore native terminal selection/copy behavior on Linux/SSH/tmux terminals. Use display.mouse_tracking as the canonical key, keep display.tui_mouse as a legacy fallback, and have /mouse write the documented key. Both gateway config.get and client-side config sync now share the same precedence: the canonical key wins, then the legacy key, then default on. * review(copilot): align mouse tracking config coercion - Load gateway config once before deriving display.mouse_tracking state. - Use key-presence precedence on the TUI client too, so canonical mouse_tracking wins over legacy tui_mouse even when the value is null. - Treat numeric 0 as disabled on both gateway and client, matching the existing string "0" handling. - Widen ConfigDisplayConfig mouse fields because config.get full returns raw YAML, not normalized booleans.
) * fix(tui): honor documented mouse_tracking config key The TUI runtime was reading display.tui_mouse while docs and user-facing examples pointed users at display.mouse_tracking. That made persistent mouse-disable config look like a no-op for users trying to restore native terminal selection/copy behavior on Linux/SSH/tmux terminals. Use display.mouse_tracking as the canonical key, keep display.tui_mouse as a legacy fallback, and have /mouse write the documented key. Both gateway config.get and client-side config sync now share the same precedence: the canonical key wins, then the legacy key, then default on. * review(copilot): align mouse tracking config coercion - Load gateway config once before deriving display.mouse_tracking state. - Use key-presence precedence on the TUI client too, so canonical mouse_tracking wins over legacy tui_mouse even when the value is null. - Treat numeric 0 as disabled on both gateway and client, matching the existing string "0" handling. - Widen ConfigDisplayConfig mouse fields because config.get full returns raw YAML, not normalized booleans.
Summary
display.mouse_trackingas the canonical TUI mouse-tracking config key, withdisplay.tui_mousekept as a legacy fallback./mousewritedisplay.mouse_tracking, so persistent config matches docs and user-facing examples.Test plan
cd ui-tui && npm run type-checkcd ui-tui && npm test -- --run src/__tests__/useConfigSync.test.tscd ui-tui && npm test -- --runscripts/run_tests.sh tests/test_tui_gateway_server.py::test_config_mouse_uses_documented_key_with_legacy_fallback