Skip to content

Permission HITL: user-denied tool calls emit no tool-result events (rule-denied ones do)[Bug]: #3097

Closed

Description

@gxianglc

Version: agentscope-java 2.0.3 (agentscope-core)

What happens

When the user denies a tool call in permission-mode HITL, the resumed run emits no
ToolResultStartEvent / ToolResultEndEvent for it. A client driving the AG-UI protocol therefore
never learns the outcome of that tool call and has to synthesise the state from its own local record
of the decision.

Rule-based denial behaves the opposite way and does emit the events, so the two denial paths are
inconsistent.

Where

  • ReActAgent.PermissionFlow#applyConfirmResults — for a denied ConfirmResult it only appends a
    ToolResultBlock.text("Permission denied by user").withState(DENIED) to the message context.
    No publishEvent(...).
  • ReActAgent#runToolBatch — rule-denied calls do publish ToolResultStartEvent with
    "Permission denied by rules" and a matching end event.

Why it matters

The AG-UI mapping is event-driven. Without an event, AguiStreamContext produces no
TOOL_CALL_RESULT, so a conforming client cannot distinguish "denied" from "result never arrived"
without keeping its own side-channel state. It also means the denial is invisible to anything else
that observes the agent event stream (tracing, audit, replay).

Suggested fix

Publish the same ToolResultStartEvent → delta → ToolResultEndEvent(state = DENIED) sequence from
the user-denial path that runToolBatch already publishes for rule-denied calls.

Possibly the same root cause as #2492.

Activity

  1. added
    bug
    on Sep 11, 2026
  2. oss-maintainer commented on Sep 11, 2026

    @oss-maintainer
    Collaborator

    Issue Evaluation

    Category: bug | Status: Confirmed

    Verified against main @ c5db8f7.

    Root cause: the two denial paths are asymmetric.

    • agentscope-core/.../ReActAgent.java:1981-2015 (PermissionFlow.applyConfirmResults) only appends ToolResultBlock.text("Permission denied by user").withState(DENIED) to the context — no publishEvent(...) call.
    • agentscope-core/.../ReActAgent.java:2956-2999 (runToolBatch) does emit ToolResultStartEvent → ToolResultTextDeltaEvent("Permission denied by rules") → ToolResultEndEvent(state=DENIED) for rule denials.

    Impact: event-driven consumers (AG-UI TOOL_CALL_RESULT, tracing, audit, replay) cannot distinguish "denied" from "result never arrived". Severity: medium.

    Suggested fix: in applyConfirmResults, for each denied ConfirmResult publish the same start → delta("Permission denied by user") → end(state=DENIED) sequence that runToolBatch already produces, so both denial paths converge on one event contract.

    An automated fix proposal will be generated. Reply /approve to proceed with PR generation.


    Automated evaluation by github-manager-bot

  3. added
    area/core/agent
    on Sep 11, 2026
  4. CryoThrust commented on Sep 11, 2026

    @CryoThrust
    Contributor

    There are currently two PRs addressing this issue: #3099 and #3104. For maintainers' convenience, #3104 includes an end-to-end regression covering event ordering, reply/tool-call correlation, and DENIED state; its License, Module Sync, Ubuntu, Windows, CLA, and Codecov checks are currently green. #3099 is presently conflicting and its Ubuntu build is failing. I'm happy for the project to consolidate or choose whichever implementation best fits the existing event contract; I will not maintain a competing duplicate if one PR is selected.

  5. oss-maintainer commented on Sep 11, 2026

    @oss-maintainer
    Collaborator

    Status: no automated PR will be generated — already covered by open community PRs

    Thanks for flagging this in the proposal window. Cross-checked the open PR queue against this issue:

    Per our workflow we skip PR generation whenever an open PR already targets the same root cause, to avoid duplicate competing fixes. Note #3099 is currently CONFLICTING with main; #3104 is mergeable. Reviewers can pick between them without any additional action from us.

    Automated by github-manager-bot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/core/agentbug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions