fix(core): custom HITL deny reason and tool result events on ASK deny - #2513
Open
arimu1 wants to merge 4 commits into
Open
fix(core): custom HITL deny reason and tool result events on ASK deny#2513arimu1 wants to merge 4 commits into
arimu1 wants to merge 4 commits into
Conversation
When the user denies an ASK confirmation, allow ConfirmResult.message to override the fixed "Permission denied by user" tool result, and emit the same ToolResultStart/TextDelta/End sequence that auto-deny already uses. Fixes agentscope-ai#2492
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Drop the 3-arg (confirmed, toolCall, message) constructor that collided with (confirmed, toolCall, rules) when null was passed. Use ConfirmResult.withMessage(...) or the 4-arg constructor instead. Add HITL test that blank/whitespace deny message falls back to "Permission denied by user", and note the API in permission docs.
HarnessAgentSubagentStreamEventsTest.streamEvents_childAgentStartAndEndEmittedWithSource failed once on CI (no child AGENT_END with source) after an unrelated ConfirmResult API commit. Full harness suite (699 tests) is green locally; prior tip fe03dad was green on CI.
execWithTimeoutPromotion bridges execLocalSync via CompletableFuture and whenComplete, which can race doFinally: the parent streamEvents sink may complete before the child AGENT_END is emitted, so CI flaked on HarnessAgentSubagentStreamEventsTest (empty child AGENT_END with source). Emit the bookend in flatMap (before the value reaches the bridge) and keep doFinally only for CANCEL, with AtomicBoolean dedupe.
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.
AgentScope-Java Version
2.0.1-SNAPSHOT (
main)Description
Fixes #2492.
When permission HITL is in ASK and the user rejects a tool call:
ConfirmResultnow has an optionalmessagefield. If set (non-blank), that text is written into the deniedToolResultBlockinstead of the fixed"Permission denied by user". Existing callers keep the old default.ToolResultStartEvent→ToolResultTextDeltaEvent→ToolResultEndEvent(stateDENIED), matching the auto-deny path inrunToolBatch. Previously only context was updated, so stream consumers never saw tool_result events for user denials.Usage
How tested
New coverage in
ReActAgentHitlTest:"Permission denied by user"DENIEDstateChecklist
Please check the following items before code is ready to be reviewed.
mvn spotless:applymvn test—ReActAgentHitlTest)