Skip to content

Commit 7a0ad05

Browse files
Refactor three files to pass logger as parameter
Refactored batch-str-replace.ts, stream-parser.ts, and api/agents.ts to pass logger as a parameter instead of importing it directly. Updated all callers including run-agent-step.ts and test files. 🤖 Generated with Codebuff Co-Authored-By: Codebuff <noreply@codebuff.com>
1 parent e5b56fa commit 7a0ad05

File tree

5 files changed

+153
-85
lines changed

5 files changed

+153
-85
lines changed

backend/src/__tests__/malformed-tool-call.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ describe('malformed tool call error handling', () => {
131131
agentContext: {},
132132
onResponseChunk,
133133
fullResponse: '',
134+
logger,
134135
})
135136

136137
// Should have tool result errors in the final message history
@@ -187,6 +188,7 @@ describe('malformed tool call error handling', () => {
187188
agentContext: {},
188189
onResponseChunk,
189190
fullResponse: '',
191+
logger,
190192
})
191193

192194
// Should have multiple error tool results
@@ -233,6 +235,7 @@ describe('malformed tool call error handling', () => {
233235
agentContext: {},
234236
onResponseChunk,
235237
fullResponse: '',
238+
logger,
236239
})
237240

238241
// Should have error in both toolResults and message history
@@ -283,6 +286,7 @@ describe('malformed tool call error handling', () => {
283286
agentContext: {},
284287
onResponseChunk,
285288
fullResponse: '',
289+
logger,
286290
})
287291

288292
const toolMessages = result.state.messages.filter(
@@ -335,6 +339,7 @@ describe('malformed tool call error handling', () => {
335339
agentContext: {},
336340
onResponseChunk,
337341
fullResponse: '',
342+
logger,
338343
})
339344

340345
const toolMessages = result.state.messages.filter(
@@ -389,6 +394,7 @@ describe('malformed tool call error handling', () => {
389394
agentContext: {},
390395
onResponseChunk,
391396
fullResponse: '',
397+
logger,
392398
})
393399

394400
const toolMessages = result.state.messages.filter(

backend/src/__tests__/process-str-replace.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -563,6 +563,7 @@ describe('Benchify resilience', () => {
563563
onResponseChunk: () => {},
564564
state: { messages: [] },
565565
userId: 'test-user',
566+
logger,
566567
})
567568

568569
// Should complete without error even when Benchify is unavailable
@@ -590,6 +591,7 @@ describe('Benchify resilience', () => {
590591
onResponseChunk: () => {},
591592
state: { messages: [] },
592593
userId: 'test-user',
594+
logger,
593595
}),
594596
).resolves.toBeUndefined() // Should complete without throwing
595597
})
@@ -627,6 +629,7 @@ describe('Benchify resilience', () => {
627629
onResponseChunk: () => {},
628630
state: { messages: [] },
629631
userId: 'test-user',
632+
logger,
630633
})
631634

632635
// Should complete without throwing an error

backend/src/run-agent-step.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ export const runAgentStep = async (
306306
agentContext,
307307
onResponseChunk,
308308
fullResponse,
309+
logger,
309310
})
310311
toolResults.push(...newToolResults)
311312

0 commit comments

Comments
 (0)