Skip to content

[TASK] Refactor away the built-in Github tool in favor of the gh CLI #570

Closed

Description

@edenreich

Summary

The CLI ships a built-in Github tool (internal/agent/tools/github.go, registered in internal/agent/tools/registry.go when tools.github.enabled, which defaults to true). It overlaps the gh CLI but is worse in practice, and should be removed in favor of standardizing on gh via the Bash tool:

  • Models misuse its schema. It multiplexes 8 operations behind a single resource parameter, each with its own required fields, so models routinely omit them. From the @infer run on the inference-gateway/inference-gateway repo, PR 317:
    Github: issue_number parameter is required for fetching a specific issue
    Github: head parameter is required for creating a pull request
    
    (cf. [BUG] DeepSeek calls the Github tool repo parameter just with the org name #274, [FEATURE] Make it simple to fetch github issues deterministically #280 - prior reports of the model calling this tool incorrectly.)
  • Separate, fragile auth. It authenticates from a configured %GITHUB_TOKEN% rather than the gh credential chain, producing Github: GitHub API error (403): Resource not accessible by integration where gh - already on PATH and authenticated in CI - just works.
  • Redundant. gh covers the same surface (issues, PRs, comments, raw API) with better ergonomics and far clearer error messages.

Acceptance Criteria

  • Remove the built-in Github tool: delete internal/agent/tools/github.go and its registration in internal/agent/tools/registry.go; drop tools.github.* from the default config (config/config.go). If a deprecation window is preferred, stage as default-off then removal.
  • The default system prompt instructs the model to use the gh CLI (via Bash) for all GitHub operations - issues, PRs, comments, API - and no longer references a built-in Github tool. Add this in addSystemPrompt() / the prompt assembly (internal/agent/agent_utils.go, config/prompts.go).
  • The default Bash whitelist allows the non-destructive gh operations the agent now needs out of the box: read-only gh, gh issue create|edit|comment, gh pr create, and gh api (GET). Today IsBashCommandWhitelisted (config/config.go) contains no gh at all, so removing the tool without this leaves the agent unable to touch GitHub. Keep destructive operations (gh pr merge, gh repo delete, ...) out of the default.
  • Also whitelist the common, non-risky introspection commands the agent reaches for and that are denied today: env, printenv.
  • Docs and changelog updated. Note this is a breaking change (the tools.github config block is removed); a matching [DOCS] ticket against inference-gateway/docs should accompany the implementing PR.

Activity

  1. added
    refactor
    on Jun 1, 2026
  2. added theissue type on Jun 1, 2026
  3. added 2 commits that reference this issue on Jun 1, 2026
    42897fb
    4c74997
  4. inference-gateway-releaser commented on Jun 1, 2026

    @inference-gateway-releaser
    Contributor

    🎉 This issue has been resolved in version 0.117.0 🎉

    The release is available on GitHub release

    Your semantic-release bot 📦🚀

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

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions