fix(cli): resolve duplicate assistant text printing after 'Done' in non-compact text mode
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 72/100
Hướng nghiên cứu
Bắt đầu trong rust/crates/rusty-claude-cli/src/main.rs, bên trong LiveCli::run_turn, và kiểm tra cách streamed text, final_assistant_text và spinner.finish tương tác trong chế độ văn bản không thu gọn. Chạy claw ở chế độ đó với một phản hồi, sau đó xác minh rằng văn bản của assistant chỉ xuất hiện một lần, dòng cuối vẫn được giữ nguyên và trạng thái Done vẫn xuất hiện.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Description
When running claw in non-compact text mode, the entire assistant response is printed twice.
- First, the text chunks are streamed and printed in real-time during the API call.
- Second, after
✔ ✨ Doneis 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
- Print a newline before
spinner.finishif thefinal_textis not empty. This moves the cursor to a new line, ensuring the line-clearing operation inspinner.finishonly clears the empty line and does not corrupt the last line of the streamed text. - Remove the redundant
final_textreprint logic inrun_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 {
- Ngôn ngữ chính
- Rust
- Star
- 195k
- Fork
- 108k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của ultraworkers/claw-code
-
Fix markdown formatting issues in TUI streaming: block-level element newline omission and consecutive empty line accumulationCó thể làm lại được @Aditaya08 đã nhận 50 ngày trước và không có pull request nào đang mở. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
ultraworkers/claw-code#3259 · 7 bình luận ·
-
bug: Missing newlines before paragraphs and code blocks in streamed Markdown renderingCó thể đã có người làm @nankingjing đã nhận 89 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
ultraworkers/claw-code#3257 · 2 bình luận ·
-
[CRITICAL][SECURITY] Untrusted project hooks bypass read-only mode for arbitrary command executionĐang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 68/100
ultraworkers/claw-code#3301 · 4 bình luận ·
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 20/100
ultraworkers/claw-code#3300 · 2 bình luận ·
-
Pin all third-party GitHub Actions to immutable commit SHAs across CI workflowsCó thể làm lại được Pull request cho issue này đã bị đóng mà không được merge. Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
ultraworkers/claw-code#3287 · 6 bình luận · 1 reaction ·
Tất cả issue của ultraworkers/claw-code
Issue tương tự
-
[Feature] 设置里面的同步功能Đang mởenhancement user-priority/P2
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 1 ngày
-
agent:triaged bug bughunt pm:npm priority:p1
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
SocketDev/socket-patch#1127 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày