atiaomar1978-hub opened a new pull request, #24880:
URL: https://github.com/apache/camel/pull/24880

   ## CAMEL-23955 — Summary
   
   **Branch:** `CAMEL-23955-conversation-memory-fix`  
   **Commit:** `95e5ee478a7`  
   **Module:** `camel-openai`
   
   ---
   
   ### Bugs Fixed
   
   | # | Problem | Root Cause |
   |---|---------|------------|
   | 1 | User turns missing from conversation history | Only assistant 
responses were saved |
   | 2 | `systemMessage` reset had no effect | `removeHeader()` used instead of 
`removeProperty()` |
   
   ---
   
   ### Code Changes
   
   **File modified:** `OpenAIProducer.java` (+20 lines)
   
   | Area | Before | After |
   |------|--------|-------|
   | History reset | `in.removeHeader(...)` | `exchange.removeProperty(...)` |
   | User message tracking | Not stored | Saved as `PENDING_USER_MESSAGE` in 
`buildMessages()` |
   | History update | Assistant only | New helper 
`appendPendingUserMessageToHistory()` runs in all 3 update paths |
   
   **Files added (from Jira reproducers):**
   - `OpenAIConversationMemoryUserMessageTest.java`
   - `OpenAIConversationMemoryResetTest.java`
   
   ---
   
   ### Tests Passed
   
   | Test Class | What It Verifies | Result |
   |------------|------------------|--------|
   | `OpenAIConversationMemoryUserMessageTest` | Second turn includes previous 
user message (`"My name is Alice"`) | **PASSED** |
   | `OpenAIConversationMemoryResetTest` | `systemMessage` + 
`conversationMemory=true` clears stale history | **PASSED** |
   | `OpenAIProducerMcpMockTest#conversationMemoryIncludesToolCallChain` | 
Agentic MCP path still builds full tool-call history | **PASSED** |
   
   **Build:** `BUILD SUCCESS` — 3 tests, 0 failures
   
   ---
   
   ### Flow After Fix
   
   ```
   Turn 1:  user → API → history = [user, assistant]
   Turn 2:  history + new user → API → history = [user, assistant, user, 
assistant]
   Reset: systemMessage set → exchange property cleared → fresh history
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to