Repository navigation
Conversation
Duplicate of #105942, which landed first with the same |
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.
What
Named-profile gateway sessions use namespaced session keys (
agent:<profile>:..., see_session_key_namespace()ingateway/session.py). Two core helpers still assume the default-profile literal, so named-profile sessions are misparsed or their sibling lookups silently fail:_parse_session_key()None→ routing degrades to the LRU_session_sourcesfallback_sibling_thread_run_keys()[]→/stopsays "no active task to stop" while the sibling keeps running_session_key_namespace(profile)Why
gateway/run.py::_parse_session_key()requiredparts[1] == "main"— the namespace slot takes no part in any authorization decision, so accepting any non-empty namespace does not weaken any check (same rationale as in [Bug]: qqbot approval buttons rejected as unauthorized in named-profile sessions (session-key namespace vs "main") #98292).gateway/run_busy.py::_sibling_thread_run_keys()hardcoded the prefix asagent:maininstead of using the namespacebuild_session_key()itself produces.Changes
_parse_session_key(): accept any non-empty namespace slot instead of assertingparts[1] == "main". Malformed keys (agent::..., wrong prefix, too few parts) still returnNone._sibling_thread_run_keys(): build the prefix via_session_key_namespace(getattr(source, "profile", None))— byte-identicalagent:mainfor default/unset profiles.No behavior change for the default
maincase.Tests
Reproduce: with a named profile serving any chat platform, trigger a background-process notification or
/stopa sibling thread run — before: silent fallback / "no active task to stop"; after: correct routing and sibling match.dm/thread-with-extra), malformed-key rejection, named-profile sibling matching.pytest tests/gateway/test_background_process_notifications.py tests/gateway/test_stop_thread_sibling.py -q→ 30 passed.main(verified in isolation onmain@b2aa855b62); the other 7 pass in isolation on this branch — order-dependent suite flakiness, not caused by this change.Platforms
Tested on macOS (arm64). The changed paths are platform-independent; Linux-gated gateway paths were not exercised live on this host.
Related
Not in scope
_build_process_event_source()inrun_notifications.pystill rewrites named-profile keys toagent:mainbefore parsing — redundant and harmless after this fix; candidate for a separate cleanup PR.Checklist
fix(gateway): ...)agent:main) behavior byte-identical