Skip to content

Commit 222d09d

Browse files
committed
test(tui): settle gateway session adoption
1 parent d03a8d9 commit 222d09d

1 file changed

Lines changed: 12 additions & 3 deletions

File tree

‎src/tui/tui-pty-local.e2e.test.ts‎

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -826,10 +826,19 @@ async function startGatewayModeTui(
826826
model: `tui-pty-mock/${scenario.modelId}`,
827827
});
828828
const run = shared.run;
829-
const outputOffset = run.visibleOutput().length;
830-
// Session adoption is the per-case isolation boundary for the shared PTY.
829+
const adoptionOffset = run.visibleOutput().length;
831830
await run.write(`/session ${sessionKey}\r`, { delay: false });
832-
await waitForOutputAfter(run, `session ${sessionKey.split(":").at(-1)}`, outputOffset);
831+
const sessionAcknowledgement = `session ${sessionKey.split(":").at(-1)}`;
832+
await waitForOutputAfter(run, sessionAcknowledgement, adoptionOffset);
833+
await waitFor({
834+
timeoutMs: LOCAL_OUTPUT_TIMEOUT_MS,
835+
read: () => {
836+
const screen = synchronizedFrameRows(run.output(), run)[0]?.join("\n") ?? "";
837+
return screen.includes(sessionAcknowledgement) && screen.includes("| idle") ? true : null;
838+
},
839+
onTimeout: () => new Error("adopted Gateway session did not reach an idle final screen"),
840+
});
841+
const outputOffset = run.visibleOutput().length;
833842
const cleanup = createIdempotentCleanup(async () => {
834843
shared.mockModel.releaseFirstResponse(scenario.modelId);
835844
for (const key of sessionKeys) {

0 commit comments

Comments
 (0)