Repository navigation
feat: stamp the coding agent in the request origin - #332
erikengervall wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
All reported issues were addressed across 18 files
Shadow auto-approve: would not auto-approve because issues were found.
View guided diff | Turn on auto-fix | Re-trigger cubic
There was a problem hiding this comment.
0 issues found across 11 files (changes from recent commits).
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Shadow auto-approve: would require human review. Adds agent-stamped request origins across many CLI API paths with an opt-out; needs human sign-off because it changes telemetry data sent by default and relies on unverified API compatibility for the new origin field (especially monitor).
View guided diff | Turn on auto-fix | Re-trigger cubic
224cb64 to
e69d046
Compare
|
@cubic review |
There was a problem hiding this comment.
1 issue found across 19 files
Confidence score: 5/5
agent-origin.test.tsdoes not cover three Codex install markers, so regressions in their detection could go unnoticed. Add table rows forCODEX_MANAGED_BY_BUN,CODEX_MANAGED_BY_PNPM, andCODEX_MANAGED_BY_VITE_PLUS.
Prompt for AI agents (unresolved issues)
Check if these issues are valid — if so, understand the root cause of each and fix them. When an issue isn't valid or won't be fixed in this PR, reply in its thread with the reason and then resolve the thread. If appropriate, use sub-agents to investigate and fix each issue separately.
<file name="src/__tests__/utils/agent-origin.test.ts">
<violation number="1" location="src/__tests__/utils/agent-origin.test.ts:14">
P3: The detection table omits tests for three Codex install markers. Add rows for `CODEX_MANAGED_BY_BUN`, `CODEX_MANAGED_BY_PNPM` and `CODEX_MANAGED_BY_VITE_PLUS` so a regression in any of them is caught.</violation>
</file>
Shadow auto-approve: would not auto-approve because issues were found.
View guided diff | Turn on auto-fix | Re-trigger cubic
There was a problem hiding this comment.
0 issues found across 1 file (changes from recent commits).
Confidence score: 5/5
- Automated review surfaced no issues in the provided summaries.
- No files require special attention.
Shadow auto-approve: would require human review. Adds agent-detected origin stamping (cli.<agent>@<version>) to CLI API requests with an env opt-out. Needs human sign-off: default telemetry change and unverified API-side acceptance of the new origin field on monitor/direct paths.
View guided diff | Turn on auto-fix | Re-trigger cubic
Summary
The CLI now stamps the coding agent that runs it into the request origin:
cli.<agent>@<cli version>when an agent is detected,cli@<cli version>otherwise.integration: 'cli'is unchanged everywhere, and the keylessX-Origin: cliheader is kept as is.src/utils/agent-origin.tscomputes the origin once per process from environment variables that agents set in the processes they spawn (no config files on disk).FIRECRAWL_CLI_DISABLE_AGENT_ORIGIN=1sends plaincli@<version>. Documented in the README.Where the origin is sent
origininteract,feedback,search-feedback,parseoriginmonitorcreate and updateoriginresearch,developer,govGETsoriginquery parameter next tointegration=clioriginclient optionSDK-routed calls (
firecrawl@4.44.0, the version the CLI pins) carry the agent only after the SDK bump: that version has nooriginclient option and its HTTP client overwrites a body origin unless it contains "mcp". The CLI passesoriginas a client option now; SDKs without it ignore the option, so nothing changes until the SDK ships support. The direct fetch paths above carry the agent immediately. Requests that have no origin field (credit usage, status, doctor, exchange calls) are unchanged.Detected agents and sources
claude-codeCLAUDECODE,CLAUDE_CODE_ENTRYPOINTCLAUDECODEset for Bash tool commands); anthropics/claude-code-action@c9ec2b0 (CLAUDE_CODE_ENTRYPOINT)codexCODEX_SANDBOX,CODEX_SANDBOX_NETWORK_DISABLED,CODEX_THREAD_ID,CODEX_MANAGED_BY_NPM/BUN/PNPM/VITE_PLUScursorCURSOR_AGENTgemini-cliGEMINI_CLIopencodeOPENCODEprocess.env.OPENCODE = "1"in https://github.com/anomalyco/opencode/blob/dev/packages/opencode/src/index.tsgooseGOOSE_TERMINALclineCLINE_ACTIVEDropped because they could not be verified from public docs or source:
CURSOR_TRACE_ID: no public documentation, and it is likely present in every Cursor terminal, including ones a person types in.AMP_*variables are user configuration, not a runtime marker, andAGENT=amponly appears in third-party reports.Testing
pnpm type-check,pnpm format:check,pnpm testpass (716 tests).origin: 'cli'or the bareintegration=cliquery now build the expected value withgetCliOrigin(), so they pass when run inside an agent.Summary by cubic
The CLI now stamps the coding agent that runs it into the API request origin:
cli.<agent>@<version>when an agent is detected,cli@<version>otherwise.integration: 'cli'and the keylessX-Origin: cliheader are unchanged.Details
FIRECRAWL_CLI_DISABLE_AGENT_ORIGIN=1(ortrue,yes,on) restores plaincli@<version>and is documented in the README.developer,research, andgov, and the body origin ininteract,feedback,search-feedback,parse, andmonitorcreate/update; the API now acceptsoriginon monitor create and update.originas a client option; SDKs without support ignore it, so those requests carry the agent only after the matching SDK release.Written for commit 134243a. Summary will update on new commits.