Skip to content

Commit

Permalink
fix: Allow message history with only template message
Browse files Browse the repository at this point in the history
  • Loading branch information
johnjcsmith committed Dec 26, 2024
1 parent 13dfb41 commit a45be26
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions control-plane/src/modules/workflows/agent/overflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ export const handleContextWindowOverflow = async ({
}

// First message should always be human
while (messages.length && messages[0].type !== "human") {
while (messages.length && !["human", "template"].includes(messages[0].type)) {
if (messages.length === 1) {
logger.error("Only message in mesasge history is not human", {
logger.error("Only message in mesasge history is not human or template", {
messageId: messages[0].id
});
throw new AgentError("Run state is invalid");
Expand Down

0 comments on commit a45be26

Please sign in to comment.