Prevent clearing of conversation memory after task completion and refine stop handler #1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR addresses two related concerns observed in conversation handling:
memory.pop
,memory = []
, etc.) from task completion handlers, ensuring that past conversation context is never lost, regardless of task transitions.Details
/api/askAI/stop
handler to set the conversation state toAWAITNG_USER_INPUT
(rather thanAWAIT_NEXT_TASK
or other terminal states), allowing smooth resumption of conversations without resetting or being blocked.session.memory
array. All such operations are eliminated. Results and inputs are now appended (usingpush
/insert
as appropriate) without deleting any prior history.Motivation
Previously, both user-initiated stops and certain task completions would remove memory items (via
pop
or similar), causing loss of history and breaking continuity for users. This often manifested as the bot being unable to recall previous messages or tasks after a stop or fresh start.This PR ensures conversation memory is truly persistent throughout a session—neither explicit stops nor task flows can prune earlier messages, guaranteeing accurate and expected recall for the user.
Testing
Summary
This change guarantees that session memory is preserved throughout the conversation lifecycle, improving user experience for all flows involving task stops and resumptions.