Skip to content

docs(workbuddy): 「模型不响应」的排障结案 + 可复跑工具 - #68

Open
Siyuan-Zhao770707 wants to merge 1 commit into
starsstreaming:mainfrom
Siyuan-Zhao770707:docs/workbuddy-latency-notes
Open

Siyuan-Zhao770707 wants to merge 1 commit into
starsstreaming:mainfrom
Siyuan-Zhao770707:docs/workbuddy-latency-notes

Conversation

@Siyuan-Zhao770707

Copy link
Copy Markdown

背景

用户报:WorkBuddy 适配生效后「对话大模型不响应」。这类报告默认会指向注入层,所以我把逐层取证的过程和结论一并写进 docs/host-adapter-workbuddy.md 新增的 §15,并把取证做成可复跑的脚本,免得下次再从 CSS 开始猜。

结论:与注入无关

两件事叠加:

  1. 上游偶发尖峰 —— POST https://copilot.tencent.com/v2/chat/completions 那次请求 15.7 秒没吐一个 token;相邻的后台请求首字延迟 24.2 秒;而当天同一台机器 177 次请求的 p50 是 2.6 秒。用户在 ~15s 按了「停止」。
  2. 取消后宿主前端状态没恢复 —— .cr-send-button 持续 disabled、.cr-cancelled-indicator(「用户已取消」)常驻 25 分钟,而后端日志 runtime-status: persisted status=completed, state=idle。两边不一致,于是「发不出消息」比「模型慢」更像故障。

量化排除适配层(写在文档里的证据)

观察 数据
渲染层没卡死 [perf] [loop-lag] macro=0ms micro=0ms
注入样式不是性能元凶 强制重算 5 次:带我们的 4 张样式表 0.06ms,移除后基线 4.9ms
注入没破坏结构 契约锚点(.teams-container / .conversation-shell / .cr-input-container / .cr-message-list)全部命中,舞台与面板 pointer-events:none
守护当时确实在跑 注入 window.__bcPickRequest=777,150ms 内被取件轮询清成 0(沙箱里 ps 不可用,这条比 ps 可靠)
请求确实发出去了 worker 日志 [ModelProvider] Sending request: agent=cli, url=…/v2/chat/completions,随后 Request failed: … error=canceled

新增工具

scripts/wb-latency-report.mjs(npm run wb:latency):

node scripts/wb-latency-report.mjs --hours 5        # 人读
node scripts/wb-latency-report.mjs --hours 24 --json # 机器读

读 ~/.workbuddy/logs/<date>/*.log,把 send → first token → done / canceled 串成时间线并给出 TTFT 分位数。只读日志:不打印 prompt 正文、不碰页面、不改注入。

真实输出示例:

首字延迟(TTFT):样本 170  p50=2.6s  p90=3.6s  最慢=24.2s
⚠ 有 2 次请求首字超过 10000ms ——「模型不响应」多半就是等在这里
16:52:47  → send  beautiCode · agent=cli · model=deepseek-v4.1-flash
16:53:03    fail  canceled
16:53:30    first ttft=24245ms   ⚠ 慢

判读规则(下次直接照抄)

  • send 与 first 的间隔 = 上游出字时间;cancelled 出现在 first 之前 = 用户主动放弃,不是模型坏了。
  • loop-lag macro=0ms + 发送键 disabled + 取消标记常驻 = 宿主前端状态机没恢复(适配层不接管输入区,改不动;重启宿主即恢复)。
  • 只有在「注入样式表重算开销出现数量级劣化」或「契约锚点 0 命中」时,才该怀疑适配层。

影响范围

纯文档 + 新增一个只读脚本 + 一条 npm script,不动任何注入逻辑。

@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because your trial has ended. Ask your workspace admin to add credits to resume reviews. Manage billing

@coderabbitai

coderabbitai Bot commented Sep 20, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 98147b48-4fdf-44a2-a6e5-53c313395b08

📥 Commits

Reviewing files that changed from the base of the PR and between b625c0f and 256e2c7.

📒 Files selected for processing (3)
  • docs/host-adapter-workbuddy.md
  • package.json
  • scripts/wb-latency-report.mjs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

… ship the tool that proves it

A user reported that the chat model stopped answering once the adapter was
active, which points at the injection by default. It was not the injection:
the upstream endpoint took 15.7 s to produce a single token on that request
(24.2 s for an adjacent background request, against a p50 of 2.6 s over the
same day), the user cancelled at ~15 s, and the host then never left its
cancelled/streaming state — `.cr-send-button` stayed disabled with the
"cancelled" marker up for 25 minutes while the backend had already persisted
`status=completed`.

Write the evidence chain down, together with the numbers that ruled the
adapter out (a forced style recalc costs 0.06 ms with our four sheets injected
versus a 4.9 ms baseline; the renderer reported `loop-lag macro=0ms`; every
contract anchor matched). The postmortem alone would rot, so add
`scripts/wb-latency-report.mjs` (`npm run wb:latency`), which reads the host's
own worker logs and reconstructs send -> first token -> complete/cancel with
TTFT percentiles. It only reads `~/.workbuddy/logs`, never prints prompt text,
and does not touch the page or the injection.

Also note the reading rules for next time: a cancel landing before the first
token means the user gave up, not that the model broke, and a frozen composer
with an idle event loop means host state, not the adapter.
@Siyuan-Zhao770707
Siyuan-Zhao770707 force-pushed the docs/workbuddy-latency-notes branch from b69e638 to 256e2c7 Compare September 21, 2026 04:19
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