Skip to content

Append Client → Agent → Model tokens to the CLI User-Agent - #3645

Open
sverdlov93 wants to merge 11 commits into
masterfrom
feature/agent-identity-detection
Open

Append Client → Agent → Model tokens to the CLI User-Agent#3645
sverdlov93 wants to merge 11 commits into
masterfrom
feature/agent-identity-detection

Conversation

@sverdlov93

Copy link
Copy Markdown
Contributor

Overview

Enriches the outbound HTTP User-Agent with Client → Agent → Model product tokens when an AI agent is detected, so Artifactory/platform request logs can attribute agent-driven jf invocations. Human sessions stay byte-identical (no suffix).

Depends on jfrog-cli-core#1602 (detection + ExecutionContext.Client / Model).

Details

  • At startup, main.go calls clientutils.SetUserAgent(cliutils.GetCliUserAgentWithAgent()).
  • agentUserAgentSuffix appends ai-agent/<name>, optional ai-client/<TERM_PROGRAM>, optional ai-model/<JFROG_CLI_AI_MODEL> when IsAgent.
  • Identity comes from core DetectExecutionContext() (session markers + sanitization); CLI does not re-implement detection.
  • go.mod pins jfrog-cli-core/v2 to the Update the Go version used to build JFrog CLI to 1.17.12 #1602 tip so this PR compiles for joint review. Active replace is not used (fails No-Replace); a commented replace documents the pin. Re-bump to master tip after Update the Go version used to build JFrog CLI to 1.17.12 #1602 merges.

Supported identity

Axis User-Agent token Source
Agent ai-agent/<name> Core detector table / AI_AGENT / AGENT
Client ai-client/<app> Sanitized TERM_PROGRAM (not an allowlist)
Model ai-model/<slug> Sanitized JFROG_CLI_AI_MODEL

Agent wire names and session signals: see core PR #1602 and the table above agentEnvDetectors in core.

Flow

flowchart LR
  start[main startup] --> detect[DetectExecutionContext]
  detect -->|human| base[base UA only]
  detect -->|IsAgent| suffix["+ ai-agent / ai-client / ai-model"]
  base --> set[SetUserAgent]
  suffix --> set
  set --> http[All jf HTTP via jfrog-client-go]
Loading

Notes

  • Survey hide already uses IsAgent; unchanged aside from detector env clear-lists in tests.
  • After core merges: bump require to the merged pseudo-version and remove the temporary comment on the replace line.
  • Companion: jfrog-skills detect_harness / Coralogix coalescing (separate PR).

Build on ExecutionContext.AIClient/AIModel so agent-driven jf invocations
advertise client app and model alongside ai-agent on the wire.
Match the tightened detector table (Cursor host role, Kilo/Roo/Windsurf signals) so survey and User-Agent tests stay deterministic.
Pin require to jfrog-cli-core PR #1602 tip so UA enrichment compiles; keep replace commented (No-Replace gate).
@sverdlov93 sverdlov93 added the new feature Automatically generated release notes label Aug 6, 2026
Use matching private format consts for ai-agent/ai-client/ai-model, refresh wire-safety comments, and clear client/model env in main_test.
Bump jfrog-cli-core to the tip that drops IDE/config false positives
and update clear-lists plus CLAUDE_CODE_CHILD_SESSION fixtures.
@sverdlov93 sverdlov93 added the safe to test Approve running integration tests on a pull request label Aug 6, 2026
@sverdlov93
sverdlov93 deployed to build-gate August 7, 2026 10:01 — with GitHub Actions Active
@github-actions

github-actions Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

new feature Automatically generated release notes safe to test Approve running integration tests on a pull request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant