fix(component): abort in-flight generation when its message is deleted - #324
Open
robelest wants to merge 1 commit into
Open
fix(component): abort in-flight generation when its message is deleted#324robelest wants to merge 1 commit into
robelest wants to merge 1 commit into
Conversation
Deleting a message stranded any generation still writing to its order. deleteMessage removed the row, its embedding and file refcounts, but left the run going, so the failure only surfaced later as a missing-parent assert when that generation finalized. Every piece of teardown already existed and was simply never invoked: aborting the stream makes the next addDelta return false, which aborts the DeltaStreamer, whose signal is the model stream's abortSignal. Extract abortStreamsAtOrder from the abortByOrder mutation and call it from deleteByIds and deleteByOrder, deduped per thread and order. Non-streaming generations have no stream row to abort and still assert on finalize. Refs #300.
commit: |
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.
Refs #300.
deleteMessagedeletes the row, its embedding, and its file refcounts. It doesn't touch a generation that's still writing to that order, so the run carries on against a message that no longer exists and blows up at finalize withParent message ... not found.Aborting the stream is enough to stop the run, and that path already works end to end:
Nothing was calling it on delete. So: pull
abortStreamsAtOrderout of theabortByOrdermutation, have that mutation delegate to it, and call it fromdeleteByIdsanddeleteByOrderonce per thread and order.The issue suggested dropping the assert and saving the output at
getMaxMessageorder instead.ordercomes frompromptMessage.order, and once the prompt is gone there's nothing sensible to anchor to — you'd be attaching stale output to whatever turn happened since. Stopping the run early means there's no output left to place.generateTextwithout streaming has no stream row, so it still asserts on finalize. Only the streaming path is covered here.