Conversation
9 tasks done
Duplicate of #108703 — same fix for #108698 (bind the inbound session context around the plugin slash-command handler, restore in |
KoNit-K
force-pushed
the
fix/plugin-command-session-context
branch
from
September 17, 2026 13:55
5dea1e0 to
43cdfde
Compare
Collaborator
|
Closing as superseded by #118845 (#118845), commit Thanks for the contribution — the underlying problem this PR addresses has been resolved on current main. If you believe this was closed in error, please comment and we'll reopen. |
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.
What does this PR do?
Plugin-registered gateway slash commands ran before the normal agent-turn session binding, so handlers saw empty
HERMES_SESSION_*values. This change binds the inbound session context only while a resolved plugin handler runs, using the same source and canonical session key as the gateway turn path.The binding covers synchronous and asynchronous handlers and restores the exact prior ContextVar state, including runtime cwd, in a
finallyblock. Existing turn-level clear semantics and non-plugin command routing are unchanged.Related Issue
Fixes #108698
Type of Change
Changes Made
gateway/run_inbound.py— scopes session context around plugin slash-command invocation.gateway/session_context.py— adds token-based restoration for nested session scopes while preserving explicit-clear behavior.tests/gateway/test_plugin_command_session_context.py— covers sync, async, exception, and outer-context restoration behavior.How to Test
scripts/run_tests.shon the files in Changes Made — focused verificationscripts/run_tests.sh tests/gateway/test_plugin_command_session_context.py -qscripts/run_tests.sh \Evidence
scripts/run_tests.shon the files in Changes Made — focused verification — 3 passedChecklist
Code
Documentation & Housekeeping
cli-config.yaml.example: N/ACONTRIBUTING.mdorAGENTS.md: N/A