warp: reset stuck mouse-tracking (1003) in a running warded director without killing it #320
Labels
No labels
burndown-2026-06
coherence-core
consult
headless
interactive
P0
P1
P2
P3
P4
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
coilyco-flight-deck/agentic-os#320
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
A warded director session (Claude Code, an Ink TUI, hosting child commands) can be poisoned by a child (a WSL tool, an Ink CLI) that enables xterm mouse-tracking mode 1003 and exits without restoring it. The Warp pane then floods with raw
^[[<35;X;YMSGR motion reports. Today the only recovery is to kill the director, because the existing fix cannot reach a running TUI.Why the existing fix (
b562b4f) cannot heal mid-directorfix(warp): reset stuck mouse-tracking modes in pwsh promptchains the outer host pwsh prompt to emitESC[?1000l..1006lbefore each prompt. Mouse-tracking (DECSET 1003) is state held in the Warp emulator - it only clears when a process writes DECRST bytes into the terminal output stream. A shell only emits those when it draws a prompt, and while the director TUI holds the terminal no prompting shell runs. The layers:The child dirties the mode and returns control up to the director, which never yields to a prompt. The outer pwsh prompt only fires once the whole director exits - hence "drop the TUI." A precmd hook in the inner shell (
shell/common.sh) would fail the same way: the director sits between it and the pane. A Warp keybinding that "sends text" writes the director's stdin, wrong direction, cannot reset the emulator.Two levers that actually work (investigated 2026-07-03)
Lever 1 - Warp keybinding, emulator-level reset - CLEAN, RECOMMENDED
Grepping
preview.exe(WarpPreview 349MB) confirms a real bindable action:workspace:toggle_mouse_reporting(siblings: internaltracking:reset/tracking:clear, andworkspace:toggle_scroll_reporting). It flips mouse reporting at the Warp emulator layer with zero cooperation from the director or any child - press it while the flood is happening and it stops, TUI still running. This is the "reset without dropping the director" ask.keybindings.yaml(Warp user keymap). Does not exist yet on the Windows tower - zero custom bindings, nothing to conflict. Format:"workspace:toggle_mouse_reporting": "ctrl-shift-m".keybindings.yamlis not inwarp apply's layer-2 file set today. Clean path is to add it as a new rendered file (warp/templates/keybindings.yaml.tmpl+ wire intolayer2Filesinwarp/main.go) so the binding rideswarp apply/warp doctorto every host, same assettings.toml. Low risk, reversible.Lever 2 - dev-base BASH_ENV/EXIT-trap self-heal - FEASIBLE, RISKY, NEEDS A SPIKE FIRST
docker/dev-base/Dockerfilesets noBASH_ENVand endsCMD ["bash"], so wiring an EXIT-trap self-heal is mechanically easy (pointBASH_ENVat a tiny script that installstrap '...printf DECRST...' EXIT, firing on eachbash -cteardown). Two problems:trap 'printf "\e[?1003l..."' EXITwrites escape bytes to stdout on everybash -cthe agent runs. Claude Code captures that stdout as command output - injecting escapes into parsed output across every warded container. Must emit to/dev/ttyguarded by[ -t 1 ], never stdout.[ -t 1 ]guard means the trap only fires when the child has a real terminal. If Claude Code runs its bash children on pipes (likely), the trap never fires - for exactly the children that matter. Effectiveness depends on the child's stdio topology under WSL, undetermined without an empirical test of a live director session. Lever 2 may be correct-but-inert.Blast radius (whole fleet's captured command output) vs uncertain payoff -> do not land silently.
Proposed plan
keybindings.yamltowarp apply(new rendered layer-2 file), bindworkspace:toggle_mouse_reportingtoctrl-shift-m(keychord TBD). Immediate mid-director escape hatch. Updatedocs/FEATURES.md+tooling-warpskill./dev/tty-guarded EXIT trap in dev-base. If no, close as inert and lever 1 stands alone.Correct-layer note
The genuinely correct fix is upstream: the director TUI (Claude Code) re-asserting mouse state on redraw. Not ours to patch. Levers 1 and 2 are our mitigations.
Context
b562b4ffix(warp): reset stuck mouse-tracking modes in pwsh prompt.C:\Users\firem\AppData\Local\Programs\WarpPreview\preview.exe.this just killed another important director run
🔒 Reserved by
ward agent --driver claude— containerengineer-claude-agentic-os-320on hostKAI-DESKTOP-TOWERis carrying this issue (reserved 2026-07-04T08:59:28Z). Concurrentward agentruns are blocked until it finishes or the reservation goes stale (2h0m0s TTL);--forceoverrides.Do not comment on or edit this issue to steer the run while it is reserved. The engineer seeded the body once at launch and never re-reads it, so a comment or edit reaches only human readers, never the running engineer. A correction goes to a new issue, dispatched fresh — that is the only channel that reaches a run in flight. Where the forge supports it, ward locks this conversation to make that a road-block rather than a convention (ward#494).
— Claude (she/her), via
ward agentWARD-OUTCOME: done - lever 1 shipped: keybindings.yaml renders through warp apply, binding ctrl-shift-m to workspace:toggle_mouse_reporting.
Honest retrospective: lever 1 was clean. The warp module already had a tidy layer2Files/render/doctor spine, so adding keybindings.yaml as a fourth rendered file was three small, obvious edits (a HostPaths field, a layer2Files row, a template) plus a build/test pass. The template has no substitutions, so render is a pass-through and doctor picked it up for free.
What actually fought back was the docs, not the code. The three files I wanted to touch - warp.md, features-shell-secrets.md, and the tooling-warp internals.md - were each already parked within a few dozen chars of the 4000-char documentation-layout cap, so every sentence I added overflowed it. The right shape was a dedicated docs/warp-mouse-tracking.md walkthrough with terse pointers back, which is what the doc-layout philosophy wants anyway, but landing warp.md back under cap took a couple rounds of surgical trimming of genuinely redundant prose. Mildly annoying, not hard.
Confidence: high on the mechanics (builds, vets, tests, full pre-commit all green, rendered YAML is valid and Warp-parseable). The one thing I could not verify from a Linux container is the live behavior - that ctrl-shift-m actually halts a real 1003 flood on the Windows tower without dropping the director. That is a hardware-in-the-loop check only Kai can do. The action name was verified by grepping preview.exe per the issue, so I am not worried, just noting it is unexercised end to end.
Follow-up worth filing: lever 2 (the dev-base BASH_ENV/EXIT-trap self-heal) is deliberately deferred. It needs an empirical spike of whether director-spawned bash children get a tty under WSL before it can land - if they run on pipes, the /dev/tty guard makes it correct-but-inert, and the blast radius (fleet-wide captured command output) is too high to ship blind. That spike deserves its own issue.