Fix terminal resize race (#2059)

This commit is contained in:
Christoph Leiter
2026-07-16 23:47:09 +02:00
committed by GitHub
parent a622860a3e
commit 9f5f5fce62
11 changed files with 644 additions and 174 deletions

View File

@@ -1,8 +1,8 @@
import { describe, expect, it } from "vitest";
import { CreateTerminalRequestSchema } from "./messages";
// COMPAT(createTerminalSize): the size field is optional so old clients (which send no size)
// still parse, and old daemons ignore it. These tests pin that contract.
// The optional size field stays accepted permanently: released v0.1.107 clients send it, newer
// app clients don't, and programmatic callers may. These tests pin that contract.
describe("CreateTerminalRequest size", () => {
const base = {
type: "create_terminal_request" as const,

View File

@@ -2122,10 +2122,10 @@ export const CreateTerminalRequestSchema = z.object({
agentId: z.string().optional(),
command: z.string().optional(),
args: z.array(z.string()).optional(),
// COMPAT(createTerminalSize): added in v0.1.107, drop the optional gate when floor >= v0.1.107.
// The client seeds the PTY with its measured viewport size so a new terminal isn't born at the
// 80x24 default and then visibly reflowed. Old daemons ignore this field and start at 80x24;
// the client's first resize corrects it as before.
// Initial PTY size. Added in v0.1.107; the app no longer sends it (the estimate cache that fed
// it was removed — the pane-focus resize claim sizes the PTY instead). Kept and honored
// permanently: released v0.1.107 clients still send it, and programmatic callers may pass an
// exact size. Daemons without it start at 80x24 and the first resize corrects that.
size: z
.object({
rows: z.number().int().positive(),