fix: pass MAX_MESSAGE_PAIRS_PER_AGENT to streaming conversation save#468
fix: pass MAX_MESSAGE_PAIRS_PER_AGENT to streaming conversation save#468octo-patch wants to merge 1 commit into
Conversation
…ixes 2FastLabs#365) The processStreamInBackground method was calling saveConversationExchange without the maxHistorySize parameter, causing conversation history to grow unbounded when using streaming responses regardless of MAX_MESSAGE_PAIRS_PER_AGENT config. This aligns the streaming code path with the non-streaming path.
|
@claude check this PR. You must check of the problem statement is real, then to analyze the implementation and see if it really fixes the issue. |
|
Claude finished @cornelcroi's task in 1m 30s —— View job PR Review: fix/issue-365-streaming-max-message-pairsTodo List:
Problem Statement — Confirmed Real ✓The bug is genuine. Looking at the diff: - agent.id
+ agent.id,
+ this.config.MAX_MESSAGE_PAIRS_PER_AGENTThe export async function saveConversationExchange(
userInput: string,
agentResponse: string,
storage: ChatStorage,
userId: string,
sessionId: string,
agentId: string,
maxHistorySize?: number // ← was always undefined for streaming
)Without Fix Analysis ✓The fix is correct and minimal. The non-streaming path at The fire-and-forget nature of Python Parity — Not Affected ✓The Python implementation doesn't have this bug. Its async def save_message(self, message, user_id, session_id, agent):
if agent and agent.save_chat:
return await self.storage.save_chat_message(
user_id, session_id, agent.id, message,
self.config.MAX_MESSAGE_PAIRS_PER_AGENT # always passed
)The Python streaming path calls this helper at lines 189 and 208, so it was never vulnerable. Minor Observation
|
Fixes #365
Problem
The processStreamInBackground method in orchestrator.ts was calling saveConversationExchange without the maxHistorySize parameter. Streaming responses ignored MAX_MESSAGE_PAIRS_PER_AGENT, causing unbounded conversation history growth.
Solution
Added the missing this.config.MAX_MESSAGE_PAIRS_PER_AGENT parameter to saveConversationExchange inside processStreamInBackground, matching the non-streaming code path.
Testing
The fix is a one-line addition aligning the streaming code path with the already-correct non-streaming path.