fix(harness): propagate userId through wakeup dispatch#2001
Merged
chickenlj merged 1 commit intoJul 6, 2026
Merged
Conversation
WakeupDispatcher.dispatch read only sessionId/agentId from the wakeup payload and invoked runWakeup(String), discarding the userId that enqueueWakeup had already stored in the queue. In runtimes that isolate agent state by (userId, sessionId), the wakeup-driven round then built a RuntimeContext without a userId, loaded state from an anonymous slot, and lost the original conversation -- the model received no user message and the provider rejected the request with 400 "No user query found in messages." - WakeupTarget: add default runWakeup(userId, sessionId) delegating to the legacy overload; mark runWakeup(sessionId) @deprecated. - WakeupDispatcher.dispatch: read userId from the payload and forward it. - HarnessGateway: override the new overload and set rtc.userId when non-blank (matching runStream), so the wakeup round loads the same (userId, sessionId) slot as the original run. Blank/null userId keeps the legacy anonymous behaviour -- no regression for single-tenant runtimes. Backward compatible: existing WakeupTarget implementers compile and run unchanged. Adds a WakeupDispatcherTest case asserting the userId is forwarded to the target.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
zouyx
pushed a commit
to zouyx/agentscope-java
that referenced
this pull request
Jul 6, 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.
Resolves #2000.
Summary
WakeupDispatcher.dispatchdiscarded theuserIdthatenqueueWakeuphad already stored in the wakeup queue. In runtimes isolating agent state by(userId, sessionId), the wakeup round built aRuntimeContextwithout a userId, loaded state from an anonymous slot, lost the original conversation, and the provider returned400 "No user query found in messages."This forwards the userId end-to-end.Changes
WakeupTarget: adddefault runWakeup(userId, sessionId)delegating to the legacy overload; markrunWakeup(sessionId)@Deprecated.WakeupDispatcher.dispatch: readuserIdfrom the wakeup payload and forward it to the target.HarnessGateway: override the new overload; setrtc.userId(...)when non-blank (matchingrunStream). Blank/null userId keeps the legacy anonymous behaviour — no regression for single-tenant runtimes.Backward compatibility
The single-arg
runWakeup(String)stays on the interface (@Deprecated, with a default that delegates to it), so existingWakeupTargetimplementations — including external ones — compile and behave as before. The dispatcher now calls the user-id-aware overload, whichHarnessGatewayoverrides; any implementation that does not override it falls back via the default.Tests
WakeupDispatcherTest#wakeupDispatch_propagatesUserId: enqueues a wakeup with a userId and asserts the target receives it.WakeupDispatcherTestcases pass unchanged (StubTarget unchanged).HarnessGateway.runWakeup's userId->rtc assignment mirrors the production-provenrunStreampattern (if (!isBlank) rtcBuilder.userId(...)); kept the PR focused without a dedicated gateway integration test, but happy to add one if reviewers want end-to-end rtc coverage. Spotless applied; only the three intended files are in the diff.