Skip to content

fix(photon): mark adapter as not supporting message editing to suppress streaming cursor - #62172

Closed
liuhao1024 wants to merge 1 commit into
NousResearch:mainfrom
liuhao1024:liuhao/cron-bugfix-49253
Closed

fix(photon): mark adapter as not supporting message editing to suppress streaming cursor#62172
liuhao1024 wants to merge 1 commit into
NousResearch:mainfrom
liuhao1024:liuhao/cron-bugfix-49253

Conversation

@liuhao1024

Copy link
Copy Markdown
Contributor

What does this PR do?

Photon (iMessage) has no real edit API for already-sent messages. When streaming completes, the gateway attempts to edit the message to remove the streaming cursor (▉). Without edit support, this cursor gets stuck in the final message, corrupting Unicode characters.

For example, "Dateien & Code — Lesen, schreiben, patchen, Git" becomes "Date ▉ ien & Code — Lesen, schreiben, patchen, Git" because the "▉" cursor character is embedded in the middle of multi-byte UTF-8 sequences.

This change sets SUPPORTS_MESSAGE_EDITING=False on PhotonAdapter, which causes the gateway to suppress the streaming cursor entirely for this platform (via _effective_cursor in gateway/run.py:16695). This prevents the stale tofu square (▉) from appearing in streamed iMessage responses.

The fix follows the same pattern used by Signal, BlueBubbles, WeChat, and WeCom adapters—platforms without edit support mark themselves explicitly so the gateway knows to avoid cursor-dependent streaming behavior.

Related Issue

Fixes #49253

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)

Changes Made

  • plugins/platforms/photon/adapter.py: Added SUPPORTS_MESSAGE_EDITING = False class attribute with explanatory comment
  • tests/plugins/platforms/photon/test_streaming.py: Added regression test to ensure the attribute remains False

How to Test

  1. Run the new test: pytest tests/plugins/platforms/photon/test_streaming.py -v — should pass
  2. Verify gateway honors the attribute: when streaming to Photon, no cursor (▉) is added to interim edits (gateway/run.py:16695 sets _effective_cursor = "" for non-editing platforms)
  3. Manual verification (requires Photon iMessage setup):
    • hermes photon setup — connect Photon iMessage
    • Send any message to the agent's iMessage number
    • Trigger a response containing bold text with non-ASCII characters (e.g., German "Dateien & Code")
    • Verify the final message shows "Dateien & Code" without the ▉ character

Observed result: With this fix, streaming responses on Photon iMessage no longer leave a stale ▉ cursor in the final message.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/plugins/platforms/photon/test_streaming.py -v and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: N/A (requires Photon iMessage hardware)

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A (no user-facing docs needed for internal attribute)
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — change only affects Photon adapter, no cross-platform impact
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

…ss streaming cursor

Photon (iMessage) has no real edit API for already-sent messages. When
streaming completes, the gateway attempts to edit the message to remove
the streaming cursor (▉). Without edit support, this cursor gets stuck
in the final message, corrupting Unicode characters.

This change sets SUPPORTS_MESSAGE_EDITING=False on PhotonAdapter, which
causes the gateway to suppress the streaming cursor entirely for this
platform (via _effective_cursor in gateway/run.py). This prevents the
stale tofu square (▉) from appearing in streamed iMessage responses.

Fixes NousResearch#49253
@alt-glitch alt-glitch added type/bug Something isn't working comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages labels Jul 10, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

This was generated by AI during triage.

Related: #49815 (open PR adding Photon to the gateway buffer_only=True set) and #49793 (open issue, same iMessage tofu-cursor symptom). This PR takes a different mechanism -- declaring SUPPORTS_MESSAGE_EDITING = False on the adapter so the gateway suppresses the streaming cursor via _effective_cursor -- rather than the buffer_only branch in gateway/run.py. Cross-linking so a maintainer can pick one (or both); not marking either duplicate.

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the focused Photon capability fix. I found no blocking issue.

  • PhotonAdapter has no edit_message() override (plugins/platforms/photon/adapter.py:1083), so it inherits the unsupported base implementation (gateway/platforms/base.py:2945-2972).
  • Current main defaults a missing SUPPORTS_MESSAGE_EDITING attribute to editable before constructing the stream consumer (gateway/run.py:17958); setting the flag to False reaches the existing non-editable-platform guard at gateway/run.py:17959-17960.
  • The adapter-level regression test matches established capability-contract coverage for Signal, BlueBubbles, and Weixin.

Automated hermes-sweeper review.

@teknium1

Copy link
Copy Markdown
Contributor

Merged via #73560 — cherry-picked with authorship preserved. The capability-flag approach was exactly right (matches BlueBubbles/Signal/WeCom convention) and fixes the stuck streaming-cursor tofu. This also supersedes your earlier #49815.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/streaming Streaming responses: gateway delivery, provider wire comp/gateway Gateway runner, session dispatch, delivery P2 Medium — degraded but workaround exists sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Photon iMessage: Markdown Bold-Formatting corrupts Unicode (▉ replacement char)

3 participants