{{ message }}
Detect additional third-party coding agents#13722
Merged
Merged
Conversation
Add detection for antigravity, augment-cli, replit, goose, cowork, cursor, cursor-cli, kiro, and pi, plus extra signals for opencode and claude-code. Low-confidence signals (Replit, Goose) and single-source matches are checked last so stronger signals win. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
babakks
approved these changes
Jun 25, 2026
OPENCODE_CALLER and OPENCODE_CLIENT are set on the environment that launches opencode, such as the VS Code extension's terminal, so they can be present when a person rather than the agent runs gh. Detect only OPENCODE, which opencode sets on its own process. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The Pi PATH check only matched the POSIX separator. Also match the Windows form so detection works there, with the caveat that Pi's Windows layout is unconfirmed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Extends internal/agents detection logic so gh can identify additional third-party coding agents (via environment-variable signals) and encode a precedence order for conflicting signals, with accompanying table-driven tests.
Changes:
- Adds new
AgentNameconstants and detection checks for additional third-party agents (plus new Claude Code and Cursor signals). - Introduces “single-source” detection checks (e.g., exact
TERM_PROGRAMmatch for Kiro, PATH-based signal for Pi) and places Goose’s provider signal last. - Expands
TestDetectWithwith cases for new agents, precedence, and negative matches.
Show a summary per file
| File | Description |
|---|---|
| internal/agents/detect.go | Adds new agent identifiers and ordered environment-based detection logic. |
| internal/agents/detect_test.go | Adds table-driven tests for new detectors and precedence/negative scenarios. |
Copilot's findings
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 2/2 changed files
- Comments generated: 5
Comment on lines
+111
to
+115
OPENCODE_CALLER and OPENCODE_CLIENT name the client that launched opencode rather than the running agent, so a comment records why only OPENCODE is checked. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
Extends agent detection so the User-Agent header can identify more third-party coding agents driving
gh. Adds nine new agents and an extra environment-variable signal for one existing one.Key Points
New agents detected: antigravity, augment-cli, replit, goose, cowork, cursor, cursor-cli, kiro, and pi. One existing agent gains an extra signal: claude-code also matches
CLAUDE_CODE.Detection order encodes confidence.
AI_AGENTstill wins, followed by agent-specific variables. Two signals are deliberately low-confidence and ranked accordingly:REPL_IDis present throughout any Replit environment, not only when a Replit agent drives the CLI, so it is annotated as broad in the code.GOOSE_PROVIDERonly means Goose is configured as a model provider, not that it is running, so Goose is checked absolutely last and any stronger signal wins.The single-source block now matches precisely instead of loosely:
kirois an exactTERM_PROGRAMmatch, andpiis anchored to a path boundary (/.pi/agent, or the Windows\.pi\agent) so an incidental substring cannot trigger it.We considered a Devin signal and dropped it. The only reliable marker is the existence of a
/opt/.devindirectory, and this detector is intentionally environment-only with no filesystem access. The environment-variable alternatives (for example anEDITORsubstring) could produce false positives, and Devin's developer-terminal footprint is small, so a noisy signal was not worth the telemetry pollution.Notes for reviewers
Two files change. Start in the
agentsdetector: the constant block lists the new identifiers, anddetectWithruns the ordered checks top to bottom, returning on first match. Read it straight down to see the precedence. Then the detector tests add table cases for every new agent and signal, plus the precedence and negative cases (exactkiro, path-boundarypi, Goose losing to stronger signals).First-party documentation for each signal lives inline next to its check, or is marked
// No first-party docswhere none exists.