Skip to content

fix: 路由 prompt 搜索指令要求验证 .git 目录 - #115

Merged
lishuceo merged 1 commit into
mainfrom
fix/routing-prompt-git-check
Mar 5, 2026
Merged

fix: 路由 prompt 搜索指令要求验证 .git 目录#115
lishuceo merged 1 commit into
mainfrom
fix/routing-prompt-git-check

Conversation

@lishuceo

@lishuceo lishuceo commented Mar 5, 2026

Copy link
Copy Markdown
Owner

Summary

  • 路由 agent 通过工具 ls 搜索项目目录时,仍会匹配到非仓库目录(如 talktype-target 编译产物),即使 use_existing 验证能拒绝,回退到 use_default 仍不符合预期
  • 修复: 在搜索指令中明确告知 agent 只有含 .git 的目录才是有效仓库,部分名称匹配(如 talktype-targettalktype)应继续查找

根因: PR #113discoverLocalProjects 过滤生效后,talktype-target 不再出现在"已知项目"列表中。但路由 agent 走 Rule 6 工具搜索时,ls /root/dev/ 仍然能看到 talktype-target,agent 将其误认为 talktype 项目。

与 PR #113/#114 的关系: 这是第三层防护 — prompt 层面引导 agent 不选错误目录(前两层: 项目列表过滤 + 验证回退)

Test plan

  • 42 个路由测试通过

🤖 Generated with Claude Code

路由 agent 通过工具搜索 ls 项目目录时,仍会匹配到非仓库目录
(如 talktype-target 编译产物)。即使 use_existing 验证能拒绝,
回退到 use_default 仍不符合预期。

修复: 在搜索指令中明确告知 agent 只有含 .git 的目录才是有效仓库,
编译产物目录不应被选择,部分名称匹配应继续查找更精确的结果。

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@claude

claude Bot commented Mar 5, 2026

Copy link
Copy Markdown

Claude finished @lishuceo's task in 36s —— View job


PR Review: fix: 路由 prompt 搜索指令要求验证 .git 目录

  • Gather context and read changed files
  • Check for previous review comments (none found)
  • Review the diff and full source file
  • Post review summary

Approved — Clean, minimal, and well-targeted change.

What this does: Enhances the Rule 6 tool-search prompt (line 117 of router.ts) to instruct the routing agent that:

  1. Only directories containing .git are valid repositories
  2. Build artifact directories (e.g. xxx-target, build) should be skipped
  3. Partial name matches (e.g. talktype-targettalktype) should not be accepted

Assessment: This is a sensible third-layer defense complementing PR #113 (project list filtering) and PR #114 (validation fallback). The change is prompt-only — no logic or runtime behavior modified — so the risk is effectively zero. The wording is clear and gives the LLM agent concrete examples of what to avoid, which is good prompt engineering practice.

No issues found. All 42 routing tests passing per the PR description.


@lishuceo
lishuceo merged commit a16e51e into main Mar 5, 2026
2 checks passed
@lishuceo
lishuceo deleted the fix/routing-prompt-git-check branch March 5, 2026 06:01
lishuceo added a commit that referenced this pull request Apr 8, 2026
路由 agent 通过工具搜索 ls 项目目录时,仍会匹配到非仓库目录
(如 talktype-target 编译产物)。即使 use_existing 验证能拒绝,
回退到 use_default 仍不符合预期。

修复: 在搜索指令中明确告知 agent 只有含 .git 的目录才是有效仓库,
编译产物目录不应被选择,部分名称匹配应继续查找更精确的结果。

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant