Skip to content

A self-improving RLM agent for coding workflows and long-running autonomous tasks.

Rust

[RSI, performance] perf(kernel): skip pip seeding when creating the kernel venv (#2387)

Seth Kartenfc9f2ae2408a
diff --git a/packages/coding-agent/.changes/kernel-venv-no-seed.md b/packages/coding-agent/.changes/kernel-venv-no-seed.md
new file mode 100644
index 0000000000..6f7f445736
--- /dev/null
+++ b/packages/coding-agent/.changes/kernel-venv-no-seed.md
@@ -0,0 +1 @@
+- Sped up first-run installs by skipping pip/setuptools/wheel seeding when creating the kernel Python venv; every kernel package is installed with `uv pip`, so the seeded tools were never used.
diff --git a/packages/coding-agent/src/core/kernel/bootstrap.ts b/packages/coding-agent/src/core/kernel/bootstrap.ts
index 28f052c698..2c8a597b2c 100644
--- a/packages/coding-agent/src/core/kernel/bootstrap.ts
+++ b/packages/coding-agent/src/core/kernel/bootstrap.ts
@@ -769,7 +769,9 @@ async function bootstrapVenv(
const runtimeIdentity = await resolveRuntimeIdentity();
await run(uv, ["python", "install", PYTHON_VERSION]);
- await run(uv, ["venv", venv, "--python", PYTHON_VERSION, "--seed"]);
+ // Nothing invokes the venv's own pip; every kernel-venv package is installed
+ // through `uv pip install --python`, so the venv is created unseeded.
+ await run(uv, ["venv", venv, "--python", PYTHON_VERSION]);
await run(uv, [
"pip",
"install",
diff --git a/packages/coding-agent/test/kernel-bootstrap.test.ts b/packages/coding-agent/test/kernel-bootstrap.test.ts
index 9b81e7a83d..0e00dd8dde 100644
--- a/packages/coding-agent/test/kernel-bootstrap.test.ts
+++ b/packages/coding-agent/test/kernel-bootstrap.test.ts
@@ -176,7 +176,8 @@ describe("kernel bootstrap", () => {
const log = readFileSync(logPath, "utf8");
expect(log).toContain("python install 3.11");
- expect(log).toContain(`venv ${venv} --python 3.11 --seed`);
+ expect(log).toContain(`venv ${venv} --python 3.11`);
+ expect(log).not.toContain("--seed");
expect(log).toContain("pip install --python");
expect(log).not.toContain("ipykernel");
expect(log).toContain("prime-agent-runtime");
@@ -255,7 +256,7 @@ dependencies = ["httpx"]
await expect(ensureKernelPython({ pythonSkills: [pythonSkill] })).resolves.toBe(python);
const log = readFileSync(logPath, "utf8");
- expect(log).not.toContain(`venv ${venv} --python 3.11 --seed`);
+ expect(log).not.toContain(`venv ${venv} --python 3.11`);
expect(log).toContain(`--editable ${pythonSkill.packagePath}`);
const version = JSON.parse(readFileSync(join(venv, ".bootstrap-version"), "utf8"));
expect(version.pythonSkills[0].pyprojectHash).toBe(pyprojectHash(pythonSkill.pyprojectPath));
@@ -437,7 +438,7 @@ dependencies = ["httpx"]
// A warm venv that needs no work never runs uv, so the log may not exist at all.
const log = existsSync(logPath) ? readFileSync(logPath, "utf8") : "";
- expect(log.includes(`venv ${venv} --python 3.11 --seed`)).toBe(rebuilds);
+ expect(log.includes(`venv ${venv} --python 3.11`)).toBe(rebuilds);
if (rebuilds) {
expect(JSON.parse(readFileSync(join(venv, ".bootstrap-version"), "utf8")).runtime).toBe(runtimeIdentity);
}