fix: write valid multi-line tmux config in Pi Agent images

The Pi Agent dockerfile templates created ~/.tmux.conf with a literal
\n because the RUN command used single-quoted echo. Tmux never parsed
the malformed line, so mouse mode stayed off. Without tmux mouse mode,
mouse-wheel events in xterm.js fell back to Up/Down arrow keys and
cycled shell command history instead of scrolling the terminal buffer.

- Use printf '%s\n' to write real newlines in .tmux.conf.
- Apply the same fix to the ranger rc.conf where the same bug existed.
- Update tool-images/pi-agent.dockerfile and both affected alembic
  migration dockerfile strings.

Quality gates: npm run typecheck, npm run lint, npm test -- --run (87 passed),
py_compile on changed migrations.

Refs: openspec/changes/fix-tmux-mouse-config
This commit is contained in:
Developer
2026-06-14 08:48:39 +00:00
parent 6c31ef9577
commit 4c14966ae3
16 changed files with 70 additions and 29 deletions
@@ -0,0 +1,30 @@
# Fix tmux Mouse Mode Configuration in Pi Agent Images
## Summary
The Pi Agent dockerfile templates create `/home/user/.tmux.conf` using `echo '... \n ...'` with single quotes. In both Dockerfile `RUN` commands and Python-embedded dockerfile strings, single quotes prevent `\n` from being interpreted as a newline, so the resulting `.tmux.conf` contains a single malformed line such as:
```
set -g mouse on\nset -g default-terminal "screen-256color"
```
Tmux fails to parse this, so `set -g mouse on` is never applied. Without tmux mouse mode, xterm.js sends mouse-wheel events as Up/Down arrow keys to the shell, causing wheel scroll to cycle command history instead of scrolling the terminal/tmux buffer.
## Scope
- `tool-images/pi-agent.dockerfile`
- `apps/api/alembic/versions/20260527160017_add_pi_agent_tool_type.py`
- `apps/api/alembic/versions/2026_05_28_add_tool_definition_manifests.py`
## Acceptance Criteria
- [x] Pi Agent image builds write a valid multi-line `.tmux.conf`.
- [x] `.tmux.conf` contains `set -g mouse on` on its own line.
- [x] `.tmux.conf` contains `set -g default-terminal "screen-256color"` on its own line.
- [x] Ranger config is also fixed where the same literal `\n` bug exists.
- [x] Alembic migration dockerfile strings produce the same valid commands as the standalone Dockerfile.
## Related
- `openspec/specs/tool-terminal`
- `tool-images/pi-agent.dockerfile`
@@ -0,0 +1,11 @@
# Fix tmux Mouse Mode Configuration in Pi Agent Images — Tasks
- [x] Identify the literal `\n` bug in `.tmux.conf` creation commands across Pi Agent dockerfiles and migrations.
- [x] Update `tool-images/pi-agent.dockerfile` to use `printf '%s\n'` for `.tmux.conf` and ranger `rc.conf`.
- [x] Update `apps/api/alembic/versions/20260527160017_add_pi_agent_tool_type.py` dockerfile string with the same fix.
- [x] Update `apps/api/alembic/versions/2026_05_28_add_tool_definition_manifests.py` dockerfile string with the same fix.
- [x] Verify resulting Dockerfile commands produce valid multi-line config files.
- [x] Run `npm run typecheck` and `npm run lint` in `apps/web`.
- [x] Run `npm test -- --run` in `apps/web` (87 passed).
- [x] Verify Python migration files compile with `py_compile`.
- [x] Update project maps for changed files.