Skip to content

fix(simplex): extract group sender from chatDir.groupMember - #35046

Open
brandon-btcgroup wants to merge 1 commit into
NousResearch:mainfrom
brandon-btcgroup:fix/simplex-group-sender
Open

fix(simplex): extract group sender from chatDir.groupMember#35046
brandon-btcgroup wants to merge 1 commit into
NousResearch:mainfrom
brandon-btcgroup:fix/simplex-group-sender

Conversation

@brandon-btcgroup

Copy link
Copy Markdown

What does this PR do?

Fixes group-message sender extraction in the SimpleX Chat platform adapter
(plugins/platforms/simplex/adapter.py).

For group messages, current simplex-chat reports the sending member under
chatItem.chatDir.groupMember. The adapter only read the legacy
chatItem.chatItemMember key, which is absent in this payload shape. As a
result sender_id fell back to the chat_id (e.g. "group:1") — which is
never a real member id — and downstream allowlist matching fails, so the
bot can't identify who sent a group message even when delivery otherwise works.

The fix reads chatDir.groupMember first and falls back to chatItemMember
for older daemon payloads, and resolves the display name via memberProfile
when the member object doesn't carry it directly.

Related Issue

Related to #30150, which documents three other SimpleX adapter bugs (missing
/_start subscribe, newChatItems resp-nesting, and /_send command syntax).
This PR addresses a fourth, independent bug — sender extraction — that is
not tracked by that issue. Happy to open a dedicated issue if maintainers
prefer one on file.

Fixes #35045

Type of Change

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

Changes Made

  • plugins/platforms/simplex/adapter.py — read the group sender from
    chatItem.chatDir.groupMember, falling back to the legacy
    chatItem.chatItemMember; resolve displayName via memberProfile.
  • tests/gateway/test_simplex_plugin.py — add
    test_group_sender_from_chatdir_groupmember asserting the correct
    memberId/display name are extracted from the chatDir.groupMember layout.

How to Test

  1. Run a simplex-chat daemon and join the bot to a group.
  2. Send a group message from a phone and observe the inbound event: the member
    lives under chatItem.chatDir.groupMember (no chatItemMember key present).
  3. Before: sender_id resolves to the chat_id ("group:<n>"), so the
    member is unidentifiable and allowlist checks against the real memberId
    fail. After: sender_id is the member's base64 memberId and the
    display name resolves correctly.
  4. Unit test: scripts/run_tests.sh tests/gateway/test_simplex_plugin.py
    (28 passing here, incl. the new regression test).

Note: reproducing the full phone→reply round-trip on a vanilla daemon also
requires the three fixes in #26433 (without /_start, no events arrive at
all). The added unit test exercises the sender-parsing path in isolation, so
it stands on its own. Verified end-to-end on a live Ubuntu 24.04 deployment
with the #26433 fixes applied — correct memberId + display name extracted.

Relationship to existing PRs (duplicate check)

I searched open PRs before submitting:

If maintainers would rather fold this single change into #26433 or one of the
feature PRs, I'm happy to close this and move the diff there.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(simplex): …)
  • I searched for existing PRs to make sure this isn't a duplicate (see above)
  • My PR contains only changes related to this fix (one commit, two files)
  • I've run the test suite via scripts/run_tests.sh — SimpleX plugin suite 28/28 pass. The full suite has some failures, but they are pre-existing on unmodified main (anthropic adapter, gateway service/WSL/systemd, TUI — environment-specific on macOS) and confirmed unrelated to this change; this PR introduces no new failures.
  • I've added tests for my changes
  • I've tested on my platform: Ubuntu 24.04 (live deployment) + macOS (unit tests)

Documentation & Housekeeping

  • Docs — N/A (internal parsing fix, no user-facing surface)
  • cli-config.yaml.example — N/A (no config keys changed)
  • CONTRIBUTING.md / AGENTS.md — N/A
  • Cross-platform impact considered — N/A (pure dict parsing)
  • Tool descriptions/schemas — N/A

For group messages, current simplex-chat reports the sending member under
`chatItem.chatDir.groupMember`. The adapter only read the legacy
`chatItem.chatItemMember` key, which is absent in this payload shape, so
`sender_id` fell back to the chat_id (e.g. "group:1") — not a real member.
Downstream allowlist matching then failed, since the chat_id is never a
valid user id.

Read `chatDir.groupMember` first and fall back to `chatItemMember` for
older daemon payloads. Also resolve the display name via `memberProfile`
when the member object doesn't carry it directly.

Verified end-to-end against a live simplex-chat daemon: the correct
base64 memberId and display name are now extracted for inbound group
messages. Adds a regression test asserting sender extraction from the
chatDir.groupMember layout.
brandon-btcgroup added a commit to brandon-btcgroup/hermes-agent that referenced this pull request May 30, 2026
…ening

Adds a 2026-05-29 part-2 update: sender fix upstreamed as issue NousResearch#35045 / PR
NousResearch#35046; rationale for NOT opening a group-send PR (already covered by
NousResearch#4666/NousResearch#27978 with a more robust json form); production branch hardened to
the /_send <ref> json form (commit d31a043) to stop multi-line reply
truncation; and a rebase note for the eventual NousResearch#26433 merge conflict.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/plugins Plugin system and bundled plugins comp/gateway Gateway runner, session dispatch, delivery labels May 30, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Thanks for isolating the sender-parsing compatibility case.

Problems

  • The diff targets _handle_new_chat_item, but current main moved inbound parsing to _handle_chat_item (plugins/platforms/simplex/adapter.py:472) in 0c2e81df0. The proposed implementation and its direct test call therefore need to be transplanted rather than applied verbatim.
  • Current main already implements the test's chatDir.groupMember + memberProfile.displayName case at plugins/platforms/simplex/adapter.py:526-530. The remaining contribution is the legacy chatItemMember fallback, but the PR adds no regression coverage for that path.

Suggested changes

  • Apply the fallback in the current group branch beginning at plugins/platforms/simplex/adapter.py:526.
  • Test it through _handle_chat_item using a received-message payload and configured group allowlist, asserting the legacy member object supplies both source ID and display name.

Automated hermes-sweeper review.

@teknium1 teknium1 added sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/gateway Gateway runner, session dispatch, delivery comp/plugins Plugin system and bundled plugins P3 Low — cosmetic, nice to have sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-security-boundary Sweeper risk: may affect sandboxing, auth, credentials, or sensitive data type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

SimpleX adapter: group sender read from chatItemMember instead of chatDir.groupMember

3 participants