fix(discord): add initiator to handoff threads - #26872
Closed
whirmill wants to merge 1 commit into
Closed
Conversation
teknium1
reviewed
Jul 13, 2026
teknium1
left a comment
Contributor
There was a problem hiding this comment.
Thanks for addressing Discord handoff discoverability. The underlying gap remains on current main: gateway/run.py:7501-7503 creates handoff threads without a member identity, and plugins/platforms/discord/adapter.py:5455-5531 has no membership step.
Problems
- The proposed
row.get("user_id")source cannot identify the normal CLI handoff initiator. Current agent-created rows explicitly useuser_id=Noneinrun_agent.py:600-608, and direct CLI row creation likewise omits it incli.py:7091-7099; the new kwargs would therefore be empty in the primary/handoffflow. - The added unit tests exercise only the adapter API. Add an end-to-end
_process_handofftest with a CLI-shaped row so the identity propagation is verified. - The Discord adapter moved from
gateway/platforms/discord.pytoplugins/platforms/discord/adapter.pyincc8e5ec2afbfd10a3cff4e710210dd9ecae64a33, so this needs a deliberate port.
Suggested changes
- Establish a reliable destination Discord user identity when the handoff is requested, persist it with the handoff request, then pass that explicit identity to the plugin adapter.
Automated hermes-sweeper review.
| @@ -3923,9 +3923,21 @@ async def _process_handoff(self, row: Dict[str, Any]) -> None: | |||
| # synthetic turn still lands; just without thread isolation. | |||
| thread_name = f"Hermes — {cli_title}" | |||
Contributor
There was a problem hiding this comment.
row["user_id"] is not populated for the normal CLI handoff flow: current agent-created rows pass user_id=None (run_agent.py:600-608) and CLI row creation omits it (cli.py:7091-7099). Persist a trustworthy destination Discord operator ID at request time, then test _process_handoff with that CLI-shaped row.
Contributor
Author
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
user_idsargument to handoff-thread creation so platforms with explicit thread membership APIs can include the initiating operator.thread.add_user(...)for explicit handoff initiators.Testing
python -m pytest tests/gateway/test_discord_send.py -o 'addopts=' -q272 passed