Skip to content

Commit 2bdba01

Browse files
committed
fix: compact not being retried correctly
1 parent 332cd2c commit 2bdba01

File tree

1 file changed

+4
-2
lines changed
  • crates/chat-cli/src/cli/chat

1 file changed

+4
-2
lines changed

crates/chat-cli/src/cli/chat/mod.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ impl ChatSession {
802802
)?;
803803
("Unable to compact the conversation history", eyre!(err), true)
804804
},
805-
ChatError::Client(err) => match *err {
805+
ChatError::SendMessage(err) => match err.source {
806806
// Errors from attempting to send too large of a conversation history. In
807807
// this case, attempt to automatically compact the history for the user.
808808
ApiClientError::ContextWindowOverflow { .. } => {
@@ -1307,7 +1307,9 @@ impl ChatSession {
13071307
// retryable according to the passed strategy.
13081308
let history_len = self.conversation.history().len();
13091309
match err {
1310-
ChatError::Client(err) if matches!(*err, ApiClientError::ContextWindowOverflow { .. }) => {
1310+
ChatError::SendMessage(err)
1311+
if matches!(err.source, ApiClientError::ContextWindowOverflow { .. }) =>
1312+
{
13111313
error!(?strategy, "failed to send compaction request");
13121314
// If there's only two messages in the history, we have no choice but to
13131315
// truncate it. We use two messages since it's almost guaranteed to contain:

0 commit comments

Comments
 (0)