Skip to content

Commit 86485c9

Browse files
committed
fix(setup): remove legacy key copy and clarify configuration errors
1 parent cee0e41 commit 86485c9

4 files changed

Lines changed: 6 additions & 10 deletions

File tree

‎scripts/setup-learning.test.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ test("fresh managed setup creates and verifies the selected project's container
132132
const content = await readFile(f.envPath, "utf8");
133133
expect(content).toContain("# Keep my other configuration");
134134
expect(parseEnv(content)).toMatchObject({
135-
INTELLIGENCE_API_KEY: key,
135+
CPK_INTELLIGENCE_API_KEY: key,
136+
INTELLIGENCE_API_KEY: "",
136137
CPK_INTELLIGENCE_LEARNING_CONTAINER_ID: "openbot",
137138
OPENAI_API_KEY: "synthetic-model",
138139
});

‎scripts/setup-learning.ts‎

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -228,8 +228,7 @@ export async function setupLearning(
228228
"The selected project is invalid. Run npx --yes copilotkit@latest project select again.",
229229
);
230230
}
231-
// A saved record alone does not prove a stale CPK key belongs to it. Re-provision here.
232-
// CLI project select removes INTELLIGENCE_API_KEY, hence the precondition above.
231+
// No runtime key is available. Provision one for the saved project before assigning Learning.
233232
const provision = await run(
234233
["project", "select", "--project", projectId, "--json"],
235234
directory,
@@ -286,11 +285,7 @@ export async function setupLearning(
286285
"The CLI did not write a runtime key. Run project select and this helper again.",
287286
);
288287
}
289-
const content = upsert(
290-
upsert(current, "INTELLIGENCE_API_KEY", key),
291-
CONTAINER,
292-
"openbot",
293-
);
288+
const content = upsert(current, CONTAINER, "openbot");
294289
await saveEnvironment(envPath, content);
295290
return "configured";
296291
}

‎server/src/config.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -958,7 +958,7 @@ function runtimeCapabilities(environment: Environment): RuntimeCapabilities {
958958
const missing = Object.entries({
959959
INTELLIGENCE_API_URL: settings.apiUrl,
960960
INTELLIGENCE_GATEWAY_WS_URL: settings.gatewayWsUrl,
961-
INTELLIGENCE_API_KEY: settings.apiKey,
961+
"CPK_INTELLIGENCE_API_KEY (or INTELLIGENCE_API_KEY)": settings.apiKey,
962962
})
963963
.filter(([, value]) => !value)
964964
.map(([name]) => name);

‎server/tests/config.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ describe("deployment configuration", () => {
132132
delete environment[name];
133133

134134
expect(() => loadConfig(environment)).toThrow(
135-
`CopilotKit Intelligence is required and is not configured. Missing: ${name}`,
135+
`CopilotKit Intelligence is required and is not configured. Missing: ${name === "INTELLIGENCE_API_KEY" ? "CPK_INTELLIGENCE_API_KEY (or INTELLIGENCE_API_KEY)" : name}`,
136136
);
137137
});
138138

0 commit comments

Comments
 (0)