Skip to content

Desktop app that records your on-screen work session and uses the GitHub Copilot SDK to reconstruct it as an intent + ordered steps, then builds a reusable Skill or Automation for Microsoft Autopilots like Scout, Microsoft Copilot Cowork, or Copilot Studio.

Add 30s startup timeout to Copilot CLI client.start()

Adi Leibowitz (from Dev Box)809cb6340def
diff --git a/electron/copilot-cli-path.ts b/electron/copilot-cli-path.ts
index 9adab38..2146b62 100644
--- a/electron/copilot-cli-path.ts
+++ b/electron/copilot-cli-path.ts
@@ -38,3 +38,23 @@ export function copilotConnectionOption() {
const cliPath = resolveCopilotCliPath();
return cliPath ? { connection: RuntimeConnection.forStdio({ path: cliPath }) } : undefined;
}
+
+/** How long to wait for `client.start()` before giving up. */
+const CLIENT_START_TIMEOUT_MS = 30_000;
+
+/**
+ * Race a promise against a timeout. Rejects with a clear message instead of
+ * hanging indefinitely when the CLI binary can't be found or crashes silently.
+ */
+export function withStartupTimeout<T>(promise: Promise<T>, label: string): Promise<T> {
+ return new Promise<T>((resolve, reject) => {
+ const timer = setTimeout(
+ () => reject(new Error(`${label} did not start within ${CLIENT_START_TIMEOUT_MS / 1000}s. Is the Copilot CLI binary accessible?`)),
+ CLIENT_START_TIMEOUT_MS,
+ );
+ promise.then(
+ (v) => { clearTimeout(timer); resolve(v); },
+ (e) => { clearTimeout(timer); reject(e); },
+ );
+ });
+}
diff --git a/electron/describer/describer.ts b/electron/describer/describer.ts
index efe285d..de96eff 100644
--- a/electron/describer/describer.ts
+++ b/electron/describer/describer.ts
@@ -14,7 +14,7 @@ import type { AnalyzeProgress } from "../../common/ipc";
import type { SessionMeta } from "../../common/types";
import { FrameExtractor } from "../frames/extractor";
import { createLogger } from "../logger";
-import { copilotConnectionOption } from "../copilot-cli-path";
+import { copilotConnectionOption, withStartupTimeout } from "../copilot-cli-path";
import { sessionsRoot, sessionDir, isValidSessionId } from "../recorder/session-store";
import { DESCRIBER_INSTRUCTIONS } from "./instructions";
import { createDescriberTools } from "./tools";
@@ -189,7 +189,7 @@ export class Describer {
const connOpts = copilotConnectionOption();
if (connOpts) log.info("CLI path resolved from node_modules");
const client = new CopilotClient(connOpts);
- await client.start();
+ await withStartupTimeout(client.start(), "Copilot CLI (Describer)");
const auth = await client.getAuthStatus();
if (!auth.isAuthenticated) {
await client.stop().catch(() => undefined);
diff --git a/electron/skillbuilder/builder.ts b/electron/skillbuilder/builder.ts
index f1ca7b0..a4617fb 100644
--- a/electron/skillbuilder/builder.ts
+++ b/electron/skillbuilder/builder.ts
@@ -16,7 +16,7 @@ import {
} from "../../common/skill";
import type { SkillBuildInput, SkillBuildProgress } from "../../common/ipc";
import { loadPersistedAnalysis } from "../describer/describer";
-import { copilotConnectionOption } from "../copilot-cli-path";
+import { copilotConnectionOption, withStartupTimeout } from "../copilot-cli-path";
import { createLogger } from "../logger";
import { isValidSessionId, sessionDir } from "../recorder/session-store";
import { SKILL_BUILDER_INSTRUCTIONS } from "./instructions";
@@ -185,7 +185,7 @@ export class SkillBuilder {
if (this.clientStart) return this.clientStart;
this.clientStart = (async () => {
const client = new CopilotClient(copilotConnectionOption());
- await client.start();
+ await withStartupTimeout(client.start(), "Copilot CLI (SkillBuilder)");
const auth = await client.getAuthStatus();
if (!auth.isAuthenticated) {
await client.stop().catch(() => undefined);