Skip to content

(chore) Tool resolver rejects reserved built-in tool names only after secret resolution and adapter calls #5660

Description

@mmabrouk

When a tool config declares a custom tool whose name collides with a Pi built-in (for example a code tool named read), the SDK's ToolResolver rejects it with ReservedToolNameError. But the check runs last: resolve() first resolves the code tools' secrets and calls the workflow, platform, and gateway adapter resolvers, and only then validates names (_validate_unique_names(tool_specs) at sdks/python/agenta/sdk/agents/tools/resolver.py line 229; the reserved-name check itself is lines 90-96).

What a caller sees today:

  • A reserved-named code tool with a missing secret surfaces MissingToolSecretError instead of ReservedToolNameError, pointing the author at the wrong problem.
  • A reserved-named gateway, reference, or platform tool still reaches its adapter (secret lookups, network calls) before rejection, so the resolver does work for a payload that will always be refused.

The rejection still always happens before any specs leave resolve(), so no reserved name reaches the runner. This is error-precedence and wasted-work hygiene, not a bypass. Declared custom tool names should be validated up front, before secret lookup and adapter resolution, while the final _validate_unique_names(tool_specs) call stays to cover adapter-produced spec names.

Follow-up from a review comment on #5651: #5651 (comment)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions