fix(matrix): remove forced buffer_only streaming to enable progressive m.replace edits - #58770
Closed
Kewe63 wants to merge 1 commit into
Closed
fix(matrix): remove forced buffer_only streaming to enable progressive m.replace edits#58770Kewe63 wants to merge 1 commit into
Kewe63 wants to merge 1 commit into
Conversation
…e m.replace edits Matrix gateway was forcing buffer_only=True for all Matrix platform streaming, which silently disabled progressive m.replace edits. The consumer only delivered final/split messages, never mid-stream edits — even though direct Matrix API m.replace calls and the GatewayStreamConsumer with buffer_only=False (fake adapter) both work correctly. The buffer_only guard was added in NousResearch#10860 ("make buffered streaming") as a defensive measure during the E2EE/migration fix batch. This change removes the forced buffer_only=True from both stream consumer instantiation sites (proxy path and delta/error consumer path), reverting Matrix to progressive edit streaming like other platforms (Discord, Slack, etc.). Cursor suppression (_effective_cursor="") is preserved to avoid the visible tofu/white-box artifact on some Matrix clients. Fixes NousResearch#58728
Collaborator
Related: #58728 (the issue this fixes) and the Matrix streaming-delivery family #41090 / #37931 / #49815 / #57091 (same area, different mechanisms). Heads up for reviewers: the live diff on this PR is a whole-fork push (1285 files, +22k/-130k, currently CONFLICTING). The actual described fix is tiny — removing the two |
4 tasks
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
Matrix gateway was sending only final/split
m.room.messageevents — zerom.replace(m.relates_to.rel_type == "m.replace") edits, despite streaming being enabled both globally and for the Matrix platform. Long answers arrived as monolithic messages instead of progressive live updates (#58728).Control tests confirmed the individual pieces worked:
m.replaceedits work in the test room.GatewayStreamConsumerwithbuffer_only=Falseproduces edits with a fake adapter.Root Cause
gateway/run.pyforcedbuffer_only = Trueexclusively for Matrix at both stream consumer instantiation sites:Proxy/SSE path (line ~15018):
Delta/error consumer path (line ~16207):
buffer_only = TruemakesGatewayStreamConsumerskip the interval/threshold flush path (onlygot_done/segment_break/ commentary trigger edits), effectively making Matrix final/split-only.This guard was added in #10860 ("make buffered streaming") as a defensive measure during the E2EE/migration fix batch.
Fix
Remove both
_buffer_only = Truelines. The_buffer_onlydefault (False) already set above remains active. Cursor suppression (_effective_cursor = "") is preserved — some Matrix clients render the cursor as a tofu/white-box artifact.Matrix now receives progressive
m.replaceedits like other platforms (Discord, Slack, etc.).How to Test
Checklist
_effective_cursor = "")Risk & Impact
Low. Two-line removal — the
_buffer_onlydefault (False) was already set above both removed lines. No logic is added; the guard that was suppressing progressive edits is simply removed. All other platforms are unaffected. The pre-existing markdown table test failure is unrelated and also fails on current main.Type: 🐛 Bug fix
Closes: #58728