Skip to content

[1409] code review: verbose 思考展示与 %thinking-box 守卫 - #47

Draft
da-liii wants to merge 11 commits into
mainfrom
da/1409/code_review
Draft

da-liii wants to merge 11 commits into
mainfrom
da/1409/code_review

Conversation

@da-liii

@da-liii da-liii commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

概述

本分支完成 [1409] code review 工作,新增 verbose 模式下思考(reasoning)阶段的实时展示,并修复 `%thinking-box` 在 turn-box 元素不足时抛错的隐患。

主要变更

  • verbose 思考状态展示:reasoning 阶段以 🧠 emoji 给出三种状态(thinking_start / thinking_delta / thinking_end),思考内容本身从不打印,避免泄露模型内部推理;思考中每 60s 提示一次 `🧠 仍在思考…(已 Ns)`。
  • %thinking-box 守卫修复(最新提交):`%thinking-box` 原直接 `(cadddr turn-box)` 无保护,文档要求先调用 `ensure-message-slots` 但未强制。现改为自守卫——pair 时先补齐槽位再 `cadddr`,非 pair 时返回 `#f`(调用方均已用 `vector?` 守卫),消除潜在崩溃。

测试

```
gf test tests/liii/pi/code/modes/verbose/verbose-thinking-test.scm # PASS
gf fmt --check code/liii/pi/code/modes/verbose.scm # OK
```

提交

10 个提交构成完整的 [1409] review 功能链路;本 PR 的修复为最后一个提交 `2c0883a`。

独立扩展 flow 之前对 custom-flow? 返回 'print,脚本/管道场景下
模型思考期间长时间无任何输出,观感如卡死。改为默认 verbose:
resolve-app-mode 对 custom-flow? 返回 'verbose,并在 run-code-review-flow
非 json 分支接通 make-verbose-emitter 实时展示事件;json 保持原协议输出。
模型在长时间 reasoning 时 verbose 模式此前无任何输出,观感如卡死。
现按 thinking 事件给出三种状态反馈(不显示具体思考内容):
  thinking_start  -> 🧠 开始思考…
  thinking_delta  -> 距上次进度行 >=60s 时打印 🧠 仍在思考…(已 Ns)
  thinking_end   -> 🧠 思考完成(用时 Ns)
message_end 兜底收尾未正常结束的思考块;turn_start 复位思考状态。
turn-box 扩展第 4 槽 vector(active? start-ms last-ping-ms),
阈值判定抽为 verbose-thinking-ping-due? 便于单测。
…racking

When turn-box had fewer than 3 elements, the old ensure-message-slots
overshot: the first two 'when' clauses each appended 3/2 elements,
leaving the thinking-box slot (cdddr) non-null and set to #f instead
of a vector. The third clause never fired, so the thinking-state
vector was never created, silently disabling all thinking progress
tracking whenever a turn-box wasn't pre-initialized with exactly 3
elements.

Fix: append exactly one element per clause so each slot fills
independently. Add a regression test exercising an under-populated
turn-box through turn_start + thinking_start.
@da-liii
da-liii marked this pull request as draft November 26, 2026 14:10
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