Skip to content

refactor: remove built-in Github tool in favor of the gh CLI - #572

Merged
edenreich merged 7 commits into
mainfrom
refactor/remove-github-tool-570
Jun 1, 2026
Merged

edenreich merged 7 commits into
mainfrom
refactor/remove-github-tool-570

Conversation

@edenreich

@edenreich edenreich commented Jun 1, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Closes #570. Removes the built-in Github tool and standardizes on the gh CLI (via Bash). The built-in tool multiplexed 8 operations behind one resource param (models routinely omitted required fields like issue_number/head), authenticated from a separate GITHUB_TOKEN instead of the gh credential chain (403 "Resource not accessible by integration" in CI), and duplicated gh with worse error messages.

Breaking change (feat!): the tools.github config block and the infer config tools github commands are removed. Configs that still contain a tools.github section are ignored (viper drops unknown keys), so they don't error.

Changes

  • Removed: internal/agent/tools/github.go (+ tests), its registration, the tools.github config (GithubToolConfig/GithubSafetyConfig, defaults, approval case), the infer config tools github command subtree, the GitHub API domain types (GitHubIssue/GitHubPullRequest/GitHubComment/…), and the now-orphaned DetectGithubOwner helper. The separate GitHub Action setup wizard is untouched.
  • Whitelist (config/config.go + .infer/config.yaml): non-destructive gh ops are auto-approved by default — read-only gh <noun> list|view|status|diff|checks, gh auth status, gh issue create|edit|comment, gh pr create, and GET-only gh api (bare endpoint + read-only flags). Plus env/printenv. Destructive ops (gh pr merge, gh repo delete, mutating gh api, …) are deliberately omitted so they fall through to the approval flow — not blocked.
  • Prompt steering: a dynamic GITHUB OPERATIONS context block (reaches existing users regardless of their prompts.yaml, gated on Bash being enabled) plus a sentence in the default system prompt, both pointing at gh.
  • infer init: the seeded PR-creation snippet now uses gh pr create instead of the removed tool.

Note on gh api GET-only

Go's RE2 has no negative lookahead, so "gh api but not -X POST" can't be expressed directly. The pattern ^gh api [^ -][^ ]*( --paginate| --jq <expr>| -q <expr>)*$ auto-approves a bare endpoint with only read-only flags; anything with -X/--method/-f/-F/--field/--input (writes) falls through to approval. Safe by design.

Tests

  • TestIsBashCommandWhitelisted_GhDefaults: asserts each read + targeted-write is whitelisted and the destructive set (gh pr merge, gh repo delete, gh api … -X POST, --method POST, -f …, leading-flag api) is not.
  • Existing config/prompts tests updated; gate grep for Tools.Github|GithubToolConfig|NewGithubTool|GitHubIssue|…|tools.github comes back empty.
  • task test + task lint green. Smoke-tested the built binary: infer config tools github no longer exists; infer config tools validate confirms the gh allow/deny split.

Follow-up

  • A matching [DOCS] ticket for inference-gateway/docs (removal of the GitHub tool + gh whitelist guidance) should accompany this PR, per the maintainer docs rule.

## [0.116.0](v0.115.2...v0.116.0) (2026-06-01)

### 🚀 Features

* add /copy shortcut to copy the current conversation to clipboard ([#565](#565)) ([bdfe618](bdfe618))
* **stt:** add Whisper speech-to-text for chat /voice and Telegram voice ([2f3828a](2f3828a)), closes [#559](#559)
* regenerate config ([ae43e7f](ae43e7f))

### 👷 CI/CD

* centralize claude.yml via reusable workflow ([#557](#557)) ([3d48856](3d48856))
* centralize claude.yml via reusable workflow ([#558](#558)) ([affc7a1](affc7a1))
* centralize claude.yml via reusable workflow ([#563](#563)) ([feaeeb0](feaeeb0))
* centralize infer.yml via reusable workflow ([#564](#564)) ([2b80aed](2b80aed))
* **claude:** standardize workflow + task-based branch prefix ([2d256d0](2d256d0))

### 🧹 Maintenance

* **deps:** add whisper-cpp and ffmpeg to flox env ([2652e99](2652e99))
@edenreich
edenreich requested a review from a team as a code owner June 1, 2026 18:09
@edenreich edenreich changed the title feat!: remove built-in Github tool in favor of the gh CLI refactor: remove built-in Github tool in favor of the gh CLI Jun 1, 2026
The built-in Github tool multiplexed 8 operations behind a single
`resource` parameter (models routinely omitted required fields like
issue_number/head), authenticated from a separate GITHUB_TOKEN rather
than the gh credential chain (403s in CI), and duplicated `gh`. Remove
it and standardize on `gh` via the Bash tool.

- Delete the Github tool, its tests, the tools.github config block,
  GithubToolConfig/GithubSafetyConfig, the approval case, the
  `infer config tools github` command subtree, the GitHub API domain
  types, and the now-orphaned DetectGithubOwner helper.
- Whitelist the non-destructive gh operations by default: read-only gh
  (issue/pr/repo/release/run/workflow list|view|status|diff|checks),
  gh auth status, gh issue create|edit|comment, gh pr create, and
  GET-only `gh api` (bare endpoint + read-only flags). Destructive ops
  (gh pr merge, gh repo delete, mutating gh api, ...) fall through to
  the approval flow. Also whitelist env/printenv.
- Steer the default system prompt and dynamic context to use `gh` via
  the Bash tool for all GitHub operations.
- Rewrite the `infer init` PR-creation snippet to use `gh pr create`.

The tools.github config block and the
`infer config tools github` commands are removed. Existing configs that
still contain a tools.github section are ignored (viper drops unknown
keys), so they do not error.

Closes #570
@edenreich
edenreich force-pushed the refactor/remove-github-tool-570 branch from 92f0ce7 to 42897fb Compare June 1, 2026 18:18
edenreich added 3 commits June 1, 2026 22:41
Resolve conflict in internal/agent/agent_utils.go: keep both this branch's
GitHub gh-CLI guidance (buildGitHubGuidanceInfo) and main's deterministic
skill activation (buildActiveSkillInfo, #571) in buildContextInfo. Thread
messages through buildSystemPromptText so BuildSystemPrompt() passes nil for
a fresh session (no active skill yet).
Comment thread config/config.go Resolved
@edenreich
edenreich merged commit 4c74997 into main Jun 1, 2026
@edenreich
edenreich deleted the refactor/remove-github-tool-570 branch June 1, 2026 21:21
inference-gateway-releaser Bot pushed a commit that referenced this pull request Jun 1, 2026
## [0.117.0](v0.116.0...v0.117.0) (2026-06-01)

### 🚀 Features

* add GitHub issue references autocomplete and inline expansion ([#574](#574)) ([5056c9d](5056c9d)), closes [#N](https://github.com/inference-gateway/cli/issues/N) [#573](#573)

### 🐛 Bug Fixes

* **skills:** load installed skills via sandbox carve-out and deterministic activation ([#571](#571)) ([18a9287](18a9287)), closes [#569](#569)

### ♻️ Code Refactoring

* **system-prompt:** add available tools info to system prompt ([a913728](a913728))
* remove built-in Github tool in favor of the gh CLI ([#572](#572)) ([4c74997](4c74997))
* **config:** remove inline redundant comment ([c389929](c389929))
* system prompt - reduce tokens ([0be4b3a](0be4b3a))

### 👷 CI/CD

* centralize infer.yml + bump infer CLI and sync .infer config ([#567](#567)) ([c0369de](c0369de))
@inference-gateway-releaser

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 0.117.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@inference-gateway-releaser inference-gateway-releaser Bot added the released Shipped in a release label Jun 1, 2026
edenreich added a commit that referenced this pull request Jun 29, 2026
## What

Fixes documentation drift surfaced by a README↔codebase audit.
**Documentation only — no code changes.**

## Changes

**Phantom `Github` tool removed** — it was removed in #572 but still
documented. Deleted from the README tools table, the full section in
`docs/tools-reference.md`, and the env vars + YAML blocks in
`docs/configuration-reference.md`. The system prompt already directs
GitHub work to the `gh` CLI.

**README tools table rebuilt** from `internal/agent/tools/registry.go` —
all 35 registered tools, grouped by category with their config gates,
plus a note that MCP tools register dynamically at runtime. (The old
table listed 16 and omitted 28 real tools.)

**New sections + TOC** — added a Table of Contents entry for the
existing *Claude Code Mode (Subscription)* section and four new
sections: *Agent Skills*, *Computer Use*, *Persistent Memory*,
*Reminders & Command Hooks*.

**Features / Commands / Shortcuts**
- Linked the six orphaned docs (`skills`, `plan-mode`,
`database-migrations`, `features/explorer`, `tasks-management`,
`a2a-connections`).
- Documented `infer skills` and `infer export`.
- Shortcuts: removed the non-existent `/export`, corrected `/clear`,
`/model`, `/copy`, and added the nine missing built-ins (`/new`,
`/conversations`, `/context`, `/diff`, `/explorer`, `/release-notes`,
`/tasks`, `/init`, `/init-github-action`).

**Examples** — referenced all 8 example directories (only
`telegram-channel` was linked before).

**Approval defaults corrected** — `WebSearch`, `WebFetch`, and
`A2A_SubmitTask` require approval under the global
`tools.safety.require_approval: true` default; the old tables said "No".
If web search/fetch needing approval is unintended, that's a code-side
default rather than a docs issue.

## Verification

- `markdownlint` clean (pre-commit Lint hook passed)
- All README links + in-page anchors resolve; every linked doc and
example dir exists
- Every tool in `registry.go` is represented; no `Github` row remains

## Merge order

The subagent tool suite (`Agent`, `ListSubagents`, `GetSubagentResult`,
`CloseSubagent`, `ReadSubagentScreen`, `SendSubagentInput`,
`ApproveSubagent`) is documented here but lands via #684. If this merges
before #684, `main` will briefly describe those tools ahead of the code
— merge #684 first (or together) to keep them in sync.
edenreich added a commit that referenced this pull request Jun 29, 2026
## Summary

Follow-up to #685. That PR synced `README.md`,
`docs/tools-reference.md`, and
`docs/configuration-reference.md` with the code; this one fixes the
**same classes of
drift** across the remaining `docs/*.md` pages — documented-but-removed
features, broken
internal links, and stale/mislabeled content. Every finding was
re-verified against the
current `main` before editing.

## Changes

| File | Fix |
| --- | --- |
| `docs/mcp-integration.md` | Replace the phantom `url:` server field
with `scheme`/`host`/`port`/`path` (12 examples + the per-server table);
`MCPServerEntry` has no `url` field, so a `url:` key was silently
ignored. Fix the `tests/mcp-test-server` link to `examples/mcp/`. |
| `docs/shortcuts-guide.md` | Drop the phantom `/config` shortcut; fix
the `/clear` description; move `/export`/`/env` out of built-ins; add
the missing built-ins (`/new`, `/conversations`, `/context`, `/cost`,
`/diff`, `/explorer`, `/tasks`, `/init-github-action`); add an
**Init-Created Shortcuts** section. |
| `docs/heartbeat.md` | Drop the `Github` tool (removed in #572); read
GitHub state via the `gh` CLI through Bash. |
| `docs/web-terminal.md` | Fix the three `docs/`-prefixed links
(resolved to `docs/docs/…`); document `INFER_WEB_ENABLED`. |
| `docs/database-migrations.md` | Repoint the dead
`./storage-architecture.md` link to `./conversation-storage.md`. |
| `docs/features/conversation-versioning.md` | Replace three links to
non-existent `../configuration/` and `../user-guide/` dirs with existing
docs. |
| `docs/conversation-storage.md` | Describe the v2 append-only JSONL
format (was "exactly two lines"); document the `d1` (Cloudflare D1)
backend; fix the stale Redis example keys (`database`/`username`/`ttl` →
`db`). |
| `docs/conversation-title-generation.md` | Fix the invalid example
model id `anthropic/claude-4-haiku` →
`anthropic/claude-haiku-4-5-20251001`. |
| `docs/directory-structure.md` | Complete the seeded-shortcuts list
(add `/env`, `/skills`). |
| `README.md` | Present `/export`, `/env`, `/agents`, `/skills` as
`infer init`-created shortcuts — supersedes #685's wording that called
`/export` "non-existent" (it's a real init-seeded shortcut). |

## Notes

- Two over-cautious items from the issue were dropped after
verification: the Redis `db`
key in the **Configuration** section already matched the code, and most
`INFER_WEB_*`
vars were already documented (only `INFER_WEB_ENABLED` was missing). The
Redis `db`
fix landed instead in the **backend example**, where
`database`/`username`/`ttl` were
  genuinely wrong.
- Two findings from the original audit were disproved and excluded:
`/agents` is a real
  init-seeded shortcut, and `infer keybindings` exists.

## Verification

- `markdownlint` clean on all changed files.
- Drift greps return nothing: no config `url:` in the MCP doc, no
`/config` shortcut, no
`Github` tool ref, no
`docs/docs`/`storage-architecture`/`claude-4-haiku`/
  `mcp-test-server`/`configuration/keybindings`/`user-guide/` targets.
- Every changed/added relative link resolves to a real file on disk.

Closes #686
inference-gateway-releaser Bot added a commit that referenced this pull request Jun 30, 2026
## [0.126.0](v0.125.0...v0.126.0) (2026-06-30)

### 🚀 Features

* add persistent memory tool for agent ([#679](#679)) ([a487b13](a487b13))
* **agent:** interactive subagent management and unified background-work tracking ([#684](#684)) ([343e083](343e083))

### 🐛 Bug Fixes

* **chat:** bind opt+backspace and ctrl+backspace to delete-word-backward ([#697](#697)) ([173fe83](173fe83)), closes [#689](#689) [#576](#576)
* **a2a:** retain completed background tasks in /tasks ([#691](#691)) ([#701](#701)) ([43b8e13](43b8e13))
* **autocomplete:** surface arguments for one-of/all-optional tool schemas ([#698](#698)) ([655b2e4](655b2e4))

### ♻️ Code Refactoring

* add .gitignore by default to the projects dir ([4717deb](4717deb))
* enable memory by default ([86c2158](86c2158))
* make infer config userspace-first ([#682](#682)) ([1e77e42](1e77e42)), closes [#680](#680)
* **tui:** single event-loop ingress - one notifier, no self-rescheduling pollers ([#700](#700)) ([2ab8854](2ab8854))
* standardize comment punctuation by replacing em dashes with hyphens ([78f53a8](78f53a8))

### 📚 Documentation

* fix docs/ drift found by the README-to-codebase audit ([#687](#687)) ([413047a](413047a)), closes [#572](#572) [#686](#686)
* sync README and reference docs with the codebase ([#685](#685)) ([c328423](c328423)), closes [#572](#572) [#684](#684) [#684](#684)

### 👷 CI/CD

* **deps:** update CLAUDE workflow to version 0.14.5 ([eaba2b3](eaba2b3))

### 🧹 Maintenance

* add .infer to .gitignore ([08ef319](08ef319))
* **deps:** bump infer CLI v0.124.0 -> v0.125.0, infer-action v0.19.0 -> v0.19.1 ([#681](#681)) ([e9e7e21](e9e7e21))
* remove agent definitions ([4f7fd7d](4f7fd7d))
* remove unused configuration and shortcut files ([4c611db](4c611db))
* update claude-code to 2.1.191 ([729e81c](729e81c))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released Shipped in a release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant