Cody: Bot response multiplexer publishes, then completes turns #70
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.
The LLM interaction pushes text to the bot response multiplexer without waiting for the publishing to complete. If the turn ends before publishing is complete, the half-parsed buffer is echoed as-is. The net effect is that
</selection>
closing tags from fixups are sometimes echoed to the output.This fixes the problem by chaining a promise for the publications together and waits for them to complete before doing the "turn complete" processing.
Test plan
cd client/cody-shared && pnpm test
Manual test:
This is racy, but you should use Fixup from Inline Instructions, Fixup (Experimental), etc. and check that the word
</selection>
does not appear in the output.