Elffuss BraidHub

kikocis/continue public

fix: address tests, add is_continue_remote
Changeseta17b76b80f6482b751a9d571ddd06dc32917239a4682b391c9eb3fd5a3f9d9ff
AuthorNate <sestinj@gmail.com> · 2025-09-10 10:35 -07:00
CommitterNate <sestinj@gmail.com> · 2025-09-10 10:35 -07:00
Parents736b2a5165fa

Browse the files at this changeset

3 files changed

modified extensions/cli/src/telemetry/telemetryService.sessionMetadata.test.ts +56 −3
@@ -126,7 +126,7 @@
126126 1,
127127 expect.objectContaining({
128128 is_github_actions: "false",
129- ci_environment: "none",
129+ is_continue_remote_agent: "false",
130130 }),
131131 );
132132 });
@@ -151,7 +151,7 @@
151151 1,
152152 expect.objectContaining({
153153 is_github_actions: "true",
154- ci_environment: "github_actions",
154+ is_continue_remote_agent: "false",
155155 }),
156156 );
157157 });
@@ -178,7 +178,60 @@
178178 expect.objectContaining({
179179 is_headless: "true",
180180 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",
182235 }),
183236 );
184237 });
modified extensions/cli/src/telemetry/telemetryService.ts +4 −2
@@ -20,7 +20,7 @@
2020 import { v4 as uuidv4 } from "uuid";
2121
2222 import { isHeadlessMode } from "../util/cli.js";
23-import { isGitHubActions } from "../util/git.js";
23+import { isContinueRemoteAgent, isGitHubActions } from "../util/git.js";
2424 import { logger } from "../util/logger.js";
2525 import { getVersion } from "../version.js";
2626
@@ -354,9 +354,11 @@
354354 logger.debug("Recording session start with telemetry");
355355
356356 // Add extra metadata for session breakdown
357+ const isGitHubActionsEnv = isGitHubActions();
357358 const sessionAttributes = this.getStandardAttributes({
358359 is_headless: isHeadlessMode().toString(),
359- is_github_actions: isGitHubActions().toString(),
360+ is_github_actions: isGitHubActionsEnv.toString(),
361+ is_continue_remote_agent: isContinueRemoteAgent().toString(),
360362 });
361363
362364 this.sessionCounter.add(1, sessionAttributes);
modified extensions/cli/src/util/git.ts +7 −0
@@ -57,6 +57,13 @@
5757 return process.env.GITHUB_ACTIONS === "true";
5858 }
5959
60+/**
61+ * Check if running in Continue remote agents
62+ */
63+export function isContinueRemoteAgent(): boolean {
64+ return process.env.CONTINUE_REMOTE === "true";
65+}
66+
6067 /**
6168 * Get repository URL from GitHub Actions environment variables
6269 * @returns GitHub repository URL or null if not available