Skip to content

Resolve AI client from host app and tighten session detectors - #1613

Merged
sverdlov93 merged 12 commits into
masterfrom
feature/ide-only-client-identity
Aug 26, 2026
Merged

Resolve AI client from host app and tighten session detectors#1613
sverdlov93 merged 12 commits into
masterfrom
feature/ide-only-client-identity

Conversation

@sverdlov93

@sverdlov93 sverdlov93 commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Overview

CLI telemetry stamps client with the real host app of a proven agent session: known IDE first, then Claude Code as a standalone app, then a short terminal name. Session detection is tightened so grok, kilo, Claude cowork, Copilot, and alias names match product rules.

Details

Host (ai-client/ / JSON client), strongest signal first:

  • Known IDE: cursor, vscode, zed, jetbrains, windsurf, antigravity, codium, trae, visualstudio from editor-owned env (never raw TERM_PROGRAM for forks).
  • Cursor / Windsurf / Antigravity / Trae / VSCodium keep their name even when TERM_PROGRAM=vscode.
  • Askpass matching uses the editor install (/cursor.app, /cursor/resources, or /.cursor-server for Remote-SSH), not a username in the path.
  • Desktop Visual Studio (VisualStudioVersion) is not labelled vscode.
  • Claude Code with no proven IDE is claude, not iTerm.
  • Otherwise map TERM_PROGRAM to a short product name: iTerm.appiterm, WarpTerminalwarp, Apple_Terminalterminal, tmuxtmux.
  • When TERM_PROGRAM is empty or inherited vscode, fall back to TMUX, WT_SESSION (windows-terminal), Ghostty, Kitty, or Alacritty.
  • Generic GIT_ASKPASS is not used as IDE proof.
  • Humans still get no client; the axis is gated on an agent session.

Session (ai-agent/):

  • Kilo only matches KILOCODE_FEATURE=cli. Grok matches exact GROK_AGENT=1. Cowork is classified as Claude before the generic Claude detector.
  • Copilot extras: COPILOT_AGENT, COPILOT_AGENT_JOB_ID. Aliases such as github_copilot_vscode_agent and grok-cli map to canonical session names. The vscode-plugin alias is folded the same way as session detection (AI_AGENT/AGENT, case and @version) and last-resorts client to vscode when no IDE is proven.
flowchart LR
  env[Process env] --> detect[Detect agent session]
  detect --> host[Resolve host app]
  host --> ide[Known IDE]
  ide --> app[Claude if no IDE]
  app --> term[Short terminal name]
  term --> ua["ai-agent/ and ai-client/ on User-Agent"]
  ua --> metrics[Coralogix metrics]
Loading

Notes

Companion PRs: jfrog-cli tests, jfrog-agent-hooks stamp, jfrog-skills EXTRACT split. Merge this module first so CLI can bump jfrog-cli-core.

Client is cursor or vscode only; session detectors match grok/kilo/cowork/Copilot aliases without filling agent from TERM_PROGRAM.
@sverdlov93 sverdlov93 added the improvement Automatically generated release notes label Aug 19, 2026
Copilot and Claude both run inside JetBrains, Zed and VS Code, so deriving
client from the agent mislabelled those sessions (Copilot in IntelliJ reported
vscode). Read the window from editor-owned env instead, resolving VS Code forks
before upstream so a Cursor session can never be labelled vscode.
After VS Code forks are ruled out, VSCODE_GIT_ASKPASS_MAIN/NODE prove the
window without requiring COPILOT_AGENT.
@sverdlov93 sverdlov93 changed the title Make AI client IDE-only and tighten session detectors Resolve AI client from host app and tighten session detectors Aug 20, 2026
Client stays AI-only but is no longer IDE-only. After known editors,
standalone Claude reports itself, then TERM_PROGRAM maps to short names
(iterm, warp, tmux). Inherited TERM_PROGRAM=vscode is still omitted.
The path is test data proving generic git askpass cannot label the host.

@sankerr sankerr left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤖 Review comment by Cursor AI

Reviewed at 065e2a6e. Host independence, fail-open vscode, exported constants, unknown TERM_PROGRAM cardinality, and the Amazon Q marker citation are addressed.

Findings

✅ All findings have been resolved.

⚠️ AI review supplements human review — always get a human reviewer too.

Comment thread common/commands/execution_context_test.go Outdated
Comment thread common/commands/execution_context.go Outdated
Comment thread common/commands/execution_context.go Outdated
Comment thread common/commands/execution_context.go
Comment thread common/commands/execution_context.go Outdated
Comment thread common/commands/execution_context.go Outdated
Comment thread common/commands/execution_context.go
@sverdlov93
sverdlov93 enabled auto-merge (squash) August 26, 2026 11:58
@github-actions

Copy link
Copy Markdown
Contributor

@sverdlov93
sverdlov93 merged commit 9a951b0 into master Aug 26, 2026
13 checks passed
@sverdlov93
sverdlov93 deleted the feature/ide-only-client-identity branch August 26, 2026 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

improvement Automatically generated release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants