修复总结截断:思考模型不下发 max_tokens,截断 fail-loud - #65
Merged
Conversation
reasoning_effort 非 disabled 时不发 max_tokens,避免思考 token 挤占正文预算; 下发 max_tokens 且 completion_tokens 打满时判定截断并重试,仍截断则 FAILED 不落盘。 LLMResponse 透出 usage 供截断判定;失败态页面不再显示「内容高度浓缩」提示。 Co-authored-by: Cursor <cursoragent@cursor.com> Agent-Executor: cursor Agent-Model: composer-2.5 Agent-Effort: unknown Dispatch-Id: dlg-20260824-133558-fd0c2f Task-Id: VideoTranscriptAPI-20260824-04
Required Gate v2 — 状态面板当前状态:pass · 可合并 当前裁决: Gate 历史(v1;来源为持久化
|
| Run | Attempt | Head | 状态 | 收件人动作 |
|---|---|---|---|---|
| 32738880237 | 1 | 5fd47ca |
skipped |
无需动作(主审未跑,绿≠过审) |
| 32741454436 | 1 | 7ed9f74 |
skipped |
无需动作(主审未跑,绿≠过审) |
| 32745767860 | 1 | 7ed9f74 |
pass |
可合并 |
| 32745803093 | 1 | a77286d |
pass |
可合并 |
历史行按 run_id + run_attempt 去重并只增不删;删除本评论后可由 gate_terminal 制品重建。
⚙️ Review ledger state(机器状态记录,非评审结论)
机器状态明细
完整数据保存在 |
Agent-Executor: codex Agent-Model: gpt-5.6-luna Agent-Effort: xhigh Dispatch-Id: dlg-20260824-143605-1d04d3 Task-Id: VideoTranscriptAPI-20260824-05
压缩重试 completion_tokens 打满 max_tokens 时不再整段 FAILED,丢弃截断重试 文本并保留 working_text,与重试异常路径对称;首答截断 fail-loud 语义不变。 Co-authored-by: Cursor <cursoragent@cursor.com> Agent-Executor: cursor Agent-Model: composer-2.5 Agent-Effort: unknown Dispatch-Id: dlg-20260824-152412-1d898a Task-Id: VideoTranscriptAPI-20260824-04
Collaborator
Author
|
R1 verdict(codex 正向全量):pass-with-backlog,0 P1/P2 — docs/sessions/260824-summary-trunc/reviews/summary-truncation-r1-verdict.md |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
2026-08-24 的总结篇幅预算治理(68e2107)给总结调用下发了
max_tokens = hard_cap × 1.5,但生产总结模型是思考模型,reasoning token 计入 completion 预算。实测复现(同网关同模型):max_tokens=5046 中 reasoning 占 4431(88%),正文被 finish_reason=length 切断;最重一例正文仅 193 字且断句中间,但通过全部字符层校验落盘,页面显示为「内容高度浓缩」。根因:字符级预算与 token 级上限量纲混淆;思考 token 是调用方不可控的预算竞争者,截断失败模式对全部四层防线不可见。
修复
reasoning_effort != "disabled"(思考形态)不下发 max_tokens,靠 prompt 篇幅目标 + 字符级后验压缩重试completion_tokens >= max_tokens判定截断 → 压缩语义重试一次 → 仍截断则SummaryStatus.FAILED,截断文本永不落盘LLMResponse.usage从 usage_context 桥接快照挂载(peek 不破坏既有 pop 审计契约)summary_state == 'generated'时显示scripts/scan_truncated_summaries.py扫 audit.db 疑似截断调用(受害重生成另行安排)Task-Id: VideoTranscriptAPI-20260824-04;llm-compat 侧正路依赖见 zlxlabs/llm-compat#25
测试
uv run pytest tests/llm tests/unit -q绿(exit 0,进度线无 F/E)test_transcript_condensation_hint.py在 base 上红(失败态仍显示浓缩提示)