Skip to content

Commit 7e9437e

Browse files
test: close PTY stderr oracle
Require exactly one deterministic reconnect status and reject unrelated ANSI output through the mutation gate. agent-session-id: ed878dac-3735-4276-b3e0-ea1b1cd65291 agent-tool: Codex CLI agent-tool-version: 0.145.0 agent-model: unknown agent-runtime-profile: /nix/store/mnx8agbdq3wiyb6vz63lhgscgazkrn98-coding-agent-runtime-profile/share/coding-agents/profile.json agent-skills-manifest: /nix/store/5r69m9k2llmri3na81518zx0a7y0d3cn-agent-skills-corpus/share/agent-skills/manifest.json tooling-profile: dotfiles@0fb7e03
1 parent 1509300 commit 7e9437e

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

cells/pty-attach-machine-stream/fixture/check-stream.mjs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,9 @@ const validateFinal = (data, expectedGeometries, stdout = Buffer.alloc(0), stder
8787
throw new Error("unexpected packet type in machine stream")
8888
}
8989
if (stdout.length !== 0) throw new Error("machine attach wrote to stdout")
90-
for (const marker of ["INITIAL_COLOR_61e8", "AFTER_DROP_61e8", "FINAL_DATA_61e8"]) {
91-
if (stderr.includes(Buffer.from(marker))) throw new Error(`terminal marker leaked to stderr: ${marker}`)
90+
const reconnectStatus = Buffer.from("\r\n[reconnecting… — Ctrl-\\ or Ctrl-C to stop]\r\n")
91+
if (!stderr.equals(reconnectStatus)) {
92+
throw new Error("machine attach stderr was not exactly one reconnect status")
9293
}
9394
}
9495

@@ -102,16 +103,17 @@ const selfTest = () => {
102103
frame(0, Buffer.from("FINAL_DATA_61e8")), frame(4, Buffer.alloc(0)),
103104
]
104105
const valid = Buffer.concat(packets)
105-
validateFinal(valid, expected)
106+
const reconnectStatus = Buffer.from("\r\n[reconnecting… — Ctrl-\\ or Ctrl-C to stop]\r\n")
107+
validateFinal(valid, expected, Buffer.alloc(0), reconnectStatus)
106108
const uncolored = Buffer.from("\x1b[HINITIAL_COLOR_61e8\x1b[0m")
107109
const mutations = [
108110
() => validateFinal(Buffer.concat([frame(10, geometry(1, 1)), ...packets.slice(1)]), expected),
109111
() => validateFinal(Buffer.concat([frame(10, geometry(24, 80)), frame(5, uncolored), ...packets.slice(2)]), expected),
110112
() => validateFinal(Buffer.concat([packets[0], packets[1], packets[2], frame(5, colored), ...packets.slice(4)]), expected),
111113
() => validateFinal(Buffer.concat([...packets.slice(0, 4), packets[5], packets[4]]), expected),
112114
() => validateFinal(valid.subarray(0, valid.length - 1), expected),
113-
() => validateFinal(valid, expected, Buffer.from("unexpected")),
114-
() => validateFinal(valid, expected, Buffer.alloc(0), Buffer.from("FINAL_DATA_61e8")),
115+
() => validateFinal(valid, expected, Buffer.from("unexpected"), reconnectStatus),
116+
() => validateFinal(valid, expected, Buffer.alloc(0), Buffer.concat([reconnectStatus, Buffer.from("\x1b[32mLEAK")])),
115117
]
116118
for (const mutate of mutations) assert.throws(mutate)
117119
console.log("ORACLE-MUTATIONS-GREEN-61e8")

0 commit comments

Comments
 (0)