Skip to content

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

Rust

ci runs the kernel e2e suites that still skipped silently (#3245)

Sebastian Müller5075d7b415c1
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 80f03891f1..f54387b157 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -239,7 +239,7 @@ jobs:
# partial hit and compile the rest. Slower hits, no correctness
# issue.
shared-key: test-shards
- - name: Install uv (the kernel tests bootstrap the Python kernel venv with it)
+ - name: Install uv (the kernel venv bootstrap below uses it)
run: |
python3 -m pip install --user uv
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
diff --git a/crates/pa-core/tests/abort_kernel_cell.rs b/crates/pa-core/tests/abort_kernel_cell.rs
index 6d517c7b6a..95a0d072a0 100644
--- a/crates/pa-core/tests/abort_kernel_cell.rs
+++ b/crates/pa-core/tests/abort_kernel_cell.rs
@@ -55,38 +55,6 @@ fn kernel_python() -> Option<PathBuf> {
None
}
-/// The installed release directory (ships `prime-agent-runtime/`): the same
-/// resolution the sibling live-kernel verifier uses.
-fn release_dir() -> Option<PathBuf> {
- if let Some(explicit) = std::env::var_os("PI_PACKAGE_DIR") {
- let explicit = PathBuf::from(explicit);
- assert!(
- explicit.join("prime-agent-runtime").exists(),
- "PI_PACKAGE_DIR {} has no prime-agent-runtime",
- explicit.display()
- );
- return Some(explicit);
- }
- let releases = PathBuf::from(std::env::var("HOME").map_or_else(
- |_| "/home/ubuntu/.local/share/prime-agent/releases".to_string(),
- |home| format!("{home}/.local/share/prime-agent/releases"),
- ));
- let Ok(entries) = std::fs::read_dir(&releases) else {
- eprintln!(
- "no releases dir at {}; skipping live kernel test",
- releases.display()
- );
- return None;
- };
- let mut candidates: Vec<PathBuf> = entries
- .filter_map(Result::ok)
- .map(|entry| entry.path())
- .filter(|path| path.join("prime-agent-runtime").is_dir())
- .collect();
- candidates.sort();
- candidates.pop()
-}
-
/// Scoped process-env overrides: applied on construction, restored on drop.
struct EnvOverride {
saved: Vec<(String, Option<String>)>,
@@ -149,9 +117,6 @@ async fn abort_during_a_kernel_cell_settles_the_turn_immediately() {
let Some(kernel_python) = kernel_python() else {
return;
};
- let Some(release) = release_dir() else {
- return;
- };
let dir = tempfile::tempdir().expect("temp dir");
let agent_dir = dir.path().join("agent");
let sessions_dir = agent_dir.join("sessions");
@@ -166,7 +131,6 @@ async fn abort_during_a_kernel_cell_settles_the_turn_immediately() {
"PRIME_AGENT_KERNEL_PYTHON",
Some(kernel_python.display().to_string()),
),
- ("PI_PACKAGE_DIR", Some(release.display().to_string())),
("PRIME_AGENT_CODING_AGENT_DIR", None),
("PRIME_API_KEY", None),
]);
diff --git a/crates/pa-core/tests/turn_boundary_kernel.rs b/crates/pa-core/tests/turn_boundary_kernel.rs
index adcd975df5..a4ba008d84 100644
--- a/crates/pa-core/tests/turn_boundary_kernel.rs
+++ b/crates/pa-core/tests/turn_boundary_kernel.rs
@@ -64,46 +64,6 @@ fn kernel_python() -> Option<PathBuf> {
None
}
-/// The installed release directory (ships `prime-agent-runtime/` and the
-/// bundled skill packages): `PI_PACKAGE_DIR` wins, else the newest release
-/// under ~/.local/share/prime-agent/releases. Skipped when absent.
-fn release_dir() -> Option<PathBuf> {
- if let Some(explicit) = std::env::var_os("PI_PACKAGE_DIR") {
- let explicit = PathBuf::from(explicit);
- assert!(
- explicit.join("prime-agent-runtime").exists(),
- "PI_PACKAGE_DIR {} has no prime-agent-runtime",
- explicit.display()
- );
- return Some(explicit);
- }
- let releases = PathBuf::from(std::env::var("HOME").map_or_else(
- |_| "/home/ubuntu/.local/share/prime-agent/releases".to_string(),
- |home| format!("{home}/.local/share/prime-agent/releases"),
- ));
- let Ok(entries) = std::fs::read_dir(&releases) else {
- eprintln!(
- "no releases dir at {}; skipping live kernel test",
- releases.display()
- );
- return None;
- };
- let mut candidates: Vec<PathBuf> = entries
- .filter_map(Result::ok)
- .map(|entry| entry.path())
- .filter(|path| path.join("prime-agent-runtime").is_dir() && path.join("skills").is_dir())
- .collect();
- candidates.sort();
- let Some(latest) = candidates.pop() else {
- eprintln!(
- "no release with prime-agent-runtime under {}; skipping live kernel test",
- releases.display()
- );
- return None;
- };
- Some(latest)
-}
-
/// Scoped process-env overrides: applied on construction, restored on drop.
/// This binary carries exactly one live-kernel test, so nothing races.
struct EnvOverride {
@@ -176,9 +136,6 @@ async fn turn_boundary_host_requests_round_trip_through_a_real_kernel() {
let Some(kernel_python) = kernel_python() else {
return;
};
- let Some(release) = release_dir() else {
- return;
- };
let dir = tempfile::tempdir().expect("temp dir");
let agent_dir = dir.path().join("agent");
let sessions_dir = agent_dir.join("sessions");
@@ -187,14 +144,13 @@ async fn turn_boundary_host_requests_round_trip_through_a_real_kernel() {
std::fs::create_dir_all(&cwd).expect("project dir");
let receipt_path = dir.path().join("harness-receipt.json");
- // Hermeticity: the kernel runs on the installed runtime (PI_PACKAGE_DIR +
- // the ambient kernel venv), and no ambient agent state leaks in.
+ // Hermeticity: the kernel runs on the bootstrapped kernel venv, and no
+ // ambient agent state leaks in.
let _env = EnvOverride::apply(&[
(
"PRIME_AGENT_KERNEL_PYTHON",
Some(kernel_python.display().to_string()),
),
- ("PI_PACKAGE_DIR", Some(release.display().to_string())),
("PRIME_AGENT_CODING_AGENT_DIR", None),
("PRIME_API_KEY", None),
]);
diff --git a/crates/pa-daemon/src/agent_engine/tests/abort.rs b/crates/pa-daemon/src/agent_engine/tests/abort.rs
index e8520eb7dc..61807b7ee9 100644
--- a/crates/pa-daemon/src/agent_engine/tests/abort.rs
+++ b/crates/pa-daemon/src/agent_engine/tests/abort.rs
@@ -540,25 +540,6 @@ fn live_kernel_python() -> Option<std::path::PathBuf> {
None
}
-#[cfg(test)]
-fn live_release_dir() -> Option<std::path::PathBuf> {
- let releases = std::path::PathBuf::from(std::env::var("HOME").map_or_else(
- |_| "/home/ubuntu/.local/share/prime-agent/releases".to_string(),
- |home| format!("{home}/.local/share/prime-agent/releases"),
- ));
- let Ok(entries) = std::fs::read_dir(&releases) else {
- eprintln!("no releases dir at {releases:?}; skipping live kernel test");
- return None;
- };
- let mut candidates: Vec<std::path::PathBuf> = entries
- .filter_map(Result::ok)
- .map(|entry| entry.path())
- .filter(|path| path.join("prime-agent-runtime").is_dir())
- .collect();
- candidates.sort();
- candidates.pop()
-}
-
/// The abort wedge repro (dogfood P0): a turn executing a long kernel cell
/// must unwind at `abort_in_flight_turn` (the kernel interrupt +
/// force-abort path settles the tool race) - not keep the turn alive while
@@ -569,15 +550,11 @@ fn abort_in_flight_turn_cancels_a_running_kernel_cell() {
let Some(kernel_python) = live_kernel_python() else {
return;
};
- let Some(release) = live_release_dir() else {
- return;
- };
let _env = KernelEnvOverride::apply(&[
(
"PRIME_AGENT_KERNEL_PYTHON",
Some(kernel_python.display().to_string()),
),
- ("PI_PACKAGE_DIR", Some(release.display().to_string())),
("PRIME_AGENT_CODING_AGENT_DIR", None),
("PRIME_API_KEY", None),
]);
diff --git a/crates/pa-daemon/src/worker/tests/goal_tests.rs b/crates/pa-daemon/src/worker/tests/goal_tests.rs
index ebf6b57396..598d308f26 100644
--- a/crates/pa-daemon/src/worker/tests/goal_tests.rs
+++ b/crates/pa-daemon/src/worker/tests/goal_tests.rs
@@ -201,8 +201,8 @@ async fn compact_with_paused_goal_never_continues() {
/// `goal.complete()` (the scripted ipython tool call, the f18
/// completion surface) settles the goal, and the completion's
/// boundary mints nothing more. The completing cell needs a
-/// bootable kernel: a sandbox gate run must provide uv and
-/// `PI_PACKAGE_DIR` at the checkout (the guard inside names the
+/// bootable kernel: a gate run needs the kernel venv, bootstrapped
+/// or built with uv on PATH (the guard inside names the
/// recipe when the cell fails instead of letting the loop drain
/// the faux script into a misleading count mismatch).
#[allow(clippy::await_holding_lock)] // the faux registry is process-global: the guard must span the async flow
@@ -260,8 +260,8 @@ async fn goal_turn_end_loop_runs_to_completion() {
let idle = worker.dispatch("wait_for_idle", &json!({})).await;
assert!(idle.success, "the goal loop never settled: {idle:?}");
let events = session_events_since(&mut subscription);
- // A gate run without the kernel environment (uv on PATH and
- // PI_PACKAGE_DIR at the checkout) fails the
+ // A gate run without the kernel environment (the kernel venv, or
+ // uv on PATH to build it) fails the
// completing ipython cell: the goal stays active and the loop
// keeps minting (TS parity: goal continuations are unbounded while
// the goal is active) until the faux script runs dry. Fail with
@@ -275,7 +275,7 @@ async fn goal_turn_end_loop_runs_to_completion() {
if let Some(failure) = kernel_failure {
panic!(
"the completing ipython cell failed — this test needs the kernel \
- environment (uv on PATH and PI_PACKAGE_DIR at the checkout): {failure:?}"
+ environment (the bootstrapped kernel venv, or uv on PATH to build it): {failure:?}"
);
}
// Each minted continuation ran as a queued follow-up turn: the
diff --git a/crates/pa-daemon/tests/abort_kernel_e2e.rs b/crates/pa-daemon/tests/abort_kernel_e2e.rs
index 7aee3417d9..87fb3bc90e 100644
--- a/crates/pa-daemon/tests/abort_kernel_e2e.rs
+++ b/crates/pa-daemon/tests/abort_kernel_e2e.rs
@@ -15,9 +15,8 @@ use std::time::{Duration, Instant};
use serde_json::{json, Value};
-/// The kernel Python with prime-agent-runtime installed; the release dir
-/// ships the runtime sidecar. Skipped (with a note) on machines without a
-/// live install.
+/// The kernel Python with prime-agent-runtime installed. Skipped (with a
+/// note) on machines without a live install.
fn kernel_python() -> Option<PathBuf> {
let candidate = PathBuf::from(std::env::var("HOME").map_or_else(
|_| "/home/ubuntu/.prime/agent/kernel-venv/bin/python".to_string(),
@@ -33,27 +32,6 @@ fn kernel_python() -> Option<PathBuf> {
None
}
-fn release_dir() -> Option<PathBuf> {
- let releases = PathBuf::from(std::env::var("HOME").map_or_else(
- |_| "/home/ubuntu/.local/share/prime-agent/releases".to_string(),
- |home| format!("{home}/.local/share/prime-agent/releases"),
- ));
- let Ok(entries) = std::fs::read_dir(&releases) else {
- eprintln!(
- "no releases dir at {}; skipping live kernel test",
- releases.display()
- );
- return None;
- };
- let mut candidates: Vec<PathBuf> = entries
- .filter_map(Result::ok)
- .map(|entry| entry.path())
- .filter(|path| path.join("prime-agent-runtime").is_dir())
- .collect();
- candidates.sort();
- candidates.pop()
-}
-
/// The faux provider script: turn one calls the kernel with a cell that
/// writes its start marker, sleeps far past the abort budget, and would
/// write its finish marker afterwards. Turn two answers the (never
@@ -117,7 +95,6 @@ fn spawn_supervisor(socket: &Path, agent_dir: &Path, script: &Path) -> Superviso
"PRIME_AGENT_KERNEL_PYTHON",
kernel_python().expect("kernel python"),
)
- .env("PI_PACKAGE_DIR", release_dir().expect("release dir"))
.env(
pa_daemon::worker::WORKER_SUPERVISOR_LOST_EXIT_MS_ENV,
"15000",
@@ -253,9 +230,6 @@ fn abort_during_a_kernel_cell_settles_the_daemon_turn_immediately() {
let Some(_) = kernel_python() else {
return;
};
- let Some(_) = release_dir() else {
- return;
- };
let dir = tempfile::TempDir::new().expect("temp dir");
let agent_dir = dir.path().join("agent");
let session_dir = agent_dir.join("sessions");
diff --git a/crates/pa-daemon/tests/fd_lifecycle_e2e.rs b/crates/pa-daemon/tests/fd_lifecycle_e2e.rs
index ca8d2bf2ad..b0f6ab9ffc 100644
--- a/crates/pa-daemon/tests/fd_lifecycle_e2e.rs
+++ b/crates/pa-daemon/tests/fd_lifecycle_e2e.rs
@@ -219,9 +219,10 @@ fn worker_pid(agent_dir: &Path, socket_path: &Path, worker_id: &str) -> Option<u
.map(|p| p as u32)
}
+#[track_caller]
fn wait_until(deadline: Duration, mut probe: impl FnMut() -> bool) {
- let deadline = Instant::now() + deadline;
- while Instant::now() < deadline {
+ let end = Instant::now() + deadline;
+ while Instant::now() < end {
if probe() {
return;
}
@@ -424,7 +425,7 @@ fn worker_fd_count_stable_across_prompts() {
);
assert_eq!(client.read_response("a0")["success"], true, "attach failed");
- let mut counts: Vec<usize> = Vec::new();
+ let mut baseline: Option<usize> = None;
for turn in 0..PROMPTS {
let id = format!("p{turn}");
client.send_command(
@@ -446,18 +447,15 @@ fn worker_fd_count_stable_across_prompts() {
fd_classes(&worker_fds),
supervisor_fds.len(),
);
- counts.push(worker_fds.len());
+ // The turn's roster pushes each dial their own supervisor-link
+ // socket and may still be in flight after the reply; a leaked
+ // fd never drains, a push's socket does.
+ let baseline = *baseline.get_or_insert(worker_fds.len());
+ wait_until(Duration::from_secs(10), || {
+ fd_snapshot(pid).len() <= baseline + FD_SLACK
+ });
}
}
-
- let baseline = counts[0];
- for (index, count) in counts.iter().enumerate() {
- assert!(
- *count <= baseline + FD_SLACK,
- "worker fd count grew across turns: baseline {baseline}, sample {index} count {count} ({:?})",
- fd_classes(&fd_snapshot(pid))
- );
- }
}
// ---------------------------------------------------------------------------
diff --git a/crates/pa-daemon/tests/idle_passivation_e2e.rs b/crates/pa-daemon/tests/idle_passivation_e2e.rs
index b950c22bce..66aba37dab 100644
--- a/crates/pa-daemon/tests/idle_passivation_e2e.rs
+++ b/crates/pa-daemon/tests/idle_passivation_e2e.rs
@@ -125,13 +125,30 @@ impl Client {
}
}
-/// The kernel Python with the runtime installed (the child's kernel cell).
+/// The kernel Python with prime-agent-runtime installed; set
+/// `PA_E2E_KERNEL_PYTHON` to point at an explicit interpreter instead.
fn kernel_python() -> Option<PathBuf> {
- let path = std::env::var("PA_TEST_KERNEL_PYTHON")
- .ok()
- .filter(|value| !value.is_empty())
- .map(PathBuf::from);
- path.filter(|p| p.exists())
+ if let Some(explicit) = std::env::var_os("PA_E2E_KERNEL_PYTHON") {
+ let explicit = PathBuf::from(explicit);
+ assert!(
+ explicit.exists(),
+ "PA_E2E_KERNEL_PYTHON {} not found",
+ explicit.display()
+ );
+ return Some(explicit);
+ }
+ let candidate = PathBuf::from(std::env::var("HOME").map_or_else(
+ |_| "/home/ubuntu/.prime/agent/kernel-venv/bin/python".to_string(),
+ |home| format!("{home}/.prime/agent/kernel-venv/bin/python"),
+ ));
+ if candidate.exists() {
+ return Some(candidate);
+ }
+ eprintln!(
+ "kernel python {} not found; skipping live passivation e2e",
+ candidate.display()
+ );
+ None
}
/// The worker's token from its persisted descriptor (the same lookup the
@@ -192,7 +209,6 @@ fn write_faux_script(dir: &Path, name: &str, responses: &Value) -> PathBuf {
#[tokio::test]
async fn a_settled_child_passivates_stays_listable_and_revives_by_agent_message() {
let Some(kernel_python) = kernel_python() else {
- eprintln!("kernel python unavailable; skipping the passivation e2e");
return;
};
let dir = tempfile::TempDir::new().expect("temp dir");
@@ -477,7 +493,6 @@ async fn a_settled_child_passivates_stays_listable_and_revives_by_agent_message(
#[tokio::test]
async fn an_idle_root_passivates_and_resumes_by_its_durable_id_with_its_transcript() {
let Some(kernel_python) = kernel_python() else {
- eprintln!("kernel python unavailable; skipping the root passivation e2e");
return;
};
let dir = tempfile::TempDir::new().expect("temp dir");
diff --git a/crates/pa-daemon/tests/steer_boundary_batch_e2e.rs b/crates/pa-daemon/tests/steer_boundary_batch_e2e.rs
index c3d1b6267f..29a5379abd 100644
--- a/crates/pa-daemon/tests/steer_boundary_batch_e2e.rs
+++ b/crates/pa-daemon/tests/steer_boundary_batch_e2e.rs
@@ -47,9 +47,8 @@ use std::time::{Duration, Instant};
use serde_json::{json, Value};
-/// The kernel Python with prime-agent-runtime installed; the release dir
-/// ships the runtime sidecar. Skipped (with a note) on machines without a
-/// live install.
+/// The kernel Python with prime-agent-runtime installed. Skipped (with a
+/// note) on machines without a live install.
fn kernel_python() -> Option<PathBuf> {
let candidate = PathBuf::from(std::env::var("HOME").map_or_else(
|_| "/home/ubuntu/.prime/agent/kernel-venv/bin/python".to_string(),
@@ -65,27 +64,6 @@ fn kernel_python() -> Option<PathBuf> {
None
}
-fn release_dir() -> Option<PathBuf> {
- let releases = PathBuf::from(std::env::var("HOME").map_or_else(
- |_| "/home/ubuntu/.local/share/prime-agent/releases".to_string(),
- |home| format!("{home}/.local/share/prime-agent/releases"),
- ));
- let Ok(entries) = std::fs::read_dir(&releases) else {
- eprintln!(
- "no releases dir at {}; skipping live kernel test",
- releases.display()
- );
- return None;
- };
- let mut candidates: Vec<PathBuf> = entries
- .filter_map(Result::ok)
- .map(|entry| entry.path())
- .filter(|path| path.join("prime-agent-runtime").is_dir())
- .collect();
- candidates.sort();
- candidates.pop()
-}
-
/// The faux provider script: the long turn's first model response calls a
/// kernel cell that sleeps (the tool-call boundary the steers queue
/// behind), and the scripted replies behind it name every delivery —
@@ -154,7 +132,6 @@ fn spawn_supervisor(socket: &Path, agent_dir: &Path, script: &Path) -> Superviso
"PRIME_AGENT_KERNEL_PYTHON",
kernel_python().expect("kernel python"),
)
- .env("PI_PACKAGE_DIR", release_dir().expect("release dir"))
.env(
pa_daemon::worker::WORKER_SUPERVISOR_LOST_EXIT_MS_ENV,
"15000",
@@ -287,9 +264,6 @@ fn multi_steer_parked_mid_run_co_delivers_as_one_batched_turn() {
let Some(_kernel) = kernel_python() else {
return;
};
- let Some(_release) = release_dir() else {
- return;
- };
let dir = tempfile::TempDir::new().expect("temp dir");
let agent_dir = dir.path().join("agent");
let cwd = dir.path().join("work");
diff --git a/crates/pa-daemon/tests/supervisor_e2e/read_goldens.rs b/crates/pa-daemon/tests/supervisor_e2e/read_goldens.rs
index 0c4a090041..55f58013fe 100644
--- a/crates/pa-daemon/tests/supervisor_e2e/read_goldens.rs
+++ b/crates/pa-daemon/tests/supervisor_e2e/read_goldens.rs
@@ -61,15 +61,11 @@ fn session_stats_and_header_match_live_daemon_goldens() {
"p1",
&serde_json::json!({ "type": "prompt", "activeSessionId": session_id, "message": "hi" }),
);
- let ack = client.read_response("p1");
+ let (ack, mut turn_lines) = client.read_response_and_lines("p1");
assert_eq!(ack["success"], true, "prompt failed: {ack}");
- // Drain the streamed turn until it settles.
- loop {
- let line = client.read_line();
- if line["type"] == "session_event" && line["event"]["type"].as_str() == Some("turn_end") {
- break;
- }
- }
+ // The turn's events may precede the prompt reply (TS order), so the
+ // lines buffered during the ack count toward the drain.
+ client.take_session_event(&mut turn_lines, "turn_end");
// get_session_header: same key set and header shape as the TS golden:
// {"header": { type, version, id, timestamp, cwd, parentSession?, rlmDepth?, git? }}.