fix(agui): isolate HITL sessions by user - #2856
Merged
jujn merged 5 commits intoAug 27, 2026
Merged
Conversation
Key ThreadSessionManager by (userId, threadId) so hasMemory and agent reuse no longer mix tenants. Inspecting session memory no longer closes the live ReActAgent. Keep messages after the last assistant turn, including tool results, so HITL can resume. Do not emit interrupts for frontend tools.
dragondyt
commented
Aug 27, 2026
dragondyt
left a comment
Contributor
Author
There was a problem hiding this comment.
仅在demo的stopThread有遗漏,对核心无影响
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Jackson omits the @JsonTypeInfo discriminator when serializing concrete AguiEvent records through Map/bodyValue, and getType() is @JsonIgnore. Encode each replayed event to a map and set type explicitly so CopilotKit can load thread history. Stop unwraps HarnessAgent via AguiUtil.asReActAgent so interrupt targets the live session without closing it. Bump the CopilotKit frontend packages to 1.69.2.
jujn
approved these changes
Aug 27, 2026
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.
Related issues
Summary
ThreadSessionManager/AgentResolverby(userId, threadId)sohasMemoryand agent reuse no longer mix tenants.ReActAgent.AguiUtil.asReActAgentso demostopThreadand processor interrupt target the live session.AgentResolver, lifecycle interrupt filtering, andProcessResult.interrupt().Breaking Changes
This PR is source- and behavior-incompatible. Upgrading requires recompilation + minor migration.
API (source-incompatible)
AgentResolver#hasMemory(String threadId)->hasMemory(RuntimeContext). CustomAgentResolverimplementations must update the signature; the single-arg form is removed.
ThreadSessionManager#hasMemory(String threadId)->hasMemory(RuntimeContext). Callers must passa
RuntimeContextcarryinguserId+sessionId.Behavior (runtime-incompatible)
threadId->(userId, threadId). Different users on the same thread id nolonger share an agent instance. Anonymous callers (
userId == null) stay on the shared__anon__slot, so single-tenant behavior is unchanged.
ThreadSessionManager#getSessions()now returns a threadId-keyed snapshot that is lossy whenmultiple users share a thread id; use
getSession(userId, threadId)for tenant-safe lookup.SchemaOnlyTool/@Tool(externalTool=true)) no longeremit a
TOOL_SUSPENDEDinterrupt. Results are delivered via message-based resume (a trailingrole:"tool"message in the next run's transcript) instead ofRunAgentInput.resume.