feat(api): detect more coding agents

Description

glab reports the coding agent that runs it in the Coding-Agent User-Agent suffix and the coding_agent telemetry property. Several agents were missed or reported under the wrong name. This adds the ones whose marker is confirmed in the agent's source or in env output from inside the agent:

Agent Marker Label Before
Kilo Code KILO=1, checked before OPENCODE=1 kilo-code opencode
Zed agent terminal TERM_PROGRAM=zed with PAGER="" and GIT_PAGER=cat zed zed-terminal
Goose GOOSE_TERMINAL=1 goose not detected
Qwen Code QWEN_CODE=1 qwen-code not detected
Cline CLINE_ACTIVE=true cline not detected
Roo Code extension ROO_ACTIVE=true roo-code not detected (only the Roo CLI was)
Kiro CLI KIRO_CLI_IS_CHILD_PROCESS=1 kiro-cli kiro-terminal or not detected
Kiro IDE agent KIRO_SESSION_ID, set in the agent's shell but not the user's Kiro terminal kiro kiro-terminal
Amazon Q Developer CLI AWS_EXECUTION_ENV containing AmazonQ-For-CLI amazon-q not detected
Junie CLI JUNIE_SHIM_PATH, exported by its launcher junie not detected
Warp Oz cloud agents OZ_RUN_ID warp not detected

Kiro CLI sets KIRO_SESSION_ID and the Amazon Q marker as well, so it is checked before both.

Boolean AI_AGENT values (0, 1, true, false, yes, no, in any case) name no agent, so they now fall through to the other checks instead of being reported as the agent's name.

Left out on purpose: the generic AGENT variable (it adds nothing that isn't already detected, and invites false positives), and agents that already set AI_AGENT (Amp, Antigravity, Trae, Devin Desktop). The issue lists what was checked for each.

Resolves #8749

How has this been tested?

A table-driven case for each agent and each precedence rule in internal/api/coding_agent_test.go. The test now resets each variable with t.Setenv followed by os.Unsetenv, so the Zed case can tell an unset PAGER from an empty one and the original environment is restored afterwards.

go test ./internal/api/ -run TestDetectCodingAgent

Manual verification

Each marker was checked against the agent itself, not only third-party detection lists:

  • Source: where the agent sets the variable for the shell commands it runs, in Goose, Qwen Code, Cline, Roo Code, Kilo Code, Zed and the Amazon Q Developer CLI repositories, and in the Junie CLI launcher (@jetbrains/junie on npm).
  • env inside the agent:
    • Kiro CLI 3.4.0 sets KIRO_CLI_IS_CHILD_PROCESS=1 and AWS_EXECUTION_ENV=AmazonQ-For-CLI ....
    • The Kiro IDE 1.4.215 agent's shell sets KIRO_SESSION_ID, and a terminal opened by the user doesn't.
    • Devin Desktop 3.14 (formerly Windsurf) sets AI_AGENT, so it needs no rule.
  • Docs: Warp documents OZ_RUN_ID for Oz cloud agent runs.

🤖 Generated with Claude Code

Edited by Jay McCure

Merge request reports

Loading
Loading