Changesets · Branches · Tags · Compare
| Changeset | a17b76b80f6482b751a9d571ddd06dc32917239a4682b391c9eb3fd5a3f9d9ff |
|---|---|
| Author | Nate <sestinj@gmail.com> · 2025-09-10 10:35 -07:00 |
| Committer | Nate <sestinj@gmail.com> · 2025-09-10 10:35 -07:00 |
| Parents | 736b2a5165fa |
3 files changed
modified extensions/cli/src/telemetry/telemetryService.sessionMetadata.test.ts +56 −3
| @@ -126,7 +126,7 @@ | ||
| 126 | 126 | 1, |
| 127 | 127 | expect.objectContaining({ |
| 128 | 128 | is_github_actions: "false", |
| 129 | - ci_environment: "none", | |
| 129 | + is_continue_remote_agent: "false", | |
| 130 | 130 | }), |
| 131 | 131 | ); |
| 132 | 132 | }); |
| @@ -151,7 +151,7 @@ | ||
| 151 | 151 | 1, |
| 152 | 152 | expect.objectContaining({ |
| 153 | 153 | is_github_actions: "true", |
| 154 | - ci_environment: "github_actions", | |
| 154 | + is_continue_remote_agent: "false", | |
| 155 | 155 | }), |
| 156 | 156 | ); |
| 157 | 157 | }); |
| @@ -178,7 +178,60 @@ | ||
| 178 | 178 | expect.objectContaining({ |
| 179 | 179 | is_headless: "true", |
| 180 | 180 | is_github_actions: "true", |
| 181 | - ci_environment: "github_actions", | |
| 181 | + is_continue_remote_agent: "false", | |
| 182 | + }), | |
| 183 | + ); | |
| 184 | + }); | |
| 185 | + | |
| 186 | + it("should include is_continue_remote_agent=true when in remote agent mode", () => { | |
| 187 | + // Set Continue remote agent environment | |
| 188 | + process.env.CONTINUE_REMOTE = "true"; | |
| 189 | + | |
| 190 | + const mockAdd = vi.fn(); | |
| 191 | + const mockRecord = vi.fn(); | |
| 192 | + const service = telemetryService as any; | |
| 193 | + | |
| 194 | + // Mock the session counter and startup time histogram | |
| 195 | + service.sessionCounter = { add: mockAdd }; | |
| 196 | + service.startupTimeHistogram = { record: mockRecord }; | |
| 197 | + service.config = { enabled: true }; | |
| 198 | + service.meter = {}; | |
| 199 | + | |
| 200 | + service.recordSessionStart(); | |
| 201 | + | |
| 202 | + expect(mockAdd).toHaveBeenCalledWith( | |
| 203 | + 1, | |
| 204 | + expect.objectContaining({ | |
| 205 | + is_continue_remote_agent: "true", | |
| 206 | + is_github_actions: "false", | |
| 207 | + }), | |
| 208 | + ); | |
| 209 | + }); | |
| 210 | + | |
| 211 | + it("should include all environment flags when all are true", () => { | |
| 212 | + // Set all environments | |
| 213 | + process.argv = ["node", "cli.js", "-p", "What is the weather?"]; | |
| 214 | + process.env.GITHUB_ACTIONS = "true"; | |
| 215 | + process.env.CONTINUE_REMOTE = "true"; | |
| 216 | + | |
| 217 | + const mockAdd = vi.fn(); | |
| 218 | + const mockRecord = vi.fn(); | |
| 219 | + const service = telemetryService as any; | |
| 220 | + | |
| 221 | + // Mock the session counter and startup time histogram | |
| 222 | + service.sessionCounter = { add: mockAdd }; | |
| 223 | + service.startupTimeHistogram = { record: mockRecord }; | |
| 224 | + service.config = { enabled: true }; | |
| 225 | + service.meter = {}; | |
| 226 | + | |
| 227 | + service.recordSessionStart(); | |
| 228 | + | |
| 229 | + expect(mockAdd).toHaveBeenCalledWith( | |
| 230 | + 1, | |
| 231 | + expect.objectContaining({ | |
| 232 | + is_headless: "true", | |
| 233 | + is_github_actions: "true", | |
| 234 | + is_continue_remote_agent: "true", | |
| 182 | 235 | }), |
| 183 | 236 | ); |
| 184 | 237 | }); |
modified extensions/cli/src/telemetry/telemetryService.ts +4 −2
| @@ -20,7 +20,7 @@ | ||
| 20 | 20 | import { v4 as uuidv4 } from "uuid"; |
| 21 | 21 | |
| 22 | 22 | import { isHeadlessMode } from "../util/cli.js"; |
| 23 | -import { isGitHubActions } from "../util/git.js"; | |
| 23 | +import { isContinueRemoteAgent, isGitHubActions } from "../util/git.js"; | |
| 24 | 24 | import { logger } from "../util/logger.js"; |
| 25 | 25 | import { getVersion } from "../version.js"; |
| 26 | 26 | |
| @@ -354,9 +354,11 @@ | ||
| 354 | 354 | logger.debug("Recording session start with telemetry"); |
| 355 | 355 | |
| 356 | 356 | // Add extra metadata for session breakdown |
| 357 | + const isGitHubActionsEnv = isGitHubActions(); | |
| 357 | 358 | const sessionAttributes = this.getStandardAttributes({ |
| 358 | 359 | is_headless: isHeadlessMode().toString(), |
| 359 | - is_github_actions: isGitHubActions().toString(), | |
| 360 | + is_github_actions: isGitHubActionsEnv.toString(), | |
| 361 | + is_continue_remote_agent: isContinueRemoteAgent().toString(), | |
| 360 | 362 | }); |
| 361 | 363 | |
| 362 | 364 | this.sessionCounter.add(1, sessionAttributes); |
modified extensions/cli/src/util/git.ts +7 −0
| @@ -57,6 +57,13 @@ | ||
| 57 | 57 | return process.env.GITHUB_ACTIONS === "true"; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | +/** | |
| 61 | + * Check if running in Continue remote agents | |
| 62 | + */ | |
| 63 | +export function isContinueRemoteAgent(): boolean { | |
| 64 | + return process.env.CONTINUE_REMOTE === "true"; | |
| 65 | +} | |
| 66 | + | |
| 60 | 67 | /** |
| 61 | 68 | * Get repository URL from GitHub Actions environment variables |
| 62 | 69 | * @returns GitHub repository URL or null if not available |