Generalized ACP, Reliable Approvals, and Solving Multi-Browser Terminal Resize Fights
How tlbx v10.8 to v10.17 added standards-based ACP agent support, fixed WebSocket writer reordering, and replaced passive terminal resize battles with epoch-guarded ownership.
Two problems surface immediately when an engineering tool moves from single-laptop use to daily multi-device workflows with multiple coding agents: every new agent CLI wants its own custom wire adapter, and opening the same terminal on both a 4K desktop monitor and a 390 px phone turns PTY resizing into chaos.
Between August 15 and September 25, 2026 (269 commits across v10.8.0 to v10.17.0), we tackled both root causes with strict state-machine contracts instead of heuristics.
Generalized ACP: Adding Agents Without Frontend Branches (v10.8–v10.12)
Building a bespoke protocol bridge for every AI coding CLI does not scale. With v10.8.0 and v10.9.0, mtagenthost gained a generalized Agent Client Protocol (ACP) v1/v2 client runtime alongside Codex app-server and the official Claude Agent SDK (v10.11.0, v10.12.0).
- Declarative discovery (
acp-agents.json): Built-in catalog entries cover Grok Build, Gemini CLI, Copilot CLI, and later Antigravity—and any local ACP-compatible binary can be registered inacp-agents.jsonbesidesettings.jsonwithout modifyingmtagenthostor TypeScript UI code. - Server-validated execution: Browser input never passes an arbitrary command or argument vector. The server resolves executables against the local manifest before issuing an owner-authenticated attach request to
mtagenthost. - Reliable approvals (
v10.12.0): Tool approval requests and plan-mode choices are modeled as first-class canonical history items with exact turn guards, preventing stale or duplicate decisions.
Hunting Down Real Terminal Latency and Ordering Bugs (v10.13–v10.15)
On September 5, 2026, an end-to-end latency investigation (docs/TerminalTransportPerformanceAnalysis-2026-09-05.md) caught two concrete bugs in live Chrome profiling that explained rare multi-second stalls:
- A silent layout PUT storm:
shouldIgnoreServerLayoutSnapshotreturned early when a server ACK matched local layout content—before clearing the pending-sync flag. After closing test terminals, an isolated Chrome tab fired 2,848 identical HTTPPUTrequests in 5 seconds (2,847 returning200 OK). - Per-session FIFO inversion in the WebSocket writer:
PrioritizedWebSocketWriterprioritized frames solely by class (ActiveLivevs.BackgroundLive). When a user focused a terminal mid-burst, newer active bytes (10..19) could overtake queued background bytes (0..9) from the same session, triggering an artificial sequence gap and recovery round-trip.
v10.13.0 through v10.15.0 fixed the ordering invariants, introduced cursor-based RecoveryBegin/RecoveryEnd transaction boundaries, and moved responsive mobile layouts away from fragile device-sniffing toward pure viewport geometry (v10.10.0, v10.14.0).
Solving Multi-Browser Resize Fights with Compare-and-Swap Epochs (v10.16.0)
A PTY has exactly one authoritative (cols, rows) grid. When a desktop browser and a phone view the same session simultaneously, letting either window resize the PTY on focus or visibility change constantly reflows text and breaks TUI layouts.
In v10.16.0 (designed in docs/TerminalOwnershipTransitionDesign.md), we replaced focus heuristics with per-session size ownership:
| Rule | Exact Behavior |
|---|---|
| Single Authoritative Owner | Backend persists (ownerTabId, epoch) and a separate monotonic sizeRevision per terminal session |
| Follower Rendering | Non-owning browsers render the confirmed server grid and CSS-scale oversized terminals down to fit; they never mutate PTY dimensions |
| Mux v3 Input Separation | Wire opcodes distinguish live human typing (0x14), terminal-generated OSC/DA replies (0x02), and replayed buffered input (0x15) |
| Explicit or Active Takeover | Clicking Continue here performs a compare-and-swap on epoch (N -> N+1); live human typing (0x14) transfers ownership immediately, while replayed or passive traffic never steals control |
| Atomic Frame Commits | Every browser reduces ownership, scaling, gap fillers, and focus into one immutable TerminalPresentationSnapshot committed inside a single requestAnimationFrame callback |
The result: you can open a running desktop session from your phone to inspect progress or check a diff, and your desktop terminal never jumps or reflows unless you explicitly tap Continue here or start typing.
Milestone Summary
- Commits in phase: 269 (
2026-08-15to2026-09-26) - Key tags:
v10.9.0,v10.12.0,v10.15.0,v10.16.0,v10.17.0 - Durable result: Standards-based ACP runtime, ordered cursor-based recovery, and zero-flicker multi-device terminal ownership. See the phone workflow guide and Agent Controller reference.