Skip to content

fix: preserve tool completion, hook feedback, and error states - #3803

Merged
jujn merged 2 commits into
agentscope-ai:mainfrom
Buktal:codex/tool-feedback
Oct 28, 2026
Merged

jujn merged 2 commits into
agentscope-ai:mainfrom
Buktal:codex/tool-feedback

Conversation

@Buktal

@Buktal Buktal commented Oct 27, 2026

Copy link
Copy Markdown
Collaborator

AgentScope-Java Version

2.1.0-SNAPSHOT

Description

Refs #3794, tool-feedback review unit. Successful void calls can yield ambiguous empty/null feedback, PostActing block replacements can miss stored/model-visible history, and Anthropic tool-result formatting can lose explicit failure states.

Summary

tool invocation -> await declared-void completion -> explicit acknowledgement
PostActing replacement -> resulting message -> stored / next-request feedback
Anthropic client-tool result -> explicit failure state -> is_error
  • Acknowledge successful void/Void, Mono<Void>, and CompletableFuture<Void> calls with (completed with no output). Conversion runs after completion; ordinary null returns, non-void empty completion, errors, and cancellation retain their contracts.
  • Propagate PostActingEvent.setToolResult into the resulting message unless the hook explicitly replaces that message. Cover non-streaming, streaming, and stop behavior; already emitted deltas and returnDirect retain their contracts.
  • Map Anthropic ERROR/DENIED/INTERRUPTED client-tool results to is_error, preserving IDs/output blocks and the separate server-tool conversion path.
  • Update English and Chinese tool/middleware documentation. MCP registration/result conversion is covered by fix(mcp): preserve tool identities and result diagnostics #3796.

Evidence

  • Before: declared-void completion could be indistinguishable from empty/null feedback; a replaced block could leave the next request with the original result; explicit failure states could be formatted as ordinary Anthropic results.
    After: ToolMethodInvokerVoidTest covers async completion timing, converters, cancellation/errors, and non-void behavior. ReActAgentPostActingFeedbackTest covers replacement precedence and history/stop behavior for both APIs. Anthropic converter/formatter tests cover failure states and output preservation.
  • Affected Core and Anthropic modules passed in mvn -B -T1C clean verify, including the tool/hook/converter regressions and Spotless. The full reactor is not green: it stopped on a 10-second timeout in the unchanged WeixinChannelLoopbackTest.doesNotLoseMessageWhenCursorPersistenceInterruptsThePoll (11,091 tests recorded, 0 failures, 1 timeout, 240 skipped). No unrelated code or timeout assertions were changed. Docs tests (13/13) and validation passed; broken-links still reports 2,218 links across 326 files.
  • Includes the shared three-line my_skill -> my-skill upstream fixture correction for fix(skill): block path traversal in skill materialization and disambiguate skillId #3787/fix(skill): move blocking skill reload off reactive event-loop threads #3792. The existing validation, thread checks, and cache assertions are retained.

Merge Danger

Door: two-way

No state migration. Consumers inspecting the text of successful declared-void calls now receive a completion acknowledgement. Hook feedback replacements affect persisted/next-request messages; previously emitted streaming deltas are not rewritten.

Blast Radius: tools

Touches Core tool invocation/hook feedback and Anthropic client-tool result formatting. Native thinking/parallel replay in #3740 is separate.

Checklist

  • Spotless formatting check passes in full verification
  • Affected-module tests pass; unrelated full-reactor timeout and skipped count reported above
  • Javadoc and English/Chinese documentation updated
  • Code ready for review

@mintlify

mintlify Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit 2790074.

Approve preview

@Buktal
Buktal force-pushed the codex/tool-feedback branch from aa8b11b to 2790074 Compare October 28, 2026 02:49
@jujn
jujn merged commit 7653eb7 into agentscope-ai:main Oct 28, 2026
7 checks passed
chickenlj added a commit that referenced this pull request Nov 13, 2026
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.

2 participants