Skip to content
Closed
Changes from 3 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
32 changes: 19 additions & 13 deletions integration-tests/interactive/file-system-interactive.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,15 @@ describe('Interactive file system', () => {
await type(ptyProcess, writePrompt);
await type(ptyProcess, '\r');

// The model usually calls write_file or edit, but occasionally
// describes the change in text without a tool call (non-deterministic,
// more common in docker sandbox). Accept either a tool call OR correct
// file content as success; fail only when both are missing.
Comment thread
qwen-code-dev-bot marked this conversation as resolved.
Resolved
const toolCall = await rig.waitForAnyToolCall(
['write_file', 'edit'],
30000,
);

Comment thread
qwen-code-dev-bot marked this conversation as resolved.
Resolved
if (!toolCall) {
printDebugInfo(rig, rig._interactiveOutput, {
toolCall,
});
}

expect(toolCall, 'Expected to find a write_file or edit tool call').toBe(
true,
);

// The tool call is logged once the model issues it, but the turn may
// still be settling (a failed edit can be retried) and the model may
// write more than just '1.0.1'. Poll the file until it contains the new
Expand All @@ -86,10 +80,22 @@ describe('Interactive file system', () => {
rig.getDefaultTimeout(),
200,
);
if (!updated) {
printDebugInfo(rig, rig._interactiveOutput, { toolCall });

if (!toolCall && !updated) {
printDebugInfo(rig, rig._interactiveOutput, { toolCall, updated });
}
expect(updated, 'Expected file content to contain 1.0.1').toBe(true);

if (toolCall) {
expect(
updated,
'Expected file content to contain 1.0.1 after tool call',
).toBe(true);
}

expect(
toolCall || updated,
'Expected a write_file/edit tool call or file content containing 1.0.1',
).toBe(true);
},
);
});
Loading