fix(test): stabilize cron output capture and clippy cleanups
This commit is contained in:
parent
483acccdb7
commit
50fd5b81e1
7 changed files with 20 additions and 19 deletions
|
|
@ -7,3 +7,7 @@ cognitive-complexity-threshold = 30
|
|||
too-many-arguments-threshold = 10
|
||||
|
||||
too-many-lines-threshold = 200
|
||||
|
||||
# Some generated/test-only paths legitimately allocate larger local buffers.
|
||||
# Keep linting enabled while reducing false positives from those cases.
|
||||
array-size-threshold = 65536
|
||||
|
|
|
|||
|
|
@ -999,12 +999,12 @@ pub(crate) async fn run_tool_call_loop(
|
|||
let mut chunk = String::new();
|
||||
for word in display_text.split_inclusive(char::is_whitespace) {
|
||||
chunk.push_str(word);
|
||||
if chunk.len() >= STREAM_CHUNK_MIN_CHARS {
|
||||
if tx.send(std::mem::take(&mut chunk)).await.is_err() {
|
||||
if chunk.len() >= STREAM_CHUNK_MIN_CHARS
|
||||
&& tx.send(std::mem::take(&mut chunk)).await.is_err()
|
||||
{
|
||||
break; // receiver dropped
|
||||
}
|
||||
}
|
||||
}
|
||||
if !chunk.is_empty() {
|
||||
let _ = tx.send(chunk).await;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -369,7 +369,7 @@ async fn process_channel_message(ctx: Arc<ChannelRuntimeContext>, msg: traits::C
|
|||
.conversation_histories
|
||||
.lock()
|
||||
.unwrap_or_else(|e| e.into_inner());
|
||||
let turns = histories.entry(history_key).or_insert_with(Vec::new);
|
||||
let turns = histories.entry(history_key).or_default();
|
||||
turns.push(ChatMessage::user(&enriched_message));
|
||||
turns.push(ChatMessage::assistant(&response));
|
||||
// Trim to MAX_CHANNEL_HISTORY (keep recent turns)
|
||||
|
|
|
|||
|
|
@ -849,7 +849,7 @@ fn format_expiry(profile: &auth::profiles::AuthProfile) -> String {
|
|||
match profile
|
||||
.token_set
|
||||
.as_ref()
|
||||
.and_then(|token_set| token_set.expires_at.as_ref().cloned())
|
||||
.and_then(|token_set| token_set.expires_at)
|
||||
{
|
||||
Some(ts) => {
|
||||
let now = chrono::Utc::now();
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ use async_trait::async_trait;
|
|||
use chrono::Local;
|
||||
use parking_lot::Mutex;
|
||||
use rusqlite::{params, Connection};
|
||||
use std::fmt::Write;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::sync::mpsc;
|
||||
use std::sync::Arc;
|
||||
|
|
@ -342,12 +343,12 @@ impl SqliteMemory {
|
|||
let mut idx = 1;
|
||||
|
||||
if let Some(cat) = category {
|
||||
sql.push_str(&format!(" AND category = ?{idx}"));
|
||||
let _ = write!(sql, " AND category = ?{idx}");
|
||||
param_values.push(Box::new(cat.to_string()));
|
||||
idx += 1;
|
||||
}
|
||||
if let Some(sid) = session_id {
|
||||
sql.push_str(&format!(" AND session_id = ?{idx}"));
|
||||
let _ = write!(sql, " AND session_id = ?{idx}");
|
||||
param_values.push(Box::new(sid.to_string()));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -166,7 +166,10 @@ impl Observer for PrometheusObserver {
|
|||
self.tokens_used.set(i64::try_from(*t).unwrap_or(i64::MAX));
|
||||
}
|
||||
}
|
||||
ObserverEvent::ToolCallStart { tool: _ } => {}
|
||||
ObserverEvent::ToolCallStart { tool: _ }
|
||||
| ObserverEvent::TurnComplete
|
||||
| ObserverEvent::LlmRequest { .. }
|
||||
| ObserverEvent::LlmResponse { .. } => {}
|
||||
ObserverEvent::ToolCall {
|
||||
tool,
|
||||
duration,
|
||||
|
|
@ -180,9 +183,6 @@ impl Observer for PrometheusObserver {
|
|||
.with_label_values(&[tool.as_str()])
|
||||
.observe(duration.as_secs_f64());
|
||||
}
|
||||
ObserverEvent::TurnComplete => {
|
||||
// No metric for turn complete currently
|
||||
}
|
||||
ObserverEvent::ChannelMessage { channel, direction } => {
|
||||
self.channel_messages
|
||||
.with_label_values(&[channel, direction])
|
||||
|
|
@ -197,8 +197,6 @@ impl Observer for PrometheusObserver {
|
|||
} => {
|
||||
self.errors.with_label_values(&[component]).inc();
|
||||
}
|
||||
ObserverEvent::LlmRequest { .. } => {}
|
||||
ObserverEvent::LlmResponse { .. } => {}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -202,13 +202,11 @@ impl AnthropicProvider {
|
|||
if let Some(last_msg) = messages.last_mut() {
|
||||
if let Some(last_content) = last_msg.content.last_mut() {
|
||||
match last_content {
|
||||
NativeContentOut::Text { cache_control, .. } => {
|
||||
NativeContentOut::Text { cache_control, .. }
|
||||
| NativeContentOut::ToolResult { cache_control, .. } => {
|
||||
*cache_control = Some(CacheControl::ephemeral());
|
||||
}
|
||||
NativeContentOut::ToolResult { cache_control, .. } => {
|
||||
*cache_control = Some(CacheControl::ephemeral());
|
||||
}
|
||||
_ => {}
|
||||
NativeContentOut::ToolUse { .. } => {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue