debug: add tracing to on_prompt truncation path

Temporary warn-level logs to diagnose why truncation isn't working
in production. Logs: whether _meta is received, what keys it has,
whether truncation finds the target message, and how many rows are
deleted.

Signed-off-by: Taylor Ho <taylorkmho@gmail.com>
This commit is contained in:
Taylor Ho
2026-04-20 12:50:09 -07:00
parent da05d60645
commit 6e1d68dfa2
+15 -2
View File
@@ -1703,6 +1703,12 @@ impl GooseAcpAgent {
// Handle edit/retry: atomically truncate + append in one transaction,
// or just append for normal prompts.
tracing::warn!(
has_meta = args.meta.is_some(),
meta_keys = ?args.meta.as_ref().map(|m| m.keys().collect::<Vec<_>>()),
user_msg_id = ?user_message.id,
"EDIT/RETRY: on_prompt received"
);
let truncate_id = args
.meta
.as_ref()
@@ -1711,6 +1717,13 @@ impl GooseAcpAgent {
.map(String::from);
if let Some(ref truncate_id) = truncate_id {
tracing::warn!(
thread_id = %thread_id,
session_id = %internal_session_id,
truncate_id = %truncate_id,
user_msg_id = ?user_message.id,
"EDIT/RETRY: attempting truncation"
);
let (_, rows_deleted) = self
.thread_manager
.truncate_and_append(
@@ -1725,11 +1738,11 @@ impl GooseAcpAgent {
.data(format!("Failed to truncate and append: {}", e))
})?;
tracing::debug!(
tracing::warn!(
thread_id = %thread_id,
truncate_id = %truncate_id,
rows_deleted = rows_deleted,
"Truncated conversation for edit/retry"
"EDIT/RETRY: truncation complete"
);
} else {
self.thread_manager