Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/e2e/auto-mode-reliability.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2946,7 +2946,7 @@ describe("lean auto mode reliability", () => {
});
await activeSession.waitForComposer(TIMEOUT);
await activeSession.sendText("Run the marker command.");
await activeSession.waitForText("retried review traced", TIMEOUT);
await activeSession.waitForPane((pane) => pane.includes("retried review traced") && turnSettled(pane), TIMEOUT);
expect(existsSync(marker)).toBe(true);

const report = await runTrace(activeSession, root.root);
Expand Down
14 changes: 7 additions & 7 deletions tests/e2e/gateway-stream-lifecycle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ test("the user talks to the parent while its subagent works, and a stop ends the
await tui.waitForStableComposer(15000);
await tui.sendText("STEERING_START");
// The parent's turn ends with the receipt while its subagent works.
await tui.waitForText("START_SENT", 10000);
await tui.waitForPane((pane) => pane.includes("START_SENT") && turnSettled(pane), 10000);
await tui.waitForPane(() => childRequests === 1, 10000);
await tui.waitForPane(() => work().spawns === 1, 10000);
const original = work();
Expand Down Expand Up @@ -1593,7 +1593,7 @@ describe("gateway stream lifecycle", () => {
});
await session.waitForStableComposer(15_000);
await session.sendText("!echo bang-routing-probe");
await session.waitForText("BANG_PROMPT_ROUTED", 15_000);
await session.waitForPane((pane) => pane.includes("BANG_PROMPT_ROUTED") && turnSettled(pane), 15_000);
expect(gateway.requests).toHaveLength(1);
await session.sendText("/quit");
await session.waitForPane(() => session!.paneStatus().dead, 10_000);
Expand Down Expand Up @@ -13342,7 +13342,7 @@ printf '%s' ${JSON.stringify(trailingMarker)} > ${JSON.stringify(effectPath)}
child.release("CHILD_REPORT_TEXT");
await tui.waitForPane(() => /event=mail_posted .*mail=report delivery=joined/.test(trace()), 10000);
parentHold.release!();
await tui.waitForText("EMPTY_REPORT_ALL_DONE", 10000);
await tui.waitForPane((pane) => pane.includes("EMPTY_REPORT_ALL_DONE") && turnSettled(pane), 10000);

expect(childRequests).toBe(1);
expect(parentBodies).toHaveLength(3);
Expand Down Expand Up @@ -13465,7 +13465,7 @@ printf '%s' ${JSON.stringify(trailingMarker)} > ${JSON.stringify(effectPath)}
10000,
);
writeFileSync(paths.release, "");
await tui.waitForText("EMPTY_HANDOFF_ALL_DONE", 10000);
await tui.waitForPane((pane) => pane.includes("EMPTY_HANDOFF_ALL_DONE") && turnSettled(pane), 10000);

expect(childRequests()).toBe(1);
// The report takes the nudge's place, as one that waited in the
Expand Down Expand Up @@ -13515,7 +13515,7 @@ printf '%s' ${JSON.stringify(trailingMarker)} > ${JSON.stringify(effectPath)}
10000,
);
writeFileSync(paths.release, "");
await tui.waitForText("EMPTY_MESSAGE_ALL_DONE", 10000);
await tui.waitForPane((pane) => pane.includes("EMPTY_MESSAGE_ALL_DONE") && turnSettled(pane), 10000);

const next = parentBodies[2]!;
expect(next).toContain("CHILD_MESSAGE_TEXT");
Expand Down Expand Up @@ -13607,7 +13607,7 @@ printf '%s' ${JSON.stringify(trailingMarker)} > ${JSON.stringify(effectPath)}
secondHold.release!();
await tui.waitForText("Continue with a follow-up prompt if needed.", 10000);
writeFileSync(paths.release, "");
await tui.waitForText("EMPTY_SECOND_REPORT_DONE", 10000);
await tui.waitForPane((pane) => pane.includes("EMPTY_SECOND_REPORT_DONE") && turnSettled(pane), 10000);

