Skip to content

Commit 6906c02

Browse files
author
easonLiangWorldedtech
committed
test(write-to-file): align the partial-path case with handlePartial's no-filesystem contract
platform-unit-test (ubuntu-latest) fails on this branch while it passes locally, because the failing case is it.skipIf(process.platform === "win32"): Windows CI and every local run skip it. The case predates this unit. It asserted that the second streaming delta calls createDirectoriesForFile, which is exactly the call this unit removes: an unguarded mkdir in handlePartial threw EROFS up into BaseTool.handle(), which never set didRejectTool/didAlreadyUseTool, so presentAssistantMessage's advancement gate was never reached and the agent loop stalled. The unit's own regression test ("EROFS in handlePartial does not stall agent loop") pins the new contract; this older case still asserted the old one, so the two contradicted and only Linux CI noticed. Rewritten as "defers parent directory creation to execute() while streaming": no filesystem work during streaming, and the directories are still created by the authoritative non-partial execute(). Same intent, new contract. Local run: 34 passed / 5 skipped in the file; the rewritten case also passes when the win32 skip is lifted temporarily, so the flow is verified on this machine too.
1 parent 950bf6a commit 6906c02

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

‎src/core/tools/__tests__/writeToFileTool.spec.ts‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -310,14 +310,17 @@ describe("writeToFileTool", () => {
310310
)
311311

312312
it.skipIf(process.platform === "win32")(
313-
"creates parent directories when path has stabilized (partial)",
313+
"defers parent directory creation to execute() while streaming",
314314
async () => {
315-
// First call - path not yet stabilized
315+
// Streaming deltas must not touch the filesystem at all. An unguarded
316+
// createDirectoriesForFile here threw EROFS up into BaseTool.handle(), which never
317+
// set didRejectTool/didAlreadyUseTool, so the agent loop stalled permanently.
318+
// The directories are still created - by the authoritative non-partial execute().
319+
await executeWriteFileTool({}, { fileExists: false, isPartial: true })
316320
await executeWriteFileTool({}, { fileExists: false, isPartial: true })
317321
expect(mockedCreateDirectoriesForFile).not.toHaveBeenCalled()
318322

319-
// Second call with same path - path is now stabilized
320-
await executeWriteFileTool({}, { fileExists: false, isPartial: true })
323+
await executeWriteFileTool({}, { fileExists: false })
321324
expect(mockedCreateDirectoriesForFile).toHaveBeenCalledWith(absoluteFilePath)
322325
},
323326
)

0 commit comments

Comments
 (0)