mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-04-20 02:00:40 -07:00
extract console error to util func (#11675)
This commit is contained in:
@@ -1199,24 +1199,13 @@ export class Config {
|
||||
!allowedTools || allowedTools.includes(definition.name);
|
||||
|
||||
if (isAllowed && !isExcluded) {
|
||||
try {
|
||||
const messageBusEnabled = this.getEnableMessageBusIntegration();
|
||||
const wrapper = new SubagentToolWrapper(
|
||||
definition,
|
||||
this,
|
||||
messageBusEnabled ? this.getMessageBus() : undefined,
|
||||
);
|
||||
registry.registerTool(wrapper);
|
||||
} catch (error) {
|
||||
console.error(
|
||||
`Failed to wrap agent '${definition.name}' as a tool:`,
|
||||
error,
|
||||
);
|
||||
}
|
||||
} else if (this.getDebugMode()) {
|
||||
debugLogger.log(
|
||||
`[Config] Skipping registration of agent '${definition.name}' due to allow/exclude configuration.`,
|
||||
const messageBusEnabled = this.getEnableMessageBusIntegration();
|
||||
const wrapper = new SubagentToolWrapper(
|
||||
definition,
|
||||
this,
|
||||
messageBusEnabled ? this.getMessageBus() : undefined,
|
||||
);
|
||||
registry.registerTool(wrapper);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1502,9 +1502,8 @@ ${JSON.stringify(
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
} catch (_) {
|
||||
// If the test framework times out, that also demonstrates the infinite loop
|
||||
console.error('Test timed out or errored:', error);
|
||||
}
|
||||
|
||||
// Assert that the fix works - the loop should stop at MAX_TURNS
|
||||
|
||||
@@ -267,7 +267,7 @@ class MemoryToolInvocation extends BaseToolInvocation<
|
||||
} catch (error) {
|
||||
const errorMessage =
|
||||
error instanceof Error ? error.message : String(error);
|
||||
console.error(
|
||||
console.warn(
|
||||
`[MemoryTool] Error executing save_memory for fact "${fact}": ${errorMessage}`,
|
||||
);
|
||||
return {
|
||||
|
||||
@@ -107,10 +107,6 @@ describe('summarizers', () => {
|
||||
|
||||
expect(mockGeminiClient.generateContent).toHaveBeenCalledTimes(1);
|
||||
expect(result).toBe(longText);
|
||||
expect(console.error).toHaveBeenCalledWith(
|
||||
'Failed to summarize tool output.',
|
||||
error,
|
||||
);
|
||||
});
|
||||
|
||||
it('should construct the correct prompt for summarization', async () => {
|
||||
|
||||
@@ -13,6 +13,7 @@ import type {
|
||||
import type { GeminiClient } from '../core/client.js';
|
||||
import { DEFAULT_GEMINI_FLASH_LITE_MODEL } from '../config/models.js';
|
||||
import { getResponseText, partToString } from './partUtils.js';
|
||||
import { debugLogger } from './debugLogger.js';
|
||||
|
||||
/**
|
||||
* A function that summarizes the result of a tool execution.
|
||||
@@ -90,7 +91,7 @@ export async function summarizeToolOutput(
|
||||
)) as unknown as GenerateContentResponse;
|
||||
return getResponseText(parsedResponse) || textToSummarize;
|
||||
} catch (error) {
|
||||
console.error('Failed to summarize tool output.', error);
|
||||
debugLogger.warn('Failed to summarize tool output.', error);
|
||||
return textToSummarize;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user