From 081e5ef57243db80dd6fd7990a5fc87e21553d52 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Thu, 15 Jan 2026 07:42:01 +0000 Subject: [PATCH] fix(tools): enable web_fetch by default --- CHANGELOG.md | 1 + docs/start/faq.md | 2 +- docs/tools/web.md | 6 ++--- .../tools/web-tools.enabled-defaults.test.ts | 23 +++++++++++++++++++ src/agents/tools/web-tools.ts | 3 +-- 5 files changed, 29 insertions(+), 6 deletions(-) create mode 100644 src/agents/tools/web-tools.enabled-defaults.test.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 694efb3cb..b35f1dd87 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ - Browser: add tests for snapshot labels/efficient query params and labeled image responses. - macOS: ensure launchd log directory exists with a test-only override. (#909) — thanks @roshanasingh4. - macOS: format ConnectionsStore config to satisfy SwiftFormat lint. (#852) — thanks @mneves75. +- Tools: enable `web_fetch` by default (unless explicitly disabled in config). - Packaging: run `pnpm build` on `prepack` so npm publishes include fresh `dist/` output. - Telegram: register dock native commands with underscores to avoid `BOT_COMMAND_INVALID` (#929, fixes #901) — thanks @grp06. - Google: downgrade unsigned thinking blocks before send to avoid missing signature errors. diff --git a/docs/start/faq.md b/docs/start/faq.md index 553fdcec8..5ef6ad161 100644 --- a/docs/start/faq.md +++ b/docs/start/faq.md @@ -613,7 +613,7 @@ Gateway process. Notes: - If you use allowlists, add `web_search`/`web_fetch` or `group:web`. -- In sandboxed sessions, `web_fetch` auto-enables unless explicitly disabled. +- `web_fetch` is enabled by default (unless explicitly disabled). - Daemons read env vars from `~/.clawdbot/.env` (or the service environment). Docs: [Web tools](/tools/web). diff --git a/docs/tools/web.md b/docs/tools/web.md index eb0b8e968..87a60a665 100644 --- a/docs/tools/web.md +++ b/docs/tools/web.md @@ -22,7 +22,7 @@ These are **not** browser automation. For JS-heavy sites or logins, use the - Results are cached by query for 15 minutes (configurable). - `web_fetch` does a plain HTTP GET and extracts readable content (HTML → markdown/text). It does **not** execute JavaScript. -- In sandboxed sessions, `web_fetch` is enabled automatically (unless explicitly disabled). +- `web_fetch` is enabled by default (unless explicitly disabled). ## Getting a Brave API key @@ -48,7 +48,7 @@ Search the web with Brave’s API. ### Requirements -- `tools.web.search.enabled: true` +- `tools.web.search.enabled` must not be `false` (default: enabled) - Brave API key (recommended: `clawdbot configure --section web`, or set `BRAVE_API_KEY`) ### Config @@ -80,7 +80,7 @@ Fetch a URL and extract readable content. ### Requirements -- `tools.web.fetch.enabled: true` +- `tools.web.fetch.enabled` must not be `false` (default: enabled) ### Config diff --git a/src/agents/tools/web-tools.enabled-defaults.test.ts b/src/agents/tools/web-tools.enabled-defaults.test.ts new file mode 100644 index 000000000..b49d69da8 --- /dev/null +++ b/src/agents/tools/web-tools.enabled-defaults.test.ts @@ -0,0 +1,23 @@ +import { describe, expect, it } from "vitest"; + +import { createWebFetchTool, createWebSearchTool } from "./web-tools.js"; + +describe("web tools defaults", () => { + it("enables web_fetch by default (non-sandbox)", () => { + const tool = createWebFetchTool({ config: {}, sandboxed: false }); + expect(tool?.name).toBe("web_fetch"); + }); + + it("disables web_fetch when explicitly disabled", () => { + const tool = createWebFetchTool({ + config: { tools: { web: { fetch: { enabled: false } } } }, + sandboxed: false, + }); + expect(tool).toBeNull(); + }); + + it("enables web_search by default", () => { + const tool = createWebSearchTool({ config: {}, sandboxed: false }); + expect(tool?.name).toBe("web_search"); + }); +}); diff --git a/src/agents/tools/web-tools.ts b/src/agents/tools/web-tools.ts index 53370478f..38025352e 100644 --- a/src/agents/tools/web-tools.ts +++ b/src/agents/tools/web-tools.ts @@ -99,8 +99,7 @@ function resolveSearchEnabled(params: { search?: WebSearchConfig; sandboxed?: bo function resolveFetchEnabled(params: { fetch?: WebFetchConfig; sandboxed?: boolean }): boolean { if (typeof params.fetch?.enabled === "boolean") return params.fetch.enabled; - if (params.sandboxed) return true; - return false; + return true; } function resolveSearchApiKey(search?: WebSearchConfig): string | undefined {