expect(parentBodies).toHaveLength(4);
expect(parentBodies[3]).toContain("CHILD_REPORT_TEXT");
Expand Down Expand Up @@ -13636,7 +13636,7 @@ printf '%s' ${JSON.stringify(trailingMarker)} > ${JSON.stringify(effectPath)}
tui = await startHandoffTui(root, gateway, paths);
await tui.waitForStableComposer(15000);
await tui.sendText("EMPTY_PLAIN_START");
await tui.waitForText("EMPTY_PLAIN_ALL_DONE", 10000);
await tui.waitForPane((pane) => pane.includes("EMPTY_PLAIN_ALL_DONE") && turnSettled(pane), 10000);

expect(parentBodies).toHaveLength(2);
expect(parentBodies[1]).toContain(EMPTY_REPLY_NUDGE);
Expand Down
18 changes: 9 additions & 9 deletions tests/e2e/mcp-auth.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2825,13 +2825,13 @@ describe("MCP login", () => {
});
await tui.waitForComposer(15_000);
await tui.sendText("Call the fixture.");
await tui.waitForText("First call done.", 20_000);
await tui.waitForPane((pane) => pane.includes("First call done.") && turnSettled(pane), 20_000);
// The server stops taking that login and its refresh, so the next call needs a login.
auth.validTokens.clear();
options.rejectRefresh = true;
await tui.waitForComposer(5_000);
await tui.sendText("Call it again.");
await tui.waitForText("It needs a login.", 20_000);
await tui.waitForPane((pane) => pane.includes("It needs a login.") && turnSettled(pane), 20_000);
// Another fx with the same profile signs in, and gets a new token.
options.rotateAuthorizationToken = true;
auth.validTokens.add(ACCESS_REFRESHED);
Expand Down Expand Up @@ -2870,7 +2870,7 @@ describe("MCP login", () => {
});
await tui.waitForComposer(15_000);
await tui.sendText("Call the fixture.");
await tui.waitForText("First call done.", 20_000);
await tui.waitForPane((pane) => pane.includes("First call done.") && turnSettled(pane), 20_000);
// Another fx signs in again and saves a new token; the server then takes
// only that one, and refuses the shell's refresh.
options.rotateAuthorizationToken = true;
Expand All @@ -2880,7 +2880,7 @@ describe("MCP login", () => {
options.rejectRefresh = true;
await tui.waitForComposer(5_000);
await tui.sendText("Call it again.");
await tui.waitForText("Second call done.", 20_000);
await tui.waitForPane((pane) => pane.includes("Second call done.") && turnSettled(pane), 20_000);
// The shell's own login was refused, and the other fx's stays saved.
expect(readFileSync(storePath, "utf8")).toContain(ACCESS_REFRESHED);
await tui.waitForComposer(5_000);
Expand Down Expand Up @@ -2914,7 +2914,7 @@ describe("MCP login", () => {
// The first token stops working, so the shell refreshes and saves the new one.
auth.validTokens.delete(ACCESS_INITIAL);
await tui.sendText("Call the fixture.");
await tui.waitForText("First call done.", 20_000);
await tui.waitForPane((pane) => pane.includes("First call done.") && turnSettled(pane), 20_000);
expect(auth.refreshes).toBe(1);
expect(readFileSync(storePath, "utf8")).toContain(ACCESS_REFRESHED);
// Then that one stops too, and its refresh is refused.
Expand Down Expand Up @@ -2972,7 +2972,7 @@ describe("MCP login", () => {
});
await tui.waitForComposer(15_000);
await tui.sendText("Call the fixture.");
await tui.waitForText("First call done.", 20_000);
await tui.waitForPane((pane) => pane.includes("First call done.") && turnSettled(pane), 20_000);
// The access token runs out for every fx holding it, and another fx
// refreshes it first.
auth.validTokens.delete(ACCESS_INITIAL);
Expand All @@ -2983,7 +2983,7 @@ describe("MCP login", () => {
// Then the shell needs a token too.
await tui.waitForComposer(5_000);
await tui.sendText("Call it again.");
await tui.waitForText("Second call done.", 20_000);
await tui.waitForPane((pane) => pane.includes("Second call done.") && turnSettled(pane), 20_000);
expect(auth.replays).toBe(0);
const calls = auth.requests.filter((r) => r.body.includes("\"tools/call\""));
expect(calls.at(-1)?.authorization).toBe(`Bearer ${ACCESS_REFRESHED}-1`);
Expand Down Expand Up @@ -3243,7 +3243,7 @@ describe("MCP login", () => {
});
await tui.waitForComposer(15_000);
await tui.sendText("Call the fixture.");
await tui.waitForText("First call done.", 20_000);
await tui.waitForPane((pane) => pane.includes("First call done.") && turnSettled(pane), 20_000);
auth.validTokens.delete(ACCESS_INITIAL);
// Another fx keeps the saved logins busy past both waits for them.
const holder = await holdStoreLock(root, 6);
Expand Down Expand Up @@ -3718,7 +3718,7 @@ describe("MCP login", () => {

// The retry waits for that renewal, which fx drops after its 30 s.
await tui.sendText("Retry the protected MCP fixture.");
await tui.waitForText("Retry ended.", 45_000);
await tui.waitForPane((pane) => pane.includes("Retry ended.") && turnSettled(pane), 45_000);
const waited = Date.now() - renewalStarted;
expect(waited).toBeGreaterThan(28_000);
expect(waited).toBeLessThan(40_000);
Expand Down
4 changes: 2 additions & 2 deletions tests/e2e/mcp-stdio.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5837,7 +5837,7 @@ describe("fx mcp call", () => {
tui = await TmuxSession.create({ isolated: true, cwd: root.workspace, width: 140, height: 40, stderrPath, env });
await tui.waitForComposer(15_000);
await tui.sendText("Page through the list.");
await tui.waitForText("BRIDGE_ROWS_SAVED", 30_000);
await tui.waitForPane((pane) => pane.includes("BRIDGE_ROWS_SAVED") && turnSettled(pane), 30_000);
await tui.waitForComposer(10_000);
expect(await tui.captureFullScrollback()).toContain(`└ Used ${TOOL_ROW} ×3`);
await tui.sendText("/quit");
Expand Down Expand Up @@ -5937,7 +5937,7 @@ describe("fx mcp call", () => {

// The session goes on.
await tui.sendText("Go on.");
await tui.waitForText("BRIDGE_AFTER_CANCEL", 10_000);
await tui.waitForPane((pane) => pane.includes("BRIDGE_AFTER_CANCEL") && turnSettled(pane), 10_000);
await tui.waitForComposer(10_000);
await tui.sendText("/quit");
expect(await tui.waitForSessionEnd(10_000)).toBe(true);
Expand Down
3 changes: 2 additions & 1 deletion tests/e2e/session-recovery.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
startFakeGateway,
TmuxSession,
tmuxAvailable,
turnSettled,
} from "./tmux-helpers";
import { ignoresFileModes } from "./file-modes";
import { copyV1Fixture, savedSession, savedSessionIds, savedText, savedToolResults, sessionDir, storeRoot, withoutConversionNotice } from "./saved-sessions";
Expand Down Expand Up @@ -1014,7 +1015,7 @@ describe("session recovery", () => {
await tui.waitForComposer(TIMEOUT);
await tui.waitForText("CONV_FIRST_ANSWER", TIMEOUT);
await tui.sendText("Continue the same conversation.");
await tui.waitForText("CONTINUE_DISCOVERY_OK", TIMEOUT);
await tui.waitForPane((pane) => pane.includes("CONTINUE_DISCOVERY_OK") && turnSettled(pane), TIMEOUT);
await tui.waitForComposer(TIMEOUT);
await tui.sendText("/quit");
expect(await tui.waitForSessionEnd(TIMEOUT)).toBe(true);
Expand Down
Loading
Loading