From 047a57dee831ba8ba287eee2637ba791dd3d4586 Mon Sep 17 00:00:00 2001 From: Christian Gunderman Date: Tue, 17 Feb 2026 19:31:57 -0800 Subject: [PATCH] feat(core): Include file content in write_file tool response for immediate verification --- packages/core/src/tools/write-file.test.ts | 14 ++++++++++++++ packages/core/src/tools/write-file.ts | 2 ++ 2 files changed, 16 insertions(+) diff --git a/packages/core/src/tools/write-file.test.ts b/packages/core/src/tools/write-file.test.ts index 3545affe3f..b26b0b1b3f 100644 --- a/packages/core/src/tools/write-file.test.ts +++ b/packages/core/src/tools/write-file.test.ts @@ -831,6 +831,20 @@ describe('WriteFileTool', () => { } }, ); + + it('should include the file content in llmContent', async () => { + const filePath = path.join(rootDir, 'content_check.txt'); + const content = 'This is the content that should be returned.'; + mockEnsureCorrectFileContent.mockResolvedValue(content); + + const params = { file_path: filePath, content }; + const invocation = tool.build(params); + + const result = await invocation.execute(abortSignal); + + expect(result.llmContent).toContain('Here is the updated code:'); + expect(result.llmContent).toContain(content); + }); }); describe('workspace boundary validation', () => { diff --git a/packages/core/src/tools/write-file.ts b/packages/core/src/tools/write-file.ts index 9f4abfdf55..b46f424557 100644 --- a/packages/core/src/tools/write-file.ts +++ b/packages/core/src/tools/write-file.ts @@ -356,6 +356,8 @@ class WriteFileToolInvocation extends BaseToolInvocation< ); } + llmSuccessMessageParts.push(`Here is the updated code:\n${finalContent}`); + // Log file operation for telemetry (without diff_stat to avoid double-counting) const mimetype = getSpecificMimeType(this.resolvedPath); const programmingLanguage = getLanguageFromFilePath(this.resolvedPath);