-
Notifications
You must be signed in to change notification settings - Fork 1.9k
fix(coding-agent): resolve kernel venv interpreter for Windows layout #663
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ import { existsSync, mkdirSync, mkdtempSync, realpathSync, rmSync, writeFileSync | |
| import { homedir, tmpdir } from "node:os"; | ||
| import { join } from "node:path"; | ||
| import { afterAll, describe, expect, it } from "vitest"; | ||
| import { venvPython } from "../src/core/kernel/bootstrap.js"; | ||
| import { KernelManager } from "../src/core/kernel/index.js"; | ||
| import { buildRlmBootstrapCode } from "../src/core/tools/ipython.js"; | ||
|
|
||
|
|
@@ -44,7 +45,7 @@ describe("IPython RLM bootstrap", () => { | |
| function resolveKernelPython(): string | null { | ||
| const candidates = [ | ||
| process.env.PRIME_AGENT_KERNEL_PYTHON, | ||
| join(homedir(), ".prime", "agent", "kernel-venv", "bin", "python"), | ||
| venvPython(join(homedir(), ".prime", "agent", "kernel-venv")), | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
On Windows, Useful? React with 👍 / 👎. |
||
| ].filter((p): p is string => Boolean(p)); | ||
| for (const python of candidates) { | ||
| if (!existsSync(python)) continue; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,6 +10,7 @@ import { | |
| getKernelVenvDir, | ||
| type KernelPythonSkill, | ||
| resolveRuntimeIdentity, | ||
| venvPython, | ||
| } from "../src/core/kernel/bootstrap.js"; | ||
|
|
||
| let tempDir = ""; | ||
|
|
@@ -174,6 +175,21 @@ describe("kernel bootstrap", () => { | |
| expect(getKernelVenvDir()).toBe(venv); | ||
| }); | ||
|
|
||
| it("resolves the venv interpreter using the host platform layout", () => { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The commit's Testing section reports only a filtered invocation of this new case and explicitly says the complete file still has 17 failures; it also does not report complete runs of the other two modified test files. The root AGENTS.md reference: AGENTS.md:L30-L31 Useful? React with 👍 / 👎. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This is explicitly the regression for issue #660, but it is added to AGENTS.md reference: AGENTS.md:L32-L33 Useful? React with 👍 / 👎. |
||
| const originalPlatform = process.platform; | ||
| const setPlatform = (value: NodeJS.Platform) => | ||
| Object.defineProperty(process, "platform", { value, configurable: true }); | ||
| try { | ||
| setPlatform("win32"); | ||
| expect(venvPython("C:\\venv")).toBe(join("C:\\venv", "Scripts", "python.exe")); | ||
|
|
||
| setPlatform("linux"); | ||
| expect(venvPython("/venv")).toBe(join("/venv", "bin", "python")); | ||
| } finally { | ||
| setPlatform(originalPlatform); | ||
| } | ||
| }); | ||
|
|
||
| it("bootstraps a missing venv with uv, ipykernel, prime-agent-runtime, and default extra packages", async () => { | ||
| const logPath = installFakeUv(); | ||
| const venv = join(tempDir, "kernel-venv"); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a user-visible fix for Windows kernel startup, but
packages/coding-agent/CHANGELOG.mdremains unchanged with an empty[Unreleased]section. Add a one-line past-tense entry there so the fix is included in the next package release notes, as required by the rootAGENTS.md.AGENTS.md reference: AGENTS.md:L105-L112
Useful? React with 👍 / 👎.