fix: metrics on posthog (#6024)

Co-authored-by: Zane Staggs <zane@squareup.com>
Co-authored-by: Zane <75694352+zanesq@users.noreply.github.com>
This commit is contained in:
Michael Neale
2025-12-10 11:28:18 +11:00
committed by GitHub
parent 02189f5555
commit 9b6a1c1297
20 changed files with 689 additions and 34 deletions
+6 -4
View File
@@ -1221,7 +1221,8 @@ impl Agent {
no_tools_called = false;
}
}
Err(ProviderError::ContextLengthExceeded(_error_msg)) => {
Err(ref provider_err @ ProviderError::ContextLengthExceeded(_)) => {
crate::posthog::emit_error(provider_err.telemetry_type());
yield AgentEvent::Message(
Message::assistant().with_system_notification(
SystemNotificationType::InlineMessage,
@@ -1255,11 +1256,12 @@ impl Agent {
}
}
}
Err(e) => {
error!("Error: {}", e);
Err(ref provider_err) => {
crate::posthog::emit_error(provider_err.telemetry_type());
error!("Error: {}", provider_err);
yield AgentEvent::Message(
Message::assistant().with_text(
format!("Ran into this error: {e}.\n\nPlease retry if you think this is a transient or recoverable error.")
format!("Ran into this error: {provider_err}.\n\nPlease retry if you think this is a transient or recoverable error.")
)
);
break;