fix(core): process all URLs in web_fetch instead of only the first

The tool accepts up to 20 URLs but only processed urls[0] in both
execute and fallback paths. Now iterates all URLs for rate-limit
checks and fetches all in fallback mode.
This commit is contained in:
Bryan Morgan
2026-02-22 10:06:12 -05:00
parent dd16aa0602
commit 09e7f615d6
2 changed files with 104 additions and 68 deletions
+3 -1
View File
@@ -141,7 +141,7 @@ describe('WebFetchTool', () => {
setApprovalMode: vi.fn(),
getProxy: vi.fn(),
getGeminiClient: mockGetGeminiClient,
getRetryFetchErrors: vi.fn().mockReturnValue(false),
getRetryFetchErrors: vi.fn().mockReturnValue(true),
modelConfigService: {
getResolvedConfig: vi.fn().mockImplementation(({ model }) => ({
model,
@@ -208,6 +208,8 @@ describe('WebFetchTool', () => {
vi.spyOn(fetchUtils, 'fetchWithTimeout').mockRejectedValue(
new Error('fetch failed'),
);
// Disable retries so test doesn't timeout waiting for backoff
vi.mocked(mockConfig.getRetryFetchErrors).mockReturnValue(false);
const tool = new WebFetchTool(mockConfig, bus);
const params = { prompt: 'fetch https://private.ip' };
const invocation = tool.build(params);