Skip to content

fix(core): transition denied tool calls out of ASKING state in ReActAgent - #4326

Open
Shawrange wants to merge 1 commit into
agentscope-ai:mainfrom
Shawrange:fix/hitl-denied-confirm-state
Open

Shawrange wants to merge 1 commit into
agentscope-ai:mainfrom
Shawrange:fix/hitl-denied-confirm-state

Conversation

@Shawrange

@Shawrange Shawrange commented Nov 22, 2026 •

Copy link
Copy Markdown

Summary

Fixes #3619.

In ReActAgent.CallExecution.applyConfirmResults(), approved ToolUseBlocks are promoted from ToolCallState.ASKING to ToolCallState.ALLOWED, but denied ToolUseBlocks were left in ToolCallState.ASKING inside persisted AgentState.context. Even with the pendingIds guard in askingToolCalls() (from #4443), persisted state and partial-denial PERMISSION_ASKING responses still expose already-denied tool calls as ASKING across fresh-runtime recovery, stop-on-denial middleware, and multi-tool batches.

Changes

  • ReActAgent.CallExecution.applyConfirmResults(): Transition denied ToolUseBlocks to ToolCallState.FINISHED via replacements (preserving serialized state compatibility with existing ToolCallState values and downstream consumers) and update Javadoc.
  • ReActAgentPermissionPersistenceTest: Added parameterized offline JUnit 5 regression tests across both AgentStateStore and ThreadJournalStore covering single denial (with and without AllToolsDeniedEvent stop middleware), partial denial in a multi-tool batch, mixed deny + external suspension, and legacy persisted state recovery.

Verification

  • Targeted HITL & persistence tests (ReActAgentPermissionPersistenceTest, ReActAgentHitlTest): 49 tests run, 0 failures.
  • Full agentscope-core test suite (mvn -T1C -pl agentscope-core -am test -Dtest=!DangerousPathBypassTest): 3,503 tests run, 0 failures.
  • Formatting (mvn -T1C -pl agentscope-core -am spotless:check): passed.

@Shawrange
Shawrange force-pushed the fix/hitl-denied-confirm-state branch from 951c094 to 0850f5f Compare November 27, 2026 09:17
@Shawrange

Copy link
Copy Markdown
Author

Hi @chickenlj — I've rebased this PR onto main after #4443 (keeping #4443's askingToolCalls(Set<String>) update while preserving the applyConfirmResults() transition to FINISHED on denial), and all CI checks are green. Could you please take a look when you have a moment?

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Fresh-runtime denied ConfirmResult leaves the session stuck in PERMISSION_ASKING

1 participant