fix: retain conversation context when generation is cancelled#25
Merged
quiet-node merged 1 commit intomainfrom Apr 4, 2026
Merged
fix: retain conversation context when generation is cancelled#25quiet-node merged 1 commit intomainfrom
quiet-node merged 1 commit intomainfrom
Conversation
Previously, clicking Stop discarded the user message and partial assistant response from the backend ConversationHistory. This caused the model to lose all context from the cancelled turn, making follow-up questions start from scratch. Remove the `!was_cancelled` guard from the persistence condition so cancelled turns are kept in the in-memory history. The epoch check still prevents stale writes after a reset. Signed-off-by: Logan Nguyen <lg.131.dev@gmail.com> Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com> Signed-off-by: Logan Nguyen <lg.131.dev@gmail.com>
This was referenced Apr 5, 2026
quiet-node
added a commit
that referenced
this pull request
Apr 10, 2026
Previously, clicking Stop discarded the user message and partial assistant response from the backend ConversationHistory. This caused the model to lose all context from the cancelled turn, making follow-up questions start from scratch. Remove the `!was_cancelled` guard from the persistence condition so cancelled turns are kept in the in-memory history. The epoch check still prevents stale writes after a reset. Signed-off-by: Logan Nguyen <lg.131.dev@gmail.com>
quiet-node
added a commit
that referenced
this pull request
Apr 10, 2026
Previously, clicking Stop discarded the user message and partial assistant response from the backend ConversationHistory. This caused the model to lose all context from the cancelled turn, making follow-up questions start from scratch. Remove the `!was_cancelled` guard from the persistence condition so cancelled turns are kept in the in-memory history. The epoch check still prevents stale writes after a reset. Signed-off-by: Logan Nguyen <lg.131.dev@gmail.com>
quiet-node
added a commit
that referenced
this pull request
Apr 11, 2026
Previously, clicking Stop discarded the user message and partial assistant response from the backend ConversationHistory. This caused the model to lose all context from the cancelled turn, making follow-up questions start from scratch. Remove the `!was_cancelled` guard from the persistence condition so cancelled turns are kept in the in-memory history. The epoch check still prevents stale writes after a reset. Signed-off-by: Logan Nguyen <lg.131.dev@gmail.com>
This was referenced Apr 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
ConversationHistory.!was_cancelledguard inask_ollamaprevented cancelled turns from being persisted to in-memory history, even though the frontend correctly displayed the partial response.!was_cancelledcheck so cancelled turns are retained in context. The epoch guard still prevents stale writes after a reset.Also verified that server-side request termination (Issue 1) already works correctly via
CancellationToken+tokio::select!+ HTTP connection drop.Test plan
bun run test:backend:coverage)bun run validate-buildclean (zero errors)🤖 Generated with Claude Code