Skip to content

feat(agent-tools): handle tool rejection and approval states#1333

Merged
wsp1911 merged 1 commit into
GCWing:mainfrom
wsp1911:main
Jun 27, 2026
Merged

feat(agent-tools): handle tool rejection and approval states#1333
wsp1911 merged 1 commit into
GCWing:mainfrom
wsp1911:main

Conversation

@wsp1911

@wsp1911 wsp1911 commented Jun 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds structured handling for agent tool rejection, confirmation timeout, and execution timeout states across the Rust tool pipeline and FlowChat UI.

Fixes #

Type and Areas

Type:

Feature / UI/UX / test

Areas:

Rust core, execution tool contracts, agent runtime, CLI, web UI, i18n

Motivation / Impact

Previously, user-rejected tool calls and confirmation / execution timeouts could surface as generic failures or argument errors. This change returns structured tool results for those cases so the assistant receives clearer guidance and avoids blindly retrying rejected or timed-out tool calls.

For users, FlowChat now shows an approval bar with approve, reject, reject-with-instruction, permission options, and a countdown when a confirmation timeout is available. Rejected tool calls render as a distinct state across tool cards instead of being folded into generic cancelled/error handling.

This also keeps CLI handling compatible with the expanded confirmation-needed event payload.

Verification

Passed:

  • pnpm run fmt:rs
  • pnpm run type-check:web
  • pnpm run i18n:audit
  • cargo check --workspace
  • cargo test -p bitfun-agent-tools --test tool_contracts
    • 88 passed
  • cargo test -p bitfun-agent-runtime --test tool_confirmation_contracts
    • 4 passed
  • cargo test -p tool-runtime --test tool_pipeline_planning
    • 8 passed
  • cargo test -p bitfun-core confirmation_rejection_returns_user_rejected_result_without_argument_error
    • 1 passed
  • cargo test -p bitfun-core confirmation_timeout_returns_timeout_result_without_argument_error
    • 1 passed
  • pnpm --dir src/web-ui run test:run src/flow_chat/components/ToolApprovalBar.test.tsx src/flow_chat/tool-cards/ExecProcessToolCardView.test.tsx src/flow_chat/services/flow-chat-manager/ToolEventModule.test.ts src/flow_chat/tool-cards/ReadFileDisplay.test.tsx
    • 4 test files passed, 18 tests passed

Reviewer Notes

The PR adds a new Rejected tool state/event path and extends confirmation-needed events with timeout metadata. The CLI match path now ignores unknown/additional confirmation fields so it remains compatible with the expanded payload.

The FlowChat approval countdown test mock now performs basic i18n interpolation, which matches the component’s use of remaining {{time}}.

Checklist

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • User-facing strings, docs, and locales are updated where applicable.

- Return structured tool results for user rejection, confirmation timeout, and execution timeout instead of generic failures
- Add shared tool execution presentation helpers and contract coverage for rejection / timeout assistant messages
- Introduce FlowChat approval bar with approve, reject, reject-with-instruction, permission options, and countdown UI
- Render rejected tool state distinctly across FlowChat event handling and tool cards
- Add focused web UI tests for approval controls, terminal card rejection display, and tool event handling
- Update agentic tool settings and FlowChat locale strings
@wsp1911 wsp1911 marked this pull request as ready for review June 27, 2026 15:05
@wsp1911 wsp1911 merged commit cdfdd71 into GCWing:main Jun 27, 2026
4 checks passed
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.

1 participant