Repository navigation
feat(core): hide standalone webfetch when Code Mode is available - #63659
rekram1-node wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
Works as described. The new check runs on the final tool list after plugin hooks, so renamed or removed tools are handled. Checked with the new request-shaping test (6/6), the packages/core session tests (801 pass, 1 skip, 0 fail) and tsc -b for core (clean). Code Mode's fetch checks the same webfetch permission rules, so access control is unchanged.
Public API: adds the config key experimental.codemode_hide_webfetch (also in openapi.json and the generated client types). Backwards compatible: release builds behave the same unless someone opts in.
One concern, inline: the standalone tool does more than Code Mode's fetch (markdown conversion, image attachments, a Cloudflare retry, an output size cap), so with the flag on by default in local/dev builds, models get raw HTML and no images.
| return t ? [[name, { ...t, description: d.description, inputSchema: d.input }] as const] : [] | ||
| }), | ||
| ) | ||
| // Hooks can remove or rename execute. Check the resolved tool behind each advertised name. |
There was a problem hiding this comment.
Hiding webfetch loses more than a duplicate tool. The standalone tool converts HTML to markdown, attaches images so the model can see them, retries Cloudflare challenges and caps the output size. Code Mode's fetch returns the raw Response, so with this flag the model gets raw HTML (more tokens) and cannot look at fetched images. The flag is on by default in local/dev builds, so those users get this now. The Meta system prompt (plugin/system-prompt/meta.txt) also still tells the model to use webfetch. Could Code Mode offer the markdown conversion (for example tools.webfetch inside execute), or could this gap be accepted explicitly as part of the experiment?
There was a problem hiding this comment.
My earlier point is addressed. The stale webfetch redirect line is gone from the Meta prompt; webfetch follows redirects itself, so that line no longer applied. The description now states that, with the experiment on, scripts get the raw response body without the Markdown conversion, size cap or Cloudflare retry, and that the flag can turn this off. The request-hook suite still passes (6/6). Nothing new to raise.
Public API: unchanged since the last review. The change adds experimental.codemode_hide_webfetch (config, OpenAPI spec, generated client types) and is backwards compatible.
Issue for this PR
Standalone feature-flag experiment.
Type of change
What does this PR do?
Local and dev builds hide the standalone
webfetchtool when a request offers Code Mode. The model can fetch URLs insideexecute. Core checks the final tool list after plugins have removed or renamed tools.Set
experimental.codemode_hide_webfetchtofalseto keep both tools, ortrueto try the dev behavior in a release.With the experiment enabled, scripts receive the HTTP response body directly. The standalone reader also converts HTML to Markdown, limits the response size, and retries a Cloudflare challenge. Set the flag to
falseto use those features.How did you verify your code works?
474 tests passed across 12 files, including request shaping and fetch permissions. The request-hook suite also passed ten randomized runs. Repository lint and all 35 typecheck tasks passed.
Visual
Checklist
Added by the opencode bot (AI-generated).
Public API: adds the experimental.codemode_hide_webfetch config flag (backwards compatible; off by default in releases)