Skip to content

fix(cli): let an agent's own name beat editor and host markers - #7424

Merged
jrusso1020 merged 1 commit into
mainfrom
agent-runtimes-editor-last
Nov 9, 2026
Merged

jrusso1020 merged 1 commit into
mainfrom
agent-runtimes-editor-last

Conversation

@jrusso1020

Copy link
Copy Markdown
Collaborator

What

An agent recognised only by its own name (AI_AGENT, or a known name in AGENT) now wins over the editor and host markers. TERM_PROGRAM=cursor|windsurf and Replit's REPL_ID/REPLIT_USER move into their own list, checked after the name check.

Why

Follow-up to #7423 review. Those markers only say where a shell runs, not who drives it. Before this, AI_AGENT=amp in a Cursor terminal reported cursor, AGENT=devin_… in Replit reported replit, and an unknown AI_AGENT in Cursor lost its discovery hints, which are only sent for null and other_ai_agent.

Related work

Refs #7423

How

  • WORKSPACE_RULES holds the Cursor terminal, Windsurf and Replit rules. detectAgentRuntime checks VENDOR_RULES, then the name fallback, then WORKSPACE_RULES.
  • isAgentDriven never counted those rules, so they are left out of it entirely. That left agentOnly with no users, so it is removed.

Test plan

  • Unit tests added: Amp in Cursor, Devin (via AGENT) in Replit, unknown AI_AGENT in Windsurf. Existing editor/person tests unchanged.
  • vitest run src/telemetry src/utils/attendedTerminal.test.ts: 460/460; tsc --noEmit; comment gates pass.
  • Manual testing performed
  • Comments follow CONTRIBUTING.md "Comments"

— Rames

🤖 Generated with Claude Code

TERM_PROGRAM=cursor|windsurf and Replit's REPL_ID only say where a shell
runs. They now sit in their own list, checked after the AI_AGENT / AGENT
name check, so Amp in a Cursor terminal or Devin in Replit report as
themselves, and an unknown AI_AGENT there keeps its discovery hints.
agentOnly had no users left, so it is gone.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@jrusso1020

Copy link
Copy Markdown
Collaborator Author

@genesis-code-reviewer could you review this follow-up to #7423? It addresses your inline finding there: name-only agents (AI_AGENT, or a known AGENT name) now win over the Cursor/Windsurf/Replit markers, with an Amp-in-Cursor test.

— Rames

@github-actions

github-actions Bot commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 267 (base branch 267), smooth 125 of those

The gate passes.
Smoothness is reported in the artifact, not gated. A case fails only if it fails 2 of 3 runs.

Quarantined, measured but not gated (8)

@heygengenesis heygengenesis Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Verdict: APPROVE · 0 blocker · 0 important · 1 nit

  • nit: packages/cli/src/telemetry/agent_runtime.ts:155, in the Cline rule comment: "Same integrated-terminal-only scope as the Cursor/Windsurf rules above." Those rules now live in WORKSPACE_RULES further down, so "above" points the wrong way.
Scope

Read both changed files in full and the callers of detectAgentRuntime/isAgentDriven (login, attendedTerminal, desktopApp, feedback, telemetryIdentity, system). isAgentDriven behaves the same as before: workspace rules had agentOnly: () => false and are now just left out. The new order matches @vercel/detect-agent 1.2.7, which also reads AI_AGENT before REPL_ID. CI is green on daad420; the PR is blocked only on review.

— Genesis

@jrusso1020
jrusso1020 added this pull request to the merge queue Nov 9, 2026
Merged via the queue into main with commit c1e96a4 Nov 9, 2026
84 checks passed
@jrusso1020
jrusso1020 deleted the agent-runtimes-editor-last branch November 9, 2026 02:38
@miguel-heygen miguel-heygen mentioned this pull request Nov 9, 2026
3 of 4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant