Label unnamed shared-session participants - #44705
Conversation
|
Verified clean — shared session participant labeling Reviewed the diff across
No findings. |
|
Thanks for the thorough verification @liuhao1024 — that write-up matches the implementation exactly, and I appreciate the injection-prevention check in particular. Re-confirmed today (2026-07-11) at the current head (c55ce3d4): Ready for a maintainer merge whenever it fits. |
teknium1
left a comment
There was a problem hiding this comment.
Thanks for addressing the real unnamed-participant gap: current main only prefixes a shared turn when source.user_name is present (gateway/run.py:10388-10389).
Problems
- The new fallback at
gateway/run.py:7627also applies to Yuanbao group turns. Yuanbao builds a source withuser_idandthread_id="main"(gateway/platforms/yuanbao.py:2010-2016), then deliberately preformats the message as[nickname|user_id]and clears onlyuser_nameto suppress the runner prefix (gateway/platforms/yuanbao.py:2160-2164). The fallback will therefore add[user_<hash>]before that existing label.
Suggested changes
- Preserve an explicit no-second-prefix signal for already-attributed adapter messages while retaining the opaque-ID fallback for ordinary shared turns.
- Add a Yuanbao group/thread regression proving the message remains singly attributed.
Automated hermes-sweeper review.
| if _is_shared_multi_user and source.user_name: | ||
| message_text = f"[{source.user_name}] {message_text}" | ||
| if _is_shared_multi_user: | ||
| sender_label = shared_participant_label(source) |
There was a problem hiding this comment.
This fallback also defeats Yuanbao's intentional suppression: its group middleware preformats [nickname|user_id] and clears only source.user_name to prevent the runner prefix (gateway/platforms/yuanbao.py:2160-2164), while retaining user_id. This will now produce [user_<hash>] [nickname|user_id] ...; preserve an explicit already-attributed/no-prefix path and add a regression.
c55ce3d to
7b2564f
Compare
Summary
[label]prefixes so aliases stay single-line and bracket-safe[sender name]to[sender label]omar@kostudios.ioinscripts/release.pyso contributor attribution CI can resolve the PR authorVerification
python3 -m pytest tests/gateway/test_shared_group_sender_prefix.py tests/gateway/test_session.py tests/tui_gateway/test_protocol.py -q(144 passed)python3 -m compileall -q scripts/release.py gateway/session.py gateway/run.py tests/gateway/test_shared_group_sender_prefix.py tests/tui_gateway/test_protocol.pyuv tool run ruff check scripts/release.py gateway/session.py gateway/run.py tests/gateway/test_shared_group_sender_prefix.py tests/gateway/test_session.py tests/tui_gateway/test_protocol.pygit diff --checkgit diff upstream/main -- gateway/session.py gateway/run.py tests/gateway/test_shared_group_sender_prefix.py tests/gateway/test_session.py tests/tui_gateway/test_protocol.py scripts/release.py | rg -n "discord|Discord|telegram|Telegram"(no matches)Risk
The behavior change is limited to shared multi-user sessions. Per-user isolated sessions keep their existing plain inbound message behavior, and raw sender IDs are not exposed in the fallback label. Display aliases are preserved after whitespace/bracket normalization.