feat(cli): track CLI usage via ConnectionConfig integration header#1517
feat(cli): track CLI usage via ConnectionConfig integration header#1517mishushakov wants to merge 3 commits into
Conversation
Set the `integration` field on the CLI's ConnectionConfig so every API request carries `e2b-cli/<version>` in the User-Agent header, enabling CLI usage and version distribution to be tracked server-side. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
PR SummaryLow Risk Overview The shared
Reviewed by Cursor Bugbot for commit 0e21abf. Bugbot is set up for automated code reviews on this repo. Configure here. |
🦋 Changeset detectedLatest commit: d7d102c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Package ArtifactsBuilt from f0359fb. Download artifacts from this workflow run. JS SDK ( npm install ./e2b-2.31.1-mishushakov-cli-usage-tracking.0.tgzCLI ( npm install ./e2b-cli-2.13.1-mishushakov-cli-usage-tracking.0.tgzPython SDK ( pip install ./e2b-2.30.0+mishushakov.cli.usage.tracking-py3-none-any.whl |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 6d408b1. Configure here.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6d408b15d8
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
The single tagged ConnectionConfig only covered requests routed through the shared API client. Auth, sandbox lifecycle (create/connect/resume/kill/ pause/list/info/metrics/exec) and `template build` commands build their own connection from per-call options and were sending untagged requests. Add a `withCliIntegration` helper (and `CLI_INTEGRATION` constant) and thread it through every such call site so all CLI traffic carries `e2b-cli/<version>` in the User-Agent. No SDK changes. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
0e21abf to
d7d102c
Compare
|
waiting until the backend team enables integration header on the backend |

Tags all CLI traffic to the API with an
e2b-cli/<version>identifier in theUser-Agentheader so CLI usage and version distribution can be tracked server-side, with no SDK changes and no new dependencies.The first commit tagged the shared
ConnectionConfig, but the auth, sandbox-lifecycle, andtemplate buildcommands build their own connection from per-call options and were still sending untagged requests (flagged by Cursor Bugbot + Codex). This adds awithCliIntegrationhelper (and aCLI_INTEGRATIONconstant) inpackages/cli/src/api.tsand threads it through every remaining call site:auth login/configure,sandbox create/connect/resume/kill/pause/list/info/metrics/exec, andtemplate build.integrationis accepted at runtime by everyConnectionConfigthe SDK builds internally, but isn't part of the narrower option types theSandbox.*/Template.*static methods declare — the helper centralizes that single cast so the call sites stay clean. Directnew ConnectionConfig(...)sites (auth) passintegrationinline since the constructor's type already declares it.Usage
Server-side, filter API logs by
User-Agentcontaininge2b-cli/to measure CLI vs SDK traffic and version distribution, broken down by team/user via the existing auth headers.Tests
api_integration_header.test.tscoversCLI_INTEGRATION, the module-level config, and thewithCliIntegrationhelper.create_lifecycle.test.tsnow assertsSandbox.createis called with theintegrationfield, locking in the threading as a regression guard.🤖 Generated with Claude Code