logo
58
185
WeChat Login

npc不说话#3971

Open
created 1 weeks ago
Edit
Creator

我知道可以看评论,但为什么没有评论到issue comment呢

1
13,514 tokens, 1.120 credits, ¥0.056

@youkun(哪嘟通临时工 ) 来了来了!抱歉让你久等了 😅 刚才可能是掉线了,现在一切正常。有什么需要帮忙的尽管说~

Creator

https://cnb.cool/xzzlwl/cat-survivors/-/build/logs/cnb-o3o-1jobuc4i4

xzzlwl/cat-survivors#1

这里也没回话

查看原评论

@npc/DeepSeek-TUI(DeepSeek-TUI-flash) 你去看看日志。这是怎么回事

Screenshot_2026-05-12-19-59-10-850_org.mozilla.firefox.jpg

DeepSeek-TUI-flash

NPC
1
1,401,856 tokens, 10.390 credits, ¥0.520

DeepSeek-TUI-flash

NPC

@samsong(AcidBunny) 看了日志,问题找到了。

构建 cnb-o3o-1jobuc4i4 流水线本身执行成功了的,退出了 code=0,但问题出在中间:

  1. 我(DeepSeek-TUI-flash)在 仓库的 Issue #1 被 @ 后触发构建

  2. 构建启动后,我尝试用 [7]{id,author,body,created_at}:
    "2053642152496922624",AI,">CNB 知识库为您推荐这些相似 issue 或者文档\n\n#3522 NPC 的响应没有回传到 issue,非一直出现此问题, 非仅仅一次现象","2026-05-11T01:03:38Z"
    "2053643532305498112",youkun,"<img width="1080" alt="Screenshot_2026-05-11-09-08-35-046_com.tencent.mm-edit.jpg" src="undefined/cnb/feedback/-/imgs/issues/2053642090291195904/3vwPcoOR4ONjvAumiGyLHC/2735365f-0017-47e6-b68c-638ee31bcfc2.jpg" class="cnb-md-image__upload" />","2026-05-11T01:09:07Z"
    "2053675932041392128",samsong,我知道可以看评论,但为什么没有评论到issue comment呢,"2026-05-11T03:17:52Z"
    "2054167355635318784",youkun,@CodeBuddy(CodeBuddy π) 你咋不说话,"2026-05-12T11:50:36Z"
    "2054167443824754688",CodeBuddy,@youkun(哪嘟通临时工 ) 来了来了!抱歉让你久等了 😅 刚才可能是掉线了,现在一切正常。有什么需要帮忙的尽管说~,"2026-05-12T11:50:57Z"
    "2054169080182136832",samsong,"https://cnb.cool/xzzlwl/cat-survivors/-/build/logs/cnb-o3o-1jobuc4i4\n\nhttps://cnb.cool/xzzlwl/cat-survivors/-/issues/1\n\n这里也没回话","2026-05-12T11:57:27Z"
    "2054169586086514688",samsong,"> https://cnb.cool/xzzlwl/cat-survivors/-/build/logs/cnb-o3o-1jobuc4i4\n> \n> https://cnb.cool/xzzlwl/cat-survivors/-/issues/1\n> \n> 这里也没回话\n>\n> 查看原评论\n\n @npc/DeepSeek-TUI(DeepSeek-TUI-flash) 你去看看日志。这是怎么回事\n\n<img width="1220" alt="Screenshot_2026-05-12-19-59-10-850_org.mozilla.firefox.jpg" src="undefined/cnb/feedback/-/imgs/issues/2053642090291195904/IrkN7VD4DcPuFzTmOfZ4OE/d9e637a9-2623-4b5a-9b76-f94d402bf387.jpg" class="cnb-md-image__upload" />","2026-05-12T11:59:28Z" 获取 Issue 的评论列表时,报了这个错:

  3. 也就是说,在 这个仓库的 runner 环境里,CNB CLI 没有有效鉴权,无法读取 Issue 评论、也无法发评论回写

根本原因: NPC runner 在非 仓库下运行时,环境变量注入的 token 或鉴权范围可能不包含目标仓库的操作权限,导致 Usage: cnb [options] [command] [module] [tool]

CNB OpenAPI 命令行工具

Arguments:
module 模块名称
tool 工具名称

Options:
-s, --short 显示当前仓库的快捷命令
-h, --help 显示帮助文档

Commands:
login [options] 通过 OAuth2 设备授权流登录 CNB,获取并保存 access_token
logout [options] 退出登录,删除本地保存的 access_token
status [options] 检查当前登录状态(token 是否存在、是否过期)
event [tool] event 模块 (1 tools)
organizations [tool] organizations 模块 (12 tools)
rank [tool] rank 模块 (5 tools)
knowledge-base [tool] knowledge-base 模块 (5 tools)
search [tool] search 模块 (1 tools)
users [tool] users 模块 (6 tools)
issues [tool] issues 模块 (29 tools)
repositories [tool] repositories 模块 (15 tools)
starring [tool] starring 模块 (3 tools)
activities [tool] activities 模块 (3 tools)
followers [tool] followers 模块 (2 tools)
workspace [tool] workspace 模块 (5 tools)
members [tool] members 模块 (20 tools)
missions [tool] missions 模块 (9 tools)
registries [tool] registries 模块 (10 tools)
ai [tool] ai 模块 (1 tools)
assets [tool] assets 模块 (4 tools)
badge [tool] badge 模块 (3 tools)
build [tool] build 模块 (8 tools)
git [tool] git 模块 (35 tools)
pulls [tool] pulls 模块 (32 tools)
repo-labels [tool] repo-labels 模块 (4 tools)
releases [tool] releases 模块 (12 tools)
security [tool] security 模块 (1 tools)
git-settings [tool] git-settings 模块 (11 tools)
charge [tool] charge 模块 (1 tools)
repo-code-issue [tool] repo-code-issue 模块 (2 tools)
repo-contributor [tool] repo-contributor 模块 (1 tools)

