feat(web-fetch): wire @frontagent/mcp-web-fetch into the agent registry & planner (#357)#359
Merged
Merged
Conversation
…ry & planner (#357) Wires the previously-unwired @frontagent/mcp-web-fetch adapter (PR #358) so the agent can actually call the `web_fetch` tool, and surfaces it to the two-phase planner. This is increment 3/3 of #357 and closes it. - runtime-node: register `web_fetch` in WebMCPClient.callTool + listTools, delegating to handleWebFetchTool (no browser launch — lazy playwright, so web_fetch stays decoupled from the browser tools sharing the client). - core/agent: add `web_fetch` to registerWebTools() so the executor routes it to the 'web' client (mirrors how filesense_* is routed via the 'file' client in registerFileTools()). - core/schemas: add `web_fetch` to ACTION_ENUM so planner-emitted steps with action `web_fetch` pass StepSchema validation (url param already exists in STEP_PARAMS_SCHEMA). Treated like browser_navigate. - core/plan-generation: mention web_fetch in both 可用工具 prompt regions + param hint, so the planner knows it can fetch external docs/API refs. - add @frontagent/mcp-web-fetch workspace dep to runtime-node. - add hermetic mcp-clients.test.ts asserting web_fetch is listed & routed. MVP scope only: no web_search, no when-to-search heuristics (deferred). SSRF guards live in the adapter (#358) with tests. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
代码评审报告: feat(web-fetch): wire @frontagent/mcp-web-fetch into the agent registry & planner (#357)
风险等级: 高
处理建议: 请求修改
决策摘要: ** 暂不建议合并:关联 issue 的验收标准明确要求同时注册 runtime-node 与 CLI MCP client registry,但本变更只接入了 runtime-node/agent/planner,缺少 CLI registry 适配或明确证据说明 CLI 已不再需要独立接入。
级联分析
- 变更符号: 原始模型未提供结构化级联字段。
- 受影响流程: 原始模型未提供结构化级联字段。
- 变更集外调用方: unknown
- 置信度: degraded
问题发现
- [高] 缺少 issue 验收标准要求的 CLI MCP registry 接入
- 证据: - Issue #357 Acceptance criteria 明确要求:“Tool registered in
runtime-node+cliMCP client registries”。 - 受影响调用方/流程: - 通过 CLI MCP client registry 暴露工具的执行路径可能仍然无法列出或调用
web_fetch。 - 最小可行修复: - 如果 CLI 仍有独立 MCP registry:在 CLI registry 中注册
web_fetch并补对应测试。
- 证据: - Issue #357 Acceptance criteria 明确要求:“Tool registered in
行级发现
- 无明确变更行归属。
Karpathy 评审
- 假设: 模型输出需要归一化为固定 Markdown 契约。
- 简洁性: 已提取 summary、finding、evidence 与 fix;原始 prose 不再附在评论中,避免占用下游解析与代理上下文。
- 变更范围: 原始模型未提供结构化范围字段。
- 验证: 需要查看 CI、测试或人工 CR 证据补强合并信心。
缺失覆盖
- 输出未命中 Repo Guard Markdown 契约;建议补充真实模型质量评估覆盖。
Member
Author
|
Re: repo-guard [高] "Missing CLI MCP registry wiring". Good catch on the literal acceptance criterion. Investigated, and the premise (a live CLI registry) does not hold: Evidence:
So wiring it would add a workspace dependency for a class that is never instantiated (low-value churn). The live registry ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linked Issue Or Context
Closes #357. Increment 3/3 of the agent web-fetch capability (after #358 added the unwired
@frontagent/mcp-web-fetchadapter). Learned fromCLAUDE-FABLE-5.md'sweb_fetchtool.Summary
Wires the previously-unwired
@frontagent/mcp-web-fetchadapter so the agent can actually call theweb_fetchtool, and surfaces it to the two-phase planner.mcp-clients.ts): registerweb_fetchinWebMCPClient.callTool+listTools, delegating tohandleWebFetchTool. No browser launch — playwright is lazy, soweb_fetchstays decoupled from the browser tools that share the client.agent.ts): addweb_fetchtoregisterWebTools()so the executor routes it to the'web'client (mirrors howfilesense_*is routed via the'file'client inregisterFileTools()).schemas.ts): addweb_fetchtoACTION_ENUMso planner-emitted steps with actionweb_fetchpassStepSchemavalidation (urlparam already exists inSTEP_PARAMS_SCHEMA). Treated likebrowser_navigate.plan-generation.ts): mentionweb_fetchin both# 可用工具prompt regions + a param hint, so the planner knows it can fetch external docs / API references.@frontagent/mcp-web-fetchworkspace dep to runtime-node.Why
web_fetchis added toACTION_ENUM(unlikefilesense_*)This increment's directive is to give the planner a prompt mention of
web_fetch. Planner steps are zod-validated againstACTION_ENUM(StepSchema.action = z.enum(ACTION_ENUM)), so mentioning the tool in the prompt without the enum entry would invite the planner to emit a step that fails validation. Prompt-mention and enum-inclusion are therefore coupled.filesense_*is deliberately NOT planner-surfaced, so it stays registry-only;web_fetchis, so it is treated likebrowser_navigate.On the
cliMCP registry (issue acceptance criterion)#357's acceptance criteria list "registered in
runtime-node+cliMCP client registries". Investigation showsapps/cli/src/mcp-client.tsis dead code: it is imported nowhere inapps/cli/src(the CLI commands delegate torunFrontAgentTaskfrom@frontagent/runtime-node, which usesruntime-node/src/mcp-clients.ts), the packagemainisdist/index.js, and no test references its classes. The@frontagent/mcp-filesenseprecedent was likewise never wired into this dead CLI copy. Wiring it would add a dependency for a never-instantiated class (low-value churn). The live registry —runtime-node— is wired here. Deleting the dead CLI copy is noted as a possible follow-up cleanup, out of scope for this focused PR.Impact Scope
MVP scope only: no
web_search, no planner when-to-search heuristics (deferred to follow-up issues). SSRF guards live in the adapter (#358) with their own security tests.GitNexus Impact Summary
packages/core/src/agent/agent.ts(agent-core, covered by new test inagent.test.ts) andpackages/runtime-node/src/mcp-clients.ts(mcp-boundary, covered by newmcp-clients.test.ts). Additive only — new switchcase,listToolsentry,ACTION_ENUMmember, planner prompt lines, and oneregisterWebToolsentry; no signature changes, nothing removed, no caller broken.detect_changesreports exactly the expected touched symbols —registerWebTools,WebMCPClient.callTool,generatePlanInTwoPhases/generatePlanSinglePhase(planner prompt builders) — and only the expected processes (CallTooltool dispatch + adapter SSRF chains,GeneratePlan).impact ACTION_ENUM= LOW (0 upstream);impact WebMCPClient= structurally HIGH but the edit is additive. No unexpected scope.pnpm contract:localpasses (both critical boundaries have matching tests);pnpm quality:precommitpasses (lint, typecheck, all unit tests, 32 workflow tests).Verification
contract:local: passed.registerWebTools routing contract), runtime-node 93 pass (incl. new hermeticmcp-clients.test.ts).quality:precommitgreen via pre-commit hook; pushed through thequality:localpre-push gate.Checklist
pnpm quality:precommit, or explained why it could not run.pnpm quality:localfor critical skeleton changes, or explained why it could not run.🤖 Generated with Claude Code