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-arguments-threshold = 10
|
||||||
|
|
||||||
too-many-lines-threshold = 200
|
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,10 +999,10 @@ pub(crate) async fn run_tool_call_loop(
|
||||||
let mut chunk = String::new();
|
let mut chunk = String::new();
|
||||||
for word in display_text.split_inclusive(char::is_whitespace) {
|
for word in display_text.split_inclusive(char::is_whitespace) {
|
||||||
chunk.push_str(word);
|
chunk.push_str(word);
|
||||||
if chunk.len() >= STREAM_CHUNK_MIN_CHARS {
|
if chunk.len() >= STREAM_CHUNK_MIN_CHARS
|
||||||
if tx.send(std::mem::take(&mut chunk)).await.is_err() {
|
&& tx.send(std::mem::take(&mut chunk)).await.is_err()
|
||||||
break; // receiver dropped
|
{
|
||||||
}
|
break; // receiver dropped
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if !chunk.is_empty() {
|
if !chunk.is_empty() {
|
||||||
|
|
|
||||||
|
|
@ -369,7 +369,7 @@ async fn process_channel_message(ctx: Arc<ChannelRuntimeContext>, msg: traits::C
|
||||||
.conversation_histories
|
.conversation_histories
|
||||||
.lock()
|
.lock()
|
||||||
.unwrap_or_else(|e| e.into_inner());
|
.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::user(&enriched_message));
|
||||||
turns.push(ChatMessage::assistant(&response));
|
turns.push(ChatMessage::assistant(&response));
|
||||||
// Trim to MAX_CHANNEL_HISTORY (keep recent turns)
|
// Trim to MAX_CHANNEL_HISTORY (keep recent turns)
|
||||||
|
|
|
||||||
|
|
@ -849,7 +849,7 @@ fn format_expiry(profile: &auth::profiles::AuthProfile) -> String {
|
||||||
match profile
|
match profile
|
||||||
.token_set
|
.token_set
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.and_then(|token_set| token_set.expires_at.as_ref().cloned())
|
.and_then(|token_set| token_set.expires_at)
|
||||||
{
|
{
|
||||||
Some(ts) => {
|
Some(ts) => {
|
||||||
let now = chrono::Utc::now();
|
let now = chrono::Utc::now();
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,7 @@ use async_trait::async_trait;
|
||||||
use chrono::Local;
|
use chrono::Local;
|
||||||
use parking_lot::Mutex;
|
use parking_lot::Mutex;
|
||||||
use rusqlite::{params, Connection};
|
use rusqlite::{params, Connection};
|
||||||
|
use std::fmt::Write;
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::{Path, PathBuf};
|
||||||
use std::sync::mpsc;
|
use std::sync::mpsc;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
@ -342,12 +343,12 @@ impl SqliteMemory {
|
||||||
let mut idx = 1;
|
let mut idx = 1;
|
||||||
|
|
||||||
if let Some(cat) = category {
|
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()));
|
param_values.push(Box::new(cat.to_string()));
|
||||||
idx += 1;
|
idx += 1;
|
||||||
}
|
}
|
||||||
if let Some(sid) = session_id {
|
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()));
|
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));
|
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 {
|
ObserverEvent::ToolCall {
|
||||||
tool,
|
tool,
|
||||||
duration,
|
duration,
|
||||||
|
|
@ -180,9 +183,6 @@ impl Observer for PrometheusObserver {
|
||||||
.with_label_values(&[tool.as_str()])
|
.with_label_values(&[tool.as_str()])
|
||||||
.observe(duration.as_secs_f64());
|
.observe(duration.as_secs_f64());
|
||||||
}
|
}
|
||||||
ObserverEvent::TurnComplete => {
|
|
||||||
// No metric for turn complete currently
|
|
||||||
}
|
|
||||||
ObserverEvent::ChannelMessage { channel, direction } => {
|
ObserverEvent::ChannelMessage { channel, direction } => {
|
||||||
self.channel_messages
|
self.channel_messages
|
||||||
.with_label_values(&[channel, direction])
|
.with_label_values(&[channel, direction])
|
||||||
|
|
@ -197,8 +197,6 @@ impl Observer for PrometheusObserver {
|
||||||
} => {
|
} => {
|
||||||
self.errors.with_label_values(&[component]).inc();
|
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_msg) = messages.last_mut() {
|
||||||
if let Some(last_content) = last_msg.content.last_mut() {
|
if let Some(last_content) = last_msg.content.last_mut() {
|
||||||
match last_content {
|
match last_content {
|
||||||
NativeContentOut::Text { cache_control, .. } => {
|
NativeContentOut::Text { cache_control, .. }
|
||||||
|
| NativeContentOut::ToolResult { cache_control, .. } => {
|
||||||
*cache_control = Some(CacheControl::ephemeral());
|
*cache_control = Some(CacheControl::ephemeral());
|
||||||
}
|
}
|
||||||
NativeContentOut::ToolResult { cache_control, .. } => {
|
NativeContentOut::ToolUse { .. } => {}
|
||||||
*cache_control = Some(CacheControl::ephemeral());
|
|
||||||
}
|
|
||||||
_ => {}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue