fix(gateway): use buffer_only mode for Photon to prevent streaming cursor tofu - #49815
Closed
liuhao1024 wants to merge 1 commit into
Closed
fix(gateway): use buffer_only mode for Photon to prevent streaming cursor tofu#49815liuhao1024 wants to merge 1 commit into
liuhao1024 wants to merge 1 commit into
Conversation
…rsor tofu iMessage renders the streaming cursor as a visible white-square artifact. Add Photon to the buffer_only platform check (alongside Matrix) so only the final plain-text message is delivered without intermediate cursor characters. Fixes NousResearch#49793
Closed
4 tasks
4 tasks
Closed
13 tasks
teknium1
reviewed
Jul 14, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for the focused Photon streaming fix. Current main still defaults Photon to editable behavior at gateway/run.py:16751-16756 and gateway/run.py:18079-18089, so the two affected stream-consumer construction sites remain live.
Problems
- The added comments say buffer-only mode produces a final plain-text-only message.
GatewayStreamConsumerstill flushes on segment breaks and commentary (gateway/stream_consumer.py:625-630), while Photon preserves markdown by default (plugins/platforms/photon/adapter.py:1384-1390,1481-1484).
Suggested changes
- Reword the two comments to describe cursor suppression and the absence of interval/threshold-driven updates, without promising forced plain text or universally final-only output.
The surrounding code has moved, but the two-hunk fix remains mechanically salvageable. Automated hermes-sweeper review.
| # streaming cursor as a visible tofu/white-box | ||
| # artifact. Suppress the cursor and use buffer-only | ||
| # mode so only the final plain-text message is sent. | ||
| if source.platform == Platform.MATRIX or getattr(source.platform, "value", "") == "photon": |
Contributor
There was a problem hiding this comment.
buffer_only suppresses interval/threshold flushes, but it still flushes on segment breaks and commentary; Photon also retains markdown by default. Please reword the surrounding comment to avoid promising a universally final-only plain-text message.
Contributor
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.
What does this PR do?
Adds Photon (iMessage) to the
buffer_onlystreaming mode check so the streaming cursor character is suppressed. Previously, the cursor rendered as a visible white-square/tofu artifact in iMessage bubbles.Related Issue
Fixes #49793
Type of Change
Changes Made
gateway/run.py: Add Photon to thebuffer_only=Truecondition in both streaming code paths (the_run_agentpath and the inline-streaming path), alongside the existing Matrix check. Usesgetattr(source.platform, "value", "") == "photon"since Photon is a plugin platform without an explicit enum member.tests/gateway/test_run_progress_topics.py: Addtest_run_agent_photon_streaming_buffer_onlyregression test verifying no streaming cursor artifact and no intermediate edits for Photon sessions.How to Test
pytest tests/gateway/test_run_progress_topics.py::test_run_agent_photon_streaming_buffer_only -xvspytest tests/gateway/test_run_progress_topics.py::test_run_agent_matrix_streaming_omits_cursor -xvs(regression: Matrix still works)pytest tests/gateway/test_stream_consumer.py::TestBufferOnlyMode -xvs(regression: buffer_only mode tests still pass)Checklist
Code
fix(scope):,feat(scope):, etc.)pytest tests/ -qand all tests passDocumentation & Housekeeping
docs/, docstrings) — or N/Acli-config.yaml.exampleif I added/changed config keys — or N/ACONTRIBUTING.mdorAGENTS.mdif I changed architecture or workflows — or N/ACode Intelligence
gateway/run.pylines 13947-13957 and 15114-15124 (streaming buffer_only logic)