Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

fix(cli): resolve duplicate assistant text printing after 'Done' in non-compact text mode

未关闭 适合新手
#3,258 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

@nankingjing 已经在做这个了。

开始于 2026年7月11日。

  • #3273 来自 @nankingjing —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
72/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
冷清
技术栈
rust
领域
cli

调研方向

从 rust/crates/rusty-claude-cli/src/main.rs 中的 LiveCli::run_turn 开始,检查 streamed text、final_assistant_text 和 spinner.finish 在非紧凑文本模式下如何交互。在该模式下让 claw 运行并返回一条响应,然后确认 assistant 文本只出现一次、最后一行得到保留,并且 Done 状态仍然显示。

由索引模型根据 Issue 内容生成。

描述

Description

When running claw in non-compact text mode, the entire assistant response is printed twice.

  1. First, the text chunks are streamed and printed in real-time during the API call.
  2. Second, after ✔ ✨ Done is printed, the full assistant text (final_text) is printed again.

This causes a large amount of redundant output in the console, especially for long responses.

Cause

In LiveCli::run_turn (inside main.rs), spinner.finish("✨ Done") is called right after the conversation stream finishes.
Because spinner.finish moves the cursor to column 0 and clears the current line, it would erase the last line of the streamed text if we do not print a newline first.
To prevent this, the previous commit introduced a secondary full-text reprint:

let final_text = final_assistant_text(&summary);
if !final_text.is_empty() {
    let renderer = TerminalRenderer::new();
    println!("{}", renderer.markdown_to_ansi(&final_text));
}

However, this reprints the entire assistant message instead of just protecting the last line, causing the duplicate response.

Solution
  1. Print a newline before spinner.finish if the final_text is not empty. This moves the cursor to a new line, ensuring the line-clearing operation in spinner.finish only clears the empty line and does not corrupt the last line of the streamed text.
  2. Remove the redundant final_text reprint logic in run_turn.

Here is the proposed diff in rust/crates/rusty-claude-cli/src/main.rs:

@@ -7763,15 +7763,15 @@
         match result {
             Ok(summary) => {
                 self.replace_runtime(runtime)?;
-                spinner.finish(
-                    "✨ Done",
-                    TerminalRenderer::new().color_theme(),
-                    &mut stdout,
-                )?;
                 let final_text = final_assistant_text(&summary);
                 if !final_text.is_empty() {
-                    let renderer = TerminalRenderer::new();
-                    println!("{}", renderer.markdown_to_ansi(&final_text));
-                }
+                    println!();
+                }
+                spinner.finish(
+                    "✨ Done",
+                    TerminalRenderer::new().color_theme(),
+                    &mut stdout,
+                )?;
                 println!();
                 if let Some(event) = summary.auto_compaction {
主要语言
Rust
星标
195k
派生
108k
PR 合并指标
30 天内没有已合并 PR

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

ultraworkers/claw-code 的其他 Issue

查看 ultraworkers/claw-code 的全部 Issue

相似的 Issue

更多 Rust Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。