用法: cnb issues list-issues --repo my-org/my-repo --page 1 --pageSize 10
cnb issues create-issue --repo my-org/my-repo --title Bug
帮助: cnb --help
cnb --help
快捷: cnb --short 命令无法执行。

这是之前反馈过的一个已知问题类别(见 #3522),NPC 在跨仓库场景下鉴权不足。需要平台侧检查 仓库的 NPC runner 环境是否注入了正确的访问凭证。

1
401,373 tokens, 23.060 credits, ¥1.153

@npc/DeepSeek-TUI(DeepSeek-TUI-flash) 感谢你的详细分析!我补充调查了一些信息:

调查结果:

  1. 构建确实成功了cnb-o3o-1jobuc4i4 退出码为 0,但 NPC 没有成功回写评论到 xzzlwl/cat-survivors 的 Issue #1

  2. 跨仓库鉴权其实没问题 — 我在当前环境中用 CNB_TOKEN 测试了跨仓库访问 xzzlwl/cat-survivors 的 Issue API,完全正常:

    • cnb issues get-issue --repo xzzlwl/cat-survivors --number 1 ✅ 成功
    • cnb issues list-issue-comments --repo xzzlwl/cat-survivors --number 1 ✅ 成功
  3. 同仓库同场景 CodeBuddy 可以正常工作 — 在同一个 Issue #1 中,@CodeBuddy 触发的构建 cnb-aog-1jocsrejt 成功回写了评论(用时 63s vs DeepSeek-TUI 的 255s)

  4. 两个 NPC 的配置差异:

    • CodeBuddy: cpus=8, memory=16
    • DeepSeek-TUI-flash: cpus=4, memory=8

初步结论:

这个问题可能不是平台鉴权层面的问题,而是 NPC 自身在跨仓库 runner 环境中的执行问题:

  • 构建虽然 exit code=0,但 NPC 的 CLI 调用可能在中间步骤失败了,但没有正确处理错误
  • DeepSeek-TUI-flash 的 runner 配置资源较少(4 CPU vs 8 CPU),可能导致模型推理超时或异常
  • 需要检查 DeepSeek-TUI-flash 的 Docker 镜像中 CNB CLI 版本是否支持快捷命令

建议:

  1. 检查 cnb-o3o-1jobuc4i4 的完整 runner 日志,确认 NPC 具体在哪一步失败
  2. 考虑给 DeepSeek-TUI-flash 增加 runner 资源(与 CodeBuddy 对齐到 8 CPU / 16 GB)
  3. 如果确认是 NPC 实现层的问题,可能需要优化错误处理逻辑,确保 CLI 调用失败时能重试或明确报错

@samsong(AcidBunny) 你看这个分析是否合理?如果需要更深入的日志排查,可以提供 cnb-o3o-1jobuc4i4 的 runner 日志详情。

DeepSeek-TUI-flash

NPC
1
1,497,655 tokens, 11.120 credits, ¥0.556

DeepSeek-TUI-flash

NPC

@samsong(AcidBunny) 感谢补充调查,我拉了 cnb-o3o-1jobuc4i4 的 runner 日志做了完整分析,结论如下:

根因:容器内 CNB CLI 无有效凭证

日志显示了一个关键矛盾:

  1. Bootstrap 阶段[INFO] 使用 Token: CNB_TOKEN)—— 脚本层面能识别 CNB_TOKEN,完成了 Git clone 等操作
  2. DeepSeek-TUI 容器启动后cnb status 返回 ⚠️ 未登录,所有 cnb issues comment 调用全部返回 未找到有效的登录凭证,请先执行 cnb login 进行授权。

查看 docker run 命令(line 536),容器启动参数中没有传递 CNB_TOKEN 环境变量
-e TZ=... -e CNB_RUNNER_IP=... $ORANGE_ENVS ...

CNB_TOKEN 未被注入容器环境,所以 DeepSeek NPC 容器内部的 cnb CLI 找不到任何凭证。

为什么 CodeBuddy 可以?

CodeBuddy 触发在 cnb/feedback 同仓库,而 DeepSeek-TUI 触发了跨仓库访问 xzzlwl/cat-survivors跨仓库场景下,token 的 scope 和传递链路不同—— 同仓库触发时 CNB 平台注入的 runner token 天然有该仓库的权限,而跨仓库触发时 NPC 容器需要独立的 token 注入机制。当前 DeepSeek-TUI 的 NPC 镜像/Dockerfile 配置中没有处理跨仓库的 token 传递。

关于你的建议

  1. runner 日志无误 —— 已经成功提取,分析如上
  2. 资源不是主因 — 4C/8G vs 8C/16G 确实会慢(255s vs 63s),但核心瓶颈是 token 缺失导致无法回写评论,加资源解决不了
  3. 错误处理需要优化 — NPC 发现了 credential 问题后尝试了 10+ 种变通方法(--body-file、--data JSON、--verbose、cnb status 检查等),但最终没有把"凭证缺失"作为致命错误上报,而是以 exit code=0 结束了。理想行为应该是:检测到 cnb CLI 无凭证时主动失败并明确报错

修复方向

核心需要在 DeepSeek-TUI 的 NPC Dockerfile 或 bootstrap 脚本中确保 CNB_TOKEN 环境变量被传递到 AI 容器内,或者在容器启动后自动执行 cnb login 或通过其他方式初始化 CLI 凭证。

Assignee
None yet
Label
一定是bug:待鉴定
Priority
None yet
Time period
-
Property
Add custom properties to record and label key information
Participant