Skip to content

[TASK] Refactor unify the two tool-approval and rejection routes #1153

Closed

Description

@edenreich

Summary

Tool approval and rejection are implemented twice: the state machine route (internal/agent/states/approving_tools.go, buildRejectionEntry, finishApprovals) and the older executeTool route in internal/agent/agent.go (createRejectionEntry, checkToolResultsStatus). Both decide approval, both build a rejection tool result with drifted wording ("Tool call rejected" vs "Tool execution rejected"), and both hold the stop-the-turn rule. PR #1148 had to change the approval signature and the rejection text in both places.

Confirm whether the older route still runs; if not, delete it. Either way, keep one rejection builder and one stop-the-turn rule. While there, make the turn-stop semantics explicit rather than overloading ToolExecutionResult.Rejected (human rejection stops the turn; a judge rejection is now a plain failure so the driver continues).

Acceptance Criteria

  • One rejection-entry builder shared by every approval path
  • One place decides whether a rejected batch ends the turn
  • ToolExecutionResult states the outcome explicitly (or the docs on Rejected say what it means for turn control)
  • The older executeTool approval route is removed or documented as still live, with a test

Activity

  1. added
    refactor
    on Sep 2, 2026
  2. added theissue type on Sep 2, 2026
  3. moved this to Todo in 2026on Sep 2, 2026
  4. added a commit that references this issue on Sep 2, 2026
    1e41d13
  5. inference-gateway-releaser commented on Sep 2, 2026

    @inference-gateway-releaser
    Contributor

    🎉 This issue has been resolved in version 0.188.0 🎉

    The release is available on:

    Your semantic-release bot 📦🚀

  6. moved this from Todo to Done in 2026on Sep 3, 2026
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

    refactorreleased

    Type

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions