fix(runtime): sweep node wrapper processes hosting managed agent shims (#1296)

Signed-off-by: Will Pfleger <pfleger.will@gmail.com>
Co-authored-by: npub1mn7jgtj4w2pd0g0zeuhxsa6jy6p0rewxz4kujt98my82ahfmp72sxjexk7 <dcfd242e557282d7a1e2cf2e6877522682f1e5c6156dc92ca7d90eaedd3b0f95@sprout-oss.stage.blox.sqprod.co>
Co-authored-by: npub1fgdl5qqnh3k3f2xkqrvt7cujalhm623x4s7fdjdj5yrtp5fzjl9qrjpucw <4a1bfa0013bc6d14a8d600d8bf6392efefbd2a26ac3c96c9b2a106b0d12297ca@sprout-oss.stage.blox.sqprod.co>
This commit is contained in:
Will Pfleger
2026-06-25 17:06:59 -04:00
committed by GitHub
parent 8717ddf2eb
commit f072032aaf
8 changed files with 104 additions and 28 deletions

View File

@@ -544,3 +544,35 @@ fn runtime_metadata_env_vars_injects_model_even_with_acp_model_switching() {
]
);
}
// ── name_matches_known_binary / name_matches_interpreter tests ───────────
#[test]
fn name_matches_known_binary_rejects_node() {
// `node` must NOT be in KNOWN_AGENT_BINARIES — adding it there would
// sweep all node processes on the machine regardless of ownership.
assert!(!super::name_matches_known_binary("node"));
}
#[test]
fn name_matches_interpreter_accepts_node() {
// `node` IS a known script interpreter and must be recognized.
assert!(super::name_matches_interpreter("node"));
}
#[test]
fn name_matches_interpreter_rejects_unknown() {
// Interpreters not in KNOWN_SCRIPT_INTERPRETERS must not match.
assert!(!super::name_matches_interpreter("python3"));
assert!(!super::name_matches_interpreter("deno"));
assert!(!super::name_matches_interpreter("bun"));
}
#[test]
fn name_matches_interpreter_rejects_node_prefix() {
// A name that starts with "node" but is longer must not match —
// exact equality is required to avoid false positives.
assert!(!super::name_matches_interpreter("node_modules"));
assert!(!super::name_matches_interpreter("nodejs"));
assert!(!super::name_matches_interpreter("node-gyp"));
}