Skip to content

[Spike] v2 UI: multi-client terminal resize policy in the v2 layer #38

Description

@pseudoseed

Spike 1 of the Codev v2 UI (#37). Experiment, not implementation. No production
code ships from this issue.

The problem

Two clients attached to the same terminal fight over dimensions. PtySession.resize()
(packages/codev/src/terminal/pty-session.ts:567) is a single global call, last-writer-wins.
Attach itself already fans out correctly (PtySession.clients is a Set, with tests), so
this is the one confirmed multi-client bug.

This blocks the entire two-device premise of v2: an iPad and a desktop viewing the same
builder is the product.

The hard constraint

Do not change PtySession's contract. That file is untouched by this fork and hot
upstream; editing it is a merge conflict paid at every sync, forever. See Part 0 of
codev/research/codev-v2-ui-frd.md.

Solve it in a v2-owned attach wrapper that negotiates per-viewer dimensions and calls
the existing resize() with a single agreed value.

Candidate policies to evaluate

  1. Follow the focused client.
  2. Ignore resize from hidden panes.
  3. Per-viewer local cols with server-side reflow.

Pick one on evidence, not preference. Say what each costs and where each is wrong.

Deliverable

A written finding in codev/experiments/ covering:

  • A reproduction of the bug as it exists today, with captured output rather than a description.
  • A working prototype of the chosen policy in a v2-owned wrapper module, with git diff --stat
    proving pty-session.ts is untouched.
  • What the policy does when the focused client disconnects, when both clients are hidden,
    and when a client reconnects after an iOS backgrounding drop.
  • Whether FR-38 can be met additively, or whether it is a requirement to renegotiate.

Reference

  • FRD: codev/research/codev-v2-ui-frd.md, Part 0 (the additive seam), FR-38, Appendix spike 1.
  • Related: FR-39, idempotency keys on mutating RPCs, same backgrounding cause.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/dashboardTower web dashboardfork-onlyDeliberately not upstreamed to cluesmith/codev

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions