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
15 changes: 8 additions & 7 deletions server/modules/providers/tests/support/tmux-e2e-harness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export type FakeTmuxAgent = {
events: () => Promise<FakeAgentEvent[]>;
waitUntilReady: () => Promise<void>;
waitForInput: (value: string) => Promise<void>;
waitForInterrupt: () => Promise<void>;
/** Resolves once at least `count` interrupts have been recorded. */
waitForInterrupt: (count?: number) => Promise<void>;
waitForTurnStarted: () => Promise<void>;
waitForTurnInterrupted: () => Promise<void>;
};
Expand Down Expand Up @@ -325,9 +326,9 @@ export async function createTmuxE2EHarness(): Promise<TmuxE2EHarness> {
async () => (await events()).some((event) => event.type === 'input' && event.value === value),
`${sessionName} input ${JSON.stringify(value)}`,
),
waitForInterrupt: () => waitFor(
async () => (await events()).some((event) => event.type === 'interrupt'),
`${sessionName} SIGINT`,
waitForInterrupt: (count = 1) => waitFor(
async () => (await events()).filter((event) => event.type === 'interrupt').length >= count,
`${sessionName} SIGINT x${count}`,
),
waitForTurnStarted: () => waitFor(
async () => (await events()).some((event) => event.type === 'turn_started'),
Expand Down Expand Up @@ -430,9 +431,9 @@ export async function createTmuxE2EHarness(): Promise<TmuxE2EHarness> {
async () => (await events()).some((event) => event.type === 'input' && event.value === value),
`${sessionName} input ${JSON.stringify(value)}`,
),
waitForInterrupt: () => waitFor(
async () => (await events()).some((event) => event.type === 'interrupt'),
`${sessionName} SIGINT`,
waitForInterrupt: (count = 1) => waitFor(
async () => (await events()).filter((event) => event.type === 'interrupt').length >= count,
`${sessionName} SIGINT x${count}`,
),
waitForTurnStarted: () => waitFor(
async () => (await events()).some((event) => event.type === 'turn_started'),
Expand Down
4 changes: 3 additions & 1 deletion server/modules/providers/tests/tmux-runtime.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,9 @@ test('real tmux interrupt cancels a running verified fake-agent turn and repeats
);

await sendTmuxProcessAction(target, 'interrupt');
await delay(100);
// Wait for the second interrupt to be recorded instead of sleeping: a fixed
// delay made this assertion fail on slower CI runners (observed on Node 24).
await agent.waitForInterrupt(2);
assert.equal(
(await agent.events()).filter((event) => event.type === 'interrupt').length,
2,
Expand Down