fix(simplex): make websocket handling reliable - #26480
Conversation
|
fwiw on the group-send line here (the websocket-reliability work is separate — In my own deployment I went with the numeric-id structured form instead —
Sharing in case it's useful for the send path; the reconnect/reliability |
teknium1
left a comment
There was a problem hiding this comment.
Thank you for the reliability work. Current main still has a concrete nested singular-event gap: _handle_event passes newChatItem directly to _handle_chat_item (plugins/platforms/simplex/adapter.py:434), while that handler reads chatInfo only at the top level (plugins/platforms/simplex/adapter.py:472-477).
Problems
- The group-send hunk at
plugins/platforms/simplex/adapter.py:798changes stable numeric group routing to a display-name command. Current main intentionally uses/_send #<id> json ...(plugins/platforms/simplex/adapter.py:833-843), and its regression test records why: display-name lookup can silently drop messages and JSON preserves multiline content (tests/gateway/test_simplex_plugin.py:231-253). This also matches the supplied review comment. - The adapter has been substantially refactored since this PR: current main uses
_handle_chat_itemand_send_commandcorrelation handling (plugins/platforms/simplex/adapter.py:370-475,758-795). The patch needs selective integration rather than direct application.
Suggested changes
- Port only the nested
newChatItemnormalization into the current dispatch path and add its regression test. - Preserve numeric
group:<id>identities and structured group sends.
Automated hermes-sweeper review.
| @@ -505,17 +796,19 @@ async def send( | |||
| corr_id = self._make_corr_id() | |||
|
|
|||
| if chat_id.startswith("group:"): | |||
There was a problem hiding this comment.
Please retain numeric group IDs and the structured /_send #<id> json ... form here. Current main documents and tests that name-based group commands can resolve ambiguously or silently drop, while the JSON form also preserves multiline content (tests/gateway/test_simplex_plugin.py:231-253).
Singular newChatItem events (and some newChatItems array elements) nest
the AChatItem one level down ({type: newChatItem, chatItem: {chatInfo,
chatItem}}), but _handle_chat_item only reads chatInfo/chatItem at the
top level, so those messages were silently dropped.
Port only the nested-wrapper normalization from the original branch into
the current dispatch, per review: _normalize_chat_item_wrapper unwraps
the nested AChatItem form, maps the {chatInfo, item} field-name variant,
and passes already-normalized wrappers through untouched. Applied in
_handle_event for both event shapes and idempotently at the top of
_handle_chat_item so the deferred rcvFileComplete replay path is covered
too.
Group routing is unchanged: numeric group IDs with the structured
/_send #<id> json form (display-name commands can resolve ambiguously
or silently drop, and plain commands truncate multiline content).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LJcz6L6JJWpQv5FrTBz6J1
e555d8b to
c92e84e
Compare
|
@teknium1 Rewrote the branch on current main per your review (force-pushed as a single commit):
Everything else from the original branch (catch-up, dedupe, health-check ping, ephemeral send fallback, display-name addressing) is dropped as superseded by the adapter refactor on main. |
Summary
Test plan
Local validation