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: {:?}",