fix(gateway): handoffs fail closed and load secrets off-loop; Discord slash commands honor profile_routes (#97693 #100014 #69178 #91633, salvage #97694 #100049) - #101247
Merged
Conversation
૮ >ﻌ< ა ci reviewran on 8c1ca9b — fix(discord): native slash commands honor guild/channel prof
|
teknium1
force-pushed
the
salvage/mux-handoff-discord-slash
branch
from
September 2, 2026 12:44
06cddef to
496bfb5
Compare
…g cannot load _process_handoff caught a config load failure for a secondary profile, logged a warning, and kept going with self.config, which is the primary profile's config. The handoff then went out through the right bot to the primary's home channel and the row was reported completed. That is the exact wrong delivery the multi-profile handoff work exists to prevent, and the same fail closed posture the no-live-adapters branch already takes. A load failure now logs an error and raises, which marks the row failed so the CLI can report and retry it. The default profile path is untouched, it never reloaded config.
The handoff watcher entered _profile_runtime_scope synchronously on the event loop each tick; hydrate_profile_secret_sources + build_profile_secret_scope do blocking file/secret-source IO, so a slow profile secret read stalled every adapter (#100014). Load the secret scope via asyncio.to_thread, then enter the existing sync scope with prepared_secret_scope=. Fixes #100014 Co-authored-by: Tranquil-Flow <66773372+Tranquil-Flow@users.noreply.github.com>
Same class as the handoff watcher (#100014): the secondary/primary message handlers and the scoped inbound-preprocess hop entered _profile_runtime_scope synchronously on the loop thread, so a slow profile .env read or external secret-source hydration stalled every other adapter's traffic. Route those three async sites through _async_profile_runtime_scope (asyncio.to_thread load, then the existing sync scope with prepared_secret_scope=). _format_session_info_scoped is already called via asyncio.to_thread and stays sync.
_build_slash_event and _dispatch_thread_session built their SessionSource without guild_id/parent_chat_id, while on_message passes both. Route matching in build_source keys off exactly those fields, so under gateway.multiplex_profiles a guild- or channel-routed profile never matched a native slash command: /new, /reset, /model, /profile, /status ... all ran against the default profile and reset the wrong session (#69178, #91633). Pass guild_id (interaction.guild_id, falling back to channel.guild like the message path) and the thread's parent channel id into build_source at both sites. One test pins channel + thread routing parity with messages. Fixes #69178 Fixes #91633 Co-authored-by: Sora-bluesky <179361977+Sora-bluesky@users.noreply.github.com> Co-authored-by: jondgilbert <42873618+jondgilbert@users.noreply.github.com> Co-authored-by: tensorbit89-netizen <257030052+tensorbit89-netizen@users.noreply.github.com>
teknium1
force-pushed
the
salvage/mux-handoff-discord-slash
branch
from
September 2, 2026 12:45
496bfb5 to
8c1ca9b
Compare
This was referenced Sep 2, 2026
vKongv
added a commit
to pebble-tech/hermes-agent
that referenced
this pull request
Sep 6, 2026
NousResearch#25119, NousResearch#85355, and NousResearch#90058 closed without merge. Tekium salvage PRs NousResearch#82162, NousResearch#101247, and NousResearch#101242 cover those gaps on upstream main.
vKongv
added a commit
to pebble-tech/hermes-agent
that referenced
this pull request
Sep 6, 2026
NousResearch#25119, NousResearch#85355, and NousResearch#90058 closed without merge. Tekium salvage PRs NousResearch#82162, NousResearch#101247, and NousResearch#101242 cover those gaps on upstream main.
vKongv
added a commit
to pebble-tech/hermes-agent
that referenced
this pull request
Sep 6, 2026
NousResearch#25119, NousResearch#85355, and NousResearch#90058 closed without merge. Tekium salvage PRs NousResearch#82162, NousResearch#101247, and NousResearch#101242 cover those gaps on upstream main.
cursor Bot
pushed a commit
to pebble-tech/hermes-agent
that referenced
this pull request
Sep 21, 2026
NousResearch#25119, NousResearch#85355, and NousResearch#90058 closed without merge. Tekium salvage PRs NousResearch#82162, NousResearch#101247, and NousResearch#101242 cover those gaps on upstream main.
cursor Bot
pushed a commit
to pebble-tech/hermes-agent
that referenced
this pull request
Sep 22, 2026
NousResearch#25119, NousResearch#85355, and NousResearch#90058 closed without merge. Tekium salvage PRs NousResearch#82162, NousResearch#101247, and NousResearch#101242 cover those gaps on upstream main.
cursor Bot
pushed a commit
to pebble-tech/hermes-agent
that referenced
this pull request
Sep 23, 2026
NousResearch#25119, NousResearch#85355, and NousResearch#90058 closed without merge. Tekium salvage PRs NousResearch#82162, NousResearch#101247, and NousResearch#101242 cover those gaps on upstream main.
vKongv
added a commit
to pebble-tech/hermes-agent
that referenced
this pull request
Sep 24, 2026
NousResearch#25119, NousResearch#85355, and NousResearch#90058 closed without merge. Tekium salvage PRs NousResearch#82162, NousResearch#101247, and NousResearch#101242 cover those gaps on upstream main.
vKongv
added a commit
to pebble-tech/hermes-agent
that referenced
this pull request
Sep 24, 2026
NousResearch#25119, NousResearch#85355, and NousResearch#90058 closed without merge. Tekium salvage PRs NousResearch#82162, NousResearch#101247, and NousResearch#101242 cover those gaps on upstream main.
vKongv
added a commit
to pebble-tech/hermes-agent
that referenced
this pull request
Sep 24, 2026
NousResearch#25119, NousResearch#85355, and NousResearch#90058 closed without merge. Tekium salvage PRs NousResearch#82162, NousResearch#101247, and NousResearch#101242 cover those gaps on upstream main.
vKongv
added a commit
to pebble-tech/hermes-agent
that referenced
this pull request
Sep 24, 2026
NousResearch#25119, NousResearch#85355, and NousResearch#90058 closed without merge. Tekium salvage PRs NousResearch#82162, NousResearch#101247, and NousResearch#101242 cover those gaps on upstream main.
vKongv
added a commit
to pebble-tech/hermes-agent
that referenced
this pull request
Sep 24, 2026
NousResearch#25119, NousResearch#85355, and NousResearch#90058 closed without merge. Tekium salvage PRs NousResearch#82162, NousResearch#101247, and NousResearch#101242 cover those gaps on upstream main.
vKongv
added a commit
to pebble-tech/hermes-agent
that referenced
this pull request
Sep 24, 2026
NousResearch#25119, NousResearch#85355, and NousResearch#90058 closed without merge. Tekium salvage PRs NousResearch#82162, NousResearch#101247, and NousResearch#101242 cover those gaps on upstream main.
cursor Bot
pushed a commit
to pebble-tech/hermes-agent
that referenced
this pull request
Sep 27, 2026
NousResearch#25119, NousResearch#85355, and NousResearch#90058 closed without merge. Tekium salvage PRs NousResearch#82162, NousResearch#101247, and NousResearch#101242 cover those gaps on upstream main.
vKongv
added a commit
to pebble-tech/hermes-agent
that referenced
this pull request
Sep 28, 2026
NousResearch#25119, NousResearch#85355, and NousResearch#90058 closed without merge. Tekium salvage PRs NousResearch#82162, NousResearch#101247, and NousResearch#101242 cover those gaps on upstream main.
vKongv
added a commit
to pebble-tech/hermes-agent
that referenced
this pull request
Sep 28, 2026
NousResearch#25119, NousResearch#85355, and NousResearch#90058 closed without merge. Tekium salvage PRs NousResearch#82162, NousResearch#101247, and NousResearch#101242 cover those gaps on upstream main.
vKongv
added a commit
to pebble-tech/hermes-agent
that referenced
this pull request
Sep 28, 2026
NousResearch#25119, NousResearch#85355, and NousResearch#90058 closed without merge. Tekium salvage PRs NousResearch#82162, NousResearch#101247, and NousResearch#101242 cover those gaps on upstream main.
vKongv
added a commit
to pebble-tech/hermes-agent
that referenced
this pull request
Sep 28, 2026
NousResearch#25119, NousResearch#85355, and NousResearch#90058 closed without merge. Tekium salvage PRs NousResearch#82162, NousResearch#101247, and NousResearch#101242 cover those gaps on upstream main.
vKongv
added a commit
to pebble-tech/hermes-agent
that referenced
this pull request
Sep 28, 2026
NousResearch#25119, NousResearch#85355, and NousResearch#90058 closed without merge. Tekium salvage PRs NousResearch#82162, NousResearch#101247, and NousResearch#101242 cover those gaps on upstream main.
vKongv
added a commit
to pebble-tech/hermes-agent
that referenced
this pull request
Sep 28, 2026
NousResearch#25119, NousResearch#85355, and NousResearch#90058 closed without merge. Tekium salvage PRs NousResearch#82162, NousResearch#101247, and NousResearch#101242 cover those gaps on upstream main.
vKongv
added a commit
to pebble-tech/hermes-agent
that referenced
this pull request
Sep 29, 2026
NousResearch#25119, NousResearch#85355, and NousResearch#90058 closed without merge. Tekium salvage PRs NousResearch#82162, NousResearch#101247, and NousResearch#101242 cover those gaps on upstream main.
vKongv
added a commit
to pebble-tech/hermes-agent
that referenced
this pull request
Sep 29, 2026
NousResearch#25119, NousResearch#85355, and NousResearch#90058 closed without merge. Tekium salvage PRs NousResearch#82162, NousResearch#101247, and NousResearch#101242 cover those gaps on upstream main.
vKongv
added a commit
to pebble-tech/hermes-agent
that referenced
this pull request
Sep 29, 2026
NousResearch#25119, NousResearch#85355, and NousResearch#90058 closed without merge. Tekium salvage PRs NousResearch#82162, NousResearch#101247, and NousResearch#101242 cover those gaps on upstream main.
vKongv
added a commit
to pebble-tech/hermes-agent
that referenced
this pull request
Sep 29, 2026
NousResearch#25119, NousResearch#85355, and NousResearch#90058 closed without merge. Tekium salvage PRs NousResearch#82162, NousResearch#101247, and NousResearch#101242 cover those gaps on upstream main.
vKongv
added a commit
to pebble-tech/hermes-agent
that referenced
this pull request
Sep 29, 2026
NousResearch#25119, NousResearch#85355, and NousResearch#90058 closed without merge. Tekium salvage PRs NousResearch#82162, NousResearch#101247, and NousResearch#101242 cover those gaps on upstream main.
vKongv
added a commit
to pebble-tech/hermes-agent
that referenced
this pull request
Sep 29, 2026
NousResearch#25119, NousResearch#85355, and NousResearch#90058 closed without merge. Tekium salvage PRs NousResearch#82162, NousResearch#101247, and NousResearch#101242 cover those gaps on upstream main.
vKongv
added a commit
to pebble-tech/hermes-agent
that referenced
this pull request
Sep 30, 2026
NousResearch#25119, NousResearch#85355, and NousResearch#90058 closed without merge. Tekium salvage PRs NousResearch#82162, NousResearch#101247, and NousResearch#101242 cover those gaps on upstream main.
vKongv
added a commit
to pebble-tech/hermes-agent
that referenced
this pull request
Sep 30, 2026
NousResearch#25119, NousResearch#85355, and NousResearch#90058 closed without merge. Tekium salvage PRs NousResearch#82162, NousResearch#101247, and NousResearch#101242 cover those gaps on upstream main.
vKongv
added a commit
to pebble-tech/hermes-agent
that referenced
this pull request
Sep 30, 2026
NousResearch#25119, NousResearch#85355, and NousResearch#90058 closed without merge. Tekium salvage PRs NousResearch#82162, NousResearch#101247, and NousResearch#101242 cover those gaps on upstream main.
vKongv
added a commit
to pebble-tech/hermes-agent
that referenced
this pull request
Sep 30, 2026
NousResearch#25119, NousResearch#85355, and NousResearch#90058 closed without merge. Tekium salvage PRs NousResearch#82162, NousResearch#101247, and NousResearch#101242 cover those gaps on upstream main.
vKongv
added a commit
to pebble-tech/hermes-agent
that referenced
this pull request
Sep 30, 2026
NousResearch#25119, NousResearch#85355, and NousResearch#90058 closed without merge. Tekium salvage PRs NousResearch#82162, NousResearch#101247, and NousResearch#101242 cover those gaps on upstream main.
vKongv
added a commit
to pebble-tech/hermes-agent
that referenced
this pull request
Sep 30, 2026
NousResearch#25119, NousResearch#85355, and NousResearch#90058 closed without merge. Tekium salvage PRs NousResearch#82162, NousResearch#101247, and NousResearch#101242 cover those gaps on upstream main.
vKongv
added a commit
to pebble-tech/hermes-agent
that referenced
this pull request
Oct 1, 2026
NousResearch#25119, NousResearch#85355, and NousResearch#90058 closed without merge. Tekium salvage PRs NousResearch#82162, NousResearch#101247, and NousResearch#101242 cover those gaps on upstream main.
vKongv
added a commit
to pebble-tech/hermes-agent
that referenced
this pull request
Oct 1, 2026
NousResearch#25119, NousResearch#85355, and NousResearch#90058 closed without merge. Tekium salvage PRs NousResearch#82162, NousResearch#101247, and NousResearch#101242 cover those gaps on upstream main.
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
Three multiplex-gateway bugs in one branch: a secondary-profile handoff whose config failed to load silently delivered through the primary's home channel; the handoff watcher (and per-message handlers) entered the profile secret scope synchronously on the event loop, stalling every adapter during slow secret reads; and native Discord slash commands built their SessionSource without guild_id/parent_chat_id, so guild/channel profile_routes never matched and /new, /reset, /model, /status ran against the default profile.
Changes
_process_handoff: config-load failure → error + raise (row marked failed) instead of falling back toself.config(fix(gateway): fail closed when a secondary profile handoff cannot load its config #97694, @Adolanium, cherry-picked)._load_profile_secret_scope+_async_profile_runtime_scope: secret scope loaded viaasyncio.to_thread, then the existing sync scope is entered withprepared_secret_scope=; watcher reclaim/tick use it (fix(gateway): keep multiplex handoffs responsive during slow secret reads #100049, @fangliquanflq, cherry-picked)._make_profile_message_handler,_make_default_profile_message_handler,_prepare_inbound_message_text_scoped) now use the async scope too._build_slash_event/_dispatch_thread_sessionpassguild_id(new_interaction_guild_id, mirrors on_message) andparent_chat_idtobuild_source.Validation
Credits
@Adolanium (#97694 merged as-is), @fangliquanflq (#100049, first submitter), @Tranquil-Flow (#100076, same mechanism, co-author), @Sora-bluesky (#69242, first fix for #69178, co-author), @jondgilbert (#91634 / #91633, co-author), @tensorbit89-netizen (#31102, first report), @vKongv (#85355 diagnosis; its residual /new symptom is the guild_id gap fixed here).