Skip to content

Commit 5a5bc20

Browse files
committed
fix(model): system msg improve
1 parent a2d5ef9 commit 5a5bc20

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/adapters/openai/helpers/completions.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -660,6 +660,21 @@ Respond with:
660660
try {
661661
const result = await tool.execute(args);
662662

663+
if (!result.success && tool.name === "writeFile" && result.error === "No valid diff blocks found in content") {
664+
const error = new Error(result.error || "No valid diff blocks found in content");
665+
this.context.logger.error(`Tool attempt ${currentAttempts} failed:`, { error, tool: tool.name });
666+
return {
667+
success: false,
668+
error: result.error,
669+
metadata: {
670+
timestamp: Date.now(),
671+
toolName: tool.name,
672+
toolAttempts: currentAttempts,
673+
workingDir,
674+
},
675+
};
676+
}
677+
663678
if (!result.success && currentAttempts < MAX_TRIES) {
664679
const error = new Error(result.error || "Unknown error");
665680
this.context.logger.error(`Tool attempt ${currentAttempts} failed:`, { error, tool: tool.name });

0 commit comments

Comments
 (0)