Skip to content

[bug] recall --depth 参数完全无效,且 depth budget 顺序写反、lookup 非图遍历 #79

Description

@jeff-r2026

现象

teamai recall--depth route|context|lookup 参数在 CLI help 中是核心能力(src/index.ts:557route (entry-points only) | context (module-level, default) | lookup (full graph traversal)),但实测三档输出完全一致,该参数对最终输出无任何可观察效果。

复现(构造一个临时 teamwiki 后):

node dist/index.js recall "timeout" --depth context
node dist/index.js recall "timeout" --depth lookup
node dist/index.js recall "timeout" --depth route

三次输出字节级相同,均只有标题/路径,没有任何正文 snippet。

根因

  1. snippet 被丢弃queryCodeKnowledge 会按 depth 计算 snippet/token budget(src/code-knowledge-recall.ts:289-307),但 recall() 在把 codebase 结果并入 allResults 时只取了 page/title/score丢掉了 snippetsrc/recall.ts:290-308);而 formatResults 本身也不输出正文(src/recall.ts:51-85)。因此 depth 控制的内容量根本不会出现在输出里。

  2. budget 数值写反TOKEN_BUDGET = { route: 500, context: 5000, lookup: 3000 }src/code-knowledge-recall.ts:289)。help 里 lookup 是“最深/全图遍历”,但预算(3000)比默认 context(5000)还小。

  3. lookup 名不副实depth === 'lookup' 的实现只是把第一条结果截断为全文(src/code-knowledge-recall.ts:302-307),其余仍走 extractSnippet,全程没有任何图遍历(图谱只在打分阶段通过 computeGraphBoost 做邻居加权)。

建议

二选一:

  • 若 depth 仍要保留:让 formatResults(或 recall codebase 分支)真正输出 snippet,修正 budget 顺序为 route < context < lookup,并让 lookup 走真正的 N-hop 图遍历;
  • 若暂不需要:直接移除 --depth 选项,避免对用户/AI 产生“可调深度”的误导。

严重程度:中(对外暴露但实际无效的功能)。

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions