Skip to content

fix: MCP工具cloudPath参数格式约定不明确导致路径不一致#574

Closed
binggg wants to merge 16 commits into
mainfrom
automation/attribution-issue-mnri8zp3-vsojwy-mcp-cloudpath-mo69vo98
Closed

fix: MCP工具cloudPath参数格式约定不明确导致路径不一致#574
binggg wants to merge 16 commits into
mainfrom
automation/attribution-issue-mnri8zp3-vsojwy-mcp-cloudpath-mo69vo98

Conversation

@binggg
Copy link
Copy Markdown
Member

@binggg binggg commented Apr 19, 2026

Attribution issue

  • issueId: issue_mnri8zp3_vsojwy
  • category: tool
  • canonicalTitle: MCP工具cloudPath参数格式约定不明确导致路径不一致
  • representativeRun: application-js-vite-hello-world-hosting-deploy/2026-04-10T03-45-31-sus12x

Automation summary

layerVersion action cloudPath cloudPath README.md tencent-cloud

Changed files

  • mcp/src/tools/hosting.ts
  • mcp/src/tools/storage-hosting-guidance.test.ts

@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@binggg
Copy link
Copy Markdown
Member Author

binggg commented Apr 19, 2026

Attribution post-PR evaluation

  • visibility: internal identifiers, run ids, and private links are intentionally omitted
  • attempt: 3
  • eval_scope: primary_plus_regression
  • overall: ERROR
  • summary: post-PR evaluation errored
  • updated_at: 2026-04-28T03:38:09.554Z

Cases

  • [ERROR] — primary — evaluation errored
  • [PENDING] — regression 1 — queued

@binggg
Copy link
Copy Markdown
Member Author

binggg commented Apr 26, 2026

方向修正说明(Review Feedback)

经分析,当前 PR 的修复方向需要调整:

问题诊断

反复 evaluation 失败的根本原因是:AI 在部署到子目录时经常跳过设置 publicPath/base/assetPrefix,而不是不知道 cloudPath 格式。

当前 PR 聚焦在 cloudPath 格式约定(去掉前导 /),这只是被动提示,无法阻止 AI 忽略关键配置步骤。

正确方向

应在 web-development Skill 中增加**"子目录部署强制二次确认"机制**:

当 cloudPath 非空(部署到子目录)时,在调用 uploadFiles 前必须完成以下强制确认:

  1. 配置检查:已在构建配置中设置 base / publicPath / assetPrefix(与子目录路径一致或相对路径)
  2. 重新构建:修改配置后已重新运行 npm run build
  3. 最终确认(二次确认):已验证构建产物中的资源引用路径已更新(非绝对根路径 /assets/xxx)

任何一项未通过时,禁止调用 uploadFiles

建议修改

  • Skill:将 web-development 中的 "Static hosting deployment with uploadFiles" 从"步骤说明"改为"强制确认清单"
  • Tool description:uploadFiles 的 description 中增加更强的警示措辞("必须先设置,否则部署后资源 404")

此评论用于记录 review 结论,引导后续修复方向。

- Add detectAbsoluteRootPaths() to scan index.html for absolute root
  path references (e.g., src=/assets/...) when deploying to a
  sub-directory (cloudPath non-empty).
- Strengthen uploadFiles description and cloudPath schema describe with
  a mandatory sub-directory deployment checklist.
- Return a prominent publicPathWarning in the tool result when absolute
  root paths are detected, so the AI sees the warning immediately.
- Update web-development SKILL.md to align: replace passive step
  description with a mandatory checklist (Set → Rebuild → Verify).
@binggg
Copy link
Copy Markdown
Member Author

binggg commented Apr 26, 2026

修正说明更新 — 代码已修改

根据 review 反馈,已重新修改 PR 方向,从"cloudPath 格式约定"改为"子目录部署强制确认机制"。

实际改动

1. MCP 工具层(mcp/src/tools/hosting.ts

  • 新增 detectAbsoluteRootPaths():部署到子目录时自动扫描 index.html,检测绝对根路径引用(如 src="/assets/..."
  • 强化 uploadFiles description:增加子目录部署强制确认清单,用加粗/编号让模型无法忽略
  • 强化 cloudPath schema describe:增加 **警告** 区块,强调未设置将导致 404
  • 运行时返回 publicPathWarning:检测到绝对根路径时,在工具结果中注入 ⚠️ WARNING,AI 调用后立刻看到

2. Skill 层(config/.claude/skills/web-development/SKILL.md

  • 把原来的"Align framework base config with cloudPath"被动步骤改为 Mandatory checklist
    • Step A — Set base/publicPath/assetPrefix
    • Step B — Rebuild(修改后必须重新构建,上传旧产物仍会 404)
    • Step C — Verify index.html(检查 <script src><link href> 是否为相对路径)
  • 明确标注:If any step fails, do NOT call uploadFiles yet.

机制对比

机制 之前 现在
Skill "请检查 publicPath"(被动提示) 强制 checklist(Set → Rebuild → Verify)
Tool description "请检查构建配置" 强制确认清单 + 警告区块
Tool runtime 无检查 自动扫描 index.html,发现问题返回 WARNING

这样即使 AI 忽略 skill,调用工具时也会读到强制确认清单;即使 AI 跳过确认直接上传,工具运行时也会检测并返回 WARNING。

When cloudPath is non-empty (sub-directory deployment), the tool now
requires publicPathConfigured=true or it throws an error immediately.
This makes the guard impossible to skip — the AI must explicitly
declare that base/publicPath/assetPrefix has been set and rebuilt.

Also updates web-development SKILL.md to document the new parameter
and example call.
@binggg
Copy link
Copy Markdown
Member Author

binggg commented May 12, 2026

Closing as duplicate: same case has newer PR #651. Keeping #651.

@binggg binggg closed this May 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant