From d3ee850f3780a6b2a4b4cd59fb8846279b419e1b Mon Sep 17 00:00:00 2001 From: dave Date: Thu, 9 Apr 2026 22:11:41 +0000 Subject: [PATCH] huskies: merge 500_story_remove_duplicate_pty_debug_log_lines --- server/src/agents/pty.rs | 35 +++++++++++++++++++---------------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/server/src/agents/pty.rs b/server/src/agents/pty.rs index 6a55efd3..ded825b8 100644 --- a/server/src/agents/pty.rs +++ b/server/src/agents/pty.rs @@ -363,20 +363,25 @@ fn run_agent_pty_blocking( .map(|dt| dt.with_timezone(&chrono::Utc)); if is_hard_block { - let reset_at = reset_at.unwrap_or_else(|| { - let default = chrono::Utc::now() - + chrono::Duration::minutes(5); - slog!( - "[agent:{story_id}:{agent_name}] API rate limit hard block \ - (status={status}); no reset_at in rate_limit_info, \ - defaulting to 5-minute backoff ({default})" - ); - default - }); - slog!( - "[agent:{story_id}:{agent_name}] API rate limit hard block \ - (status={status}); resets at {reset_at}" - ); + let reset_at = match reset_at { + Some(t) => { + slog!( + "[agent:{story_id}:{agent_name}] API rate limit hard block \ + (status={status}); resets at {t}" + ); + t + } + None => { + let default = chrono::Utc::now() + + chrono::Duration::minutes(5); + slog!( + "[agent:{story_id}:{agent_name}] API rate limit hard block \ + (status={status}); no reset_at in rate_limit_info, \ + defaulting to 5-minute backoff ({default})" + ); + default + } + }; let _ = watcher_tx.send(WatcherEvent::RateLimitHardBlock { story_id: story_id.to_string(), agent_name: agent_name.to_string(), @@ -429,11 +434,9 @@ fn run_agent_pty_blocking( // Wait for the reader thread to finish so it releases the cloned PTY // master fd before we return. Without this, the next PTY spawn for the // same story can collide with a still-open fd from this session (#453). - slog!("[agent:{story_id}:{agent_name}] Waiting for reader thread to exit"); if let Err(e) = reader_handle.join() { slog!("[agent:{story_id}:{agent_name}] Reader thread panicked: {e:?}"); } - slog!("[agent:{story_id}:{agent_name}] Reader thread joined"); slog!( "[agent:{story_id}:{agent_name}] Done. Session: {:?}",