fix(memory): pass session and user context to on_turn_start#7789
Open
hughpyle wants to merge 1 commit into
Open
fix(memory): pass session and user context to on_turn_start#7789hughpyle wants to merge 1 commit into
hughpyle wants to merge 1 commit into
Conversation
|
why still unmerged?(( |
Author
|
Actually I think this is obsoleted by parallel work, will take a look... |
Complete the still-open part of PR NousResearch#7789 after upstream separately shipped session_id propagation through sync_turn/prefetch/queue_prefetch and session rotation hooks. Gateway turns now pass per-message source.user_id and source.user_name into run_conversation so shared-thread messages can override the cached agent user. AIAgent forwards user_id, user_name, platform, and session_title through the existing on_turn_start hook for provider attribution. This intentionally does not reintroduce session_id threading in on_turn_start; upstream already covers session attribution for writes and recalls. Providers that write during sync_turn can stash attribution received from on_turn_start and reuse it when syncing the completed turn.
d364386 to
fc4ac4a
Compare
|
soooo....? |
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
MemoryManager.on_turn_start(in addition to the existing remaining_tokens/model/tool_count slots).turn_user_id/turn_user_nametorun_conversation; gateway forwards source.user_id/source.user_name so multi-user threads attribute correctly.Fully backward compatible — the base class and all in-tree providers already accept
**kwargs, so unknown keys are silently absorbed.Fixes #7193
Fixes #7781
Fixes #7777
Test plan
test_on_turn_start— existing test updated to verify empty kwargs passthroughtest_on_turn_start_passes_turn_context— new test: all four context keys reach the providertest_turn_context_reaches_memory_manager_before_prefetch— new test: verifieson_turn_startfires beforeprefetch_allwith correct gateway user override