fix bot err log

This commit is contained in:
2026-02-28 15:10:46 +09:00
parent f39a90108a
commit b83565d5de

View File

@@ -36,6 +36,7 @@ impl ClaudeSession {
.arg("stream-json") .arg("stream-json")
.arg("--output-format") .arg("--output-format")
.arg("stream-json") .arg("stream-json")
.arg("--verbose")
.arg("--dangerously-skip-permissions") .arg("--dangerously-skip-permissions")
.current_dir(&work_dir) .current_dir(&work_dir)
.stdin(Stdio::piped()) .stdin(Stdio::piped())
@@ -153,13 +154,9 @@ impl ClaudeSession {
.context("failed to write to claude stdin")?; .context("failed to write to claude stdin")?;
self.stdin.flush().await?; self.stdin.flush().await?;
// Wait for response with timeout // Wait for response (no timeout — claude may use tools)
let response = tokio::time::timeout( let response = self.response_rx.recv()
std::time::Duration::from_secs(120),
self.response_rx.recv(),
)
.await .await
.context("claude response timed out after 120s")?
.context("claude session closed unexpectedly")?; .context("claude session closed unexpectedly")?;
if response.is_empty() { if response.is_empty() {
@@ -419,8 +416,8 @@ async fn poll_once(
eprintln!( eprintln!(
"bot: processing notification from @{}: {}", "bot: processing notification from @{}: {}",
notif.author_handle, notif.author_handle,
if notif.text.len() > 50 { if notif.text.chars().count() > 50 {
format!("{}...", &notif.text[..50]) format!("{}...", notif.text.chars().take(50).collect::<String>())
} else { } else {
notif.text.clone() notif.text.clone()
} }