fix(llm): handle_no_tool_calls 仍会落盘空 assistant 行——#168 的同族遗留通道
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Read src/run_core.rs around handle_no_tool_calls (lines 835–857) and compare its empty-content handling with the has_persistable_interrupt logic from issue #168. Add a test for a normal stop with empty content and no tool calls, then run cargo test --lib and cargo test --test invariants. Done means the transcript has no empty assistant row, with the predicate covered by an assertion or equivalent reasoning.
由索引模型根据 Issue 内容生成。
描述
优先级 P3 · 依赖:无(同族于已修复的 #168)
基线 HEAD = e9e314ec
Summary
#168 修复了「中断在 tool_call 阶段落盘空 assistant 消息」的中断路径,但交付说明
(infra4agent#8)已指出:同族通道 run_core::handle_no_tool_calls 未被处理,
且当时标记为「超范围,故未动」——但没有开跟进单。本单补上这个跟踪项。
src/run_core.rs:835-857:
fn handle_no_tool_calls(&mut self, completion: &Completion, step: usize) -> Option<FinishReason> {
if !completion.tool_calls.is_empty() { return None; }
let mut msg = Message::assistant(completion.content.clone()); // ← content 可为空串
msg.reasoning_content = completion.reasoning_content.clone();
self.push_message(step, msg); // ← 无条件落盘
...
}
即:正常停止(非中断)且 content 为空时,仍会落盘一条
{"role":"assistant","content":""} 的 transcript 行。
为什么目前危害低(但不该长期如此)
#168 的三层防线已把「空 assistant」在出网与读取两侧都拦住了,已实测确认:
serialize_messages_anthropic/ openaibuild_request的is_empty_assistant过滤;SessionReader::load_messages与load_messages_with_orphan_results的加载期过滤。
→ 不会污染线上请求,因此本单是 P3 而非 P2。
建议
两种方向,择一即可(建议 ①):
- 不落盘:
handle_no_tool_calls在content与reasoning_content均为空时
不 push(与#168的has_persistable_interrupt判据保持一致的语义); - 落盘但标记:保留行以便审计,明确标注其为「无内容终止」,
并确保所有 serializer/loader 一致丢弃。
验收条件
- 构造「模型返回
finish_reason=stop+ 空content+ 无 tool_calls」的场景,
断言 transcript 不含空的 assistant 行(或按方向 ② 断言其被一致丢弃); - 回归:
cargo test --lib0 failed;cargo test --test invariants0 failed; - 若为
is_empty_assistant/has_persistable_interrupt类判据,
必须补断言或补等价性论证,不得使用#[mutants::skip](#168 的既定纪律,
已实测该门禁对本修复有效:撤销 skip 后变异可被杀死)。
- 主要语言
- Rust
- 星标
- 4
- 派生
- 0
- 平均合并
- 5 小时 32 分钟
- 30 天内合并 PR
- 7
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
jeffkit/recursive 的其他 Issue
-
难度 3/5 1-2 天 新手友好度 53/100
jeffkit/recursive#195 · 4 条评论 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 15/100
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 15/100
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 8/100
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 12/100
维护者通常 1 天内回复
查看 jeffkit/recursive 的全部 Issue
相似的 Issue
-
agent:triaged bug bughunt pm:pipenv priority:p1
难度 2/5 1-3 小时 新手友好度 78/100
SocketDev/socket-patch#1608 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
adorsys/status-list-server#698 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
nannou-org/egui_graph#92 ·
维护者通常 1 天内回复
-
documentation good first issue
难度 2/5 半天 新手友好度 72/100
sujithputta02/Esapay#13 ·
-
Deduplicate normalized_f64_bits (hash_table.rs and bloom_filter.rs)可能已有人在做 关联的 PR 仍在进行中或已合并。 未关闭
难度 2/5 1-3 小时 新手友好度 75/100
tursodatabase/turso#10002 ·
维护者通常 1 天内回复