fix(discord): add home-channel owner to handoff thread (#67702) - #67801
fix(discord): add home-channel owner to handoff thread (#67702)#67801JonthanaHanh wants to merge 1 commit into
Conversation
/create_handoff_thread created a Discord thread but never added the destination user as a member. For private threads this made the thread completely invisible to the user. 1. Store owner_user_id in HomeChannel when /sethome runs 2. Pass owner_user_id through _process_handoff to create_handoff_thread 3. Discord adapter calls thread.add_user() after creation 4. Update base + Telegram + Slack signatures for forward compatibility Fixes NousResearch#67702
teknium1
left a comment
There was a problem hiding this comment.
Thanks for tracing the Discord handoff path; current main still has the missing-membership premise: gateway/run.py:8815-8817 calls the adapter without an identity, and plugins/platforms/discord/adapter.py:6430-6457 returns a created thread without adding one.
Problems
plugins/platforms/discord/adapter.py:6431-6437logs anadd_user()failure but still returns the thread ID.gateway/run.py:8825-8830then routes the synthetic handoff into that thread, preserving the reported "completed but invisible" failure mode.- Current main already persists
/sethomeidentity asHomeChannel.user_idandscope_id(gateway/config.py:434-462,gateway/slash_commands.py:2630-2644, commit45a408f41adc). The newowner_user_idduplicates that state. The member comment also identifies competing PR #65505's explicit per-handoff identity model; this needs one consolidated choice.
Suggested changes
- Rework the identity plumbing against the current
HomeChannelmodel after resolving the #65505 design choice. - Do not return a private-thread ID when its required member cannot be added.
- Add direct-create, fallback-create, and membership-failure regression tests.
Automated hermes-sweeper review.
| name: str # Human-readable name for display | ||
| thread_id: Optional[str] = None | ||
|
|
||
| owner_user_id: Optional[str] = None # user who ran /sethome |
There was a problem hiding this comment.
Current main already stores the /sethome source identity as HomeChannel.user_id (plus scope_id) and serializes both (gateway/config.py:434-462, commit 45a408f41adc). Please consolidate with that current model or with the explicit-initiator approach in #65505 rather than adding a parallel persisted owner field.
| member = await guild.fetch_member(int(owner_user_id)) | ||
| if member is not None: | ||
| await thread.add_user(member) | ||
| except Exception as add_exc: |
There was a problem hiding this comment.
If add_user() fails, returning thread.id still makes _process_handoff() target this private thread and mark the handoff complete. Return None or otherwise fail/fallback here so the original invisible-thread failure is not retained.
SummaryOne PR directly addresses #67702. #67801 carries the stored /sethome identity into Discord handoff-thread creation and calls add_user(), but its diff still returns the private-thread ID when membership addition fails and introduces owner_user_id alongside the identity fields documented on current main. Related pull requests
DuplicatesNo exact duplicate is established among the listed PRs; #67801 substantially overlaps #65505 on identity plumbing and Discord member addition, but they use different identity sources. Suggested consolidationKeep #67801 open with a salvage path: retain its handoff-path plumbing and Discord add_user() integration, but rework it against the existing HomeChannel identity model or explicitly consolidate the design with #65505, and return None or otherwise fail/fallback when member addition fails. This follows the visible keep_open review and preserves #67801 as the recorded best-fix candidate without treating its current diff as complete; no listed PR can presently be closed as a duplicate. Complex graphflowchart LR
classDef open fill:#dbeafe,stroke:#1d4ed8,color:#1e3a8a
classDef merged fill:#dcfce7,stroke:#15803d,color:#14532d
classDef closed fill:#e5e7eb,stroke:#6b7280,color:#1f2937
classDef unverified fill:#f3f4f6,stroke:#9ca3af,color:#374151
classDef best stroke-width:3px,stroke:#b45309
classDef target stroke-width:3px,stroke:#4338ca
I67702(["issue #67702 (open)"])
P67801["PR #67801 (open)"]
P67801 -->|best fix| I67702
class I67702 open
class P67801 open
class P67801 best
class P67801 target
click I67702 "https://github.com/NousResearch/hermes-agent/issues/67702"
click P67801 "https://github.com/NousResearch/hermes-agent/pull/67801"
Graph: solid arrow = fixes / best fix, dashed arrow = partial or unverified (see edge label); boxed group = PRs duplicating each other; amber border = best fix; indigo border = target; gray node = closed (state tag in the node label). Cross-PR triage: Reviewed 1 pull request and 1 issue in this complex. Each diff was read against this issue; Assessment working set: 9 kB of PR diffs, 7 kB of issue/PR text, 2 kB of discussion (5 comments), 2 verify verdicts. verdicts reflect diff content, not PR titles. Part of an automated triage batch. |
Problem
/handoff discordcreates a Discord thread but never adds the destination user as a member. For private threads (channel type 12), this makes the thread completely invisible to the user in the Discord client. The handoff reportscompletedbut the user has no way to see or enter the continuation thread.Two cooperating gaps:
create_handoff_thread()has nouser_idparameter -- the adapter can't add a member even if it wanted to_process_handoff()never passes the user who ran/sethometo the adapterFix
owner_user_idfield toHomeChannel. Populate it in the/sethomehandler fromsource.user_id.gateway/run.pypasseshome.owner_user_idtocreate_handoff_thread().thread.add_user(member)for the owner.owner_user_id(keyword-only, default None).Files Changed
gateway/config.py--HomeChannel: addowner_user_idfield + serializationgateway/slash_commands.py--/sethome: storesource.user_idgateway/platforms/base.py-- basecreate_handoff_threadsignatureplugins/platforms/discord/adapter.py-- add user to thread after creationplugins/platforms/telegram/adapter.py-- acceptowner_user_id(unused)plugins/platforms/slack/adapter.py-- acceptowner_user_id(unused)gateway/run.py-- passowner_user_idtocreate_handoff_threadFixes #67702