@code-yeongyu/senpi-codemode 2026.11.30 → 2026.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,69 @@
1
1
  # Changelog
2
2
 
3
+ ## [2026.12.1] - 2026-12-01
4
+
5
+ ### Breaking Changes
6
+
7
+ ### Added
8
+
9
+ ### Changed
10
+
11
+ - Eval kernels (js, py, rb, jl) and their children never inherit the names listed in `<BRAND>_ENGINE_ONLY_ENV`, and while such a list is set the JS kernel always runs in its own process, whatever `isolation.js` or `SENPI_CODEMODE_JS_ISOLATION` says ([#7901](https://github.com/code-yeongyu/senpi/pull/7901))
12
+
13
+ ### Fixed
14
+
15
+ ### Removed
16
+
17
+ ## [2026.11.30-5] - 2026-11-30
18
+
19
+ ### Breaking Changes
20
+
21
+ ### Added
22
+
23
+ ### Changed
24
+
25
+ ### Fixed
26
+
27
+ ### Removed
28
+
29
+ ## [2026.11.30-4] - 2026-11-30
30
+
31
+ ### Breaking Changes
32
+
33
+ ### Added
34
+
35
+ ### Changed
36
+
37
+ ### Fixed
38
+
39
+ - An idle Python eval kernel no longer keeps exited children of dropped `Popen` handles as zombies ([#7347](https://github.com/code-yeongyu/senpi/pull/7347))
40
+
41
+ ### Removed
42
+
43
+ ## [2026.11.30-3] - 2026-11-30
44
+
45
+ ### Breaking Changes
46
+
47
+ ### Added
48
+
49
+ ### Changed
50
+
51
+ ### Fixed
52
+
53
+ ### Removed
54
+
55
+ ## [2026.11.30-2] - 2026-11-30
56
+
57
+ ### Breaking Changes
58
+
59
+ ### Added
60
+
61
+ ### Changed
62
+
63
+ ### Fixed
64
+
65
+ ### Removed
66
+
3
67
  ## [2026.11.30] - 2026-11-30
4
68
 
5
69
  ### Breaking Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-yeongyu/senpi-codemode",
3
- "version": "2026.11.30",
3
+ "version": "2026.12.1",
4
4
  "description": "Source-only senpi extension package for codemode evaluation tools",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -33,16 +33,16 @@
33
33
  },
34
34
  "dependencies": {
35
35
  "@babel/parser": "8.0.4",
36
- "@earendil-works/pi-ai": "npm:@code-yeongyu/senpi-ai@2026.11.30",
37
- "@earendil-works/pi-realm-registry": "npm:@code-yeongyu/senpi-realm-registry@2026.11.30",
36
+ "@earendil-works/pi-ai": "npm:@code-yeongyu/senpi-ai@2026.12.1",
37
+ "@earendil-works/pi-realm-registry": "npm:@code-yeongyu/senpi-realm-registry@2026.12.1",
38
38
  "quickjs-wasi": "3.6.2",
39
39
  "typebox": "1.3.34"
40
40
  },
41
41
  "peerDependencies": {
42
- "@code-yeongyu/senpi": "2026.11.30"
42
+ "@code-yeongyu/senpi": "2026.12.1"
43
43
  },
44
44
  "devDependencies": {
45
- "@code-yeongyu/senpi": "2026.11.30"
45
+ "@code-yeongyu/senpi": "2026.12.1"
46
46
  },
47
47
  "keywords": [
48
48
  "senpi",
@@ -1,5 +1,6 @@
1
1
  import type { Static } from "typebox";
2
2
  import { Type } from "typebox";
3
+ import { engineOnlyEnvActive } from "@code-yeongyu/senpi";
3
4
  import { runtimeNameOf } from "../kernels/js/runtime-name.ts";
4
5
 
5
6
  type Environment = Readonly<Record<string, string | undefined>>;
@@ -63,13 +64,15 @@ export interface JsIsolationHost {
63
64
  /** "bun" or "node" when the host's executable is that runtime; undefined for a compiled binary. */
64
65
  readonly executable: "bun" | "node" | undefined;
65
66
  readonly platform: NodeJS.Platform;
67
+ /** The engine withholds launch-listed names (`<BRAND>_ENGINE_ONLY_ENV`) from the children it starts. */
68
+ readonly engineOnlyEnv?: boolean;
66
69
  }
67
70
 
68
71
  export function currentJsIsolationHost(
69
72
  execPath: string = process.execPath,
70
73
  platform: NodeJS.Platform = process.platform,
71
74
  ): JsIsolationHost {
72
- return { executable: runtimeNameOf(execPath), platform };
75
+ return { executable: runtimeNameOf(execPath), platform, engineOnlyEnv: engineOnlyEnvActive() };
73
76
  }
74
77
 
75
78
  /**
@@ -109,12 +112,17 @@ export function pickFeatureSettings(input: CodemodeFeatureSettings): CodemodeFea
109
112
  };
110
113
  }
111
114
 
112
- /** The environment wins over the file, the file over the host default; an unknown value is ignored. */
115
+ /**
116
+ * The environment wins over the file, the file over the host default; an unknown value is ignored. An engine that
117
+ * withholds engine-only names always runs the kernel in its own process: a worker or inline kernel shares the engine's
118
+ * process, whose launch environment (`/proc/self/environ`) still holds those names whatever its `process.env` view says.
119
+ */
113
120
  export function resolveJsIsolation(
114
121
  settings: CodemodeFeatureSettings,
115
122
  env: Environment = process.env,
116
123
  host: JsIsolationHost = currentJsIsolationHost(),
117
124
  ): JsIsolation {
125
+ if (host.engineOnlyEnv === true) return "process";
118
126
  const fromEnv = env[JS_ISOLATION_ENVIRONMENT_FLAG];
119
127
  if (fromEnv === "worker" || fromEnv === "process") return fromEnv;
120
128
  return settings.isolation?.js ?? defaultJsIsolation(host);
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  activeKillGuardEnvironment,
3
- childEnvironmentOf,
3
+ agentChildEnvironmentOf,
4
4
  type ExtensionContext,
5
5
  readKillGuardSetting,
6
6
  withBundledBunCommands,
@@ -100,8 +100,8 @@ export async function createRuntime(
100
100
  const jsProcessIsolation = resolveJsIsolation(settings) === "process";
101
101
  const artifacts = resolveSessionArtifactsDir(ctx.sessionManager.getSessionFile());
102
102
  const activeTools = reachableToolNames(pi);
103
- // Kernels and their children never see the RPC host's supervisor hand-off (senpi#5635).
104
- const inheritedEnv = () => childEnvironmentOf(process.env);
103
+ // Kernels and their children never see the RPC host's supervisor hand-off (senpi#5635) or an engine-only name.
104
+ const inheritedEnv = () => agentChildEnvironmentOf(process.env);
105
105
  const writtenFiles = new WrittenFiles({
106
106
  cwd: ctx.cwd,
107
107
  artifactsDir: artifacts.dir,
@@ -2480,6 +2480,17 @@ def _read_control(commands: queue.SimpleQueue[tuple[str, Any]]) -> None:
2480
2480
  commands.put(("eof", None))
2481
2481
 
2482
2482
 
2483
+ # CPython collects a child whose Popen handle was dropped only when a later Popen starts, so a kernel that goes idle
2484
+ # keeps it as a zombie that pid-liveness checks still read as alive (senpi#7246). subprocess._cleanup waits only on
2485
+ # those dropped handles: a handle a cell still holds, and a child from os.fork, os.spawn* or pty.fork, keeps its exit
2486
+ # status for its owner. The main thread runs it between messages, never while a cell is executing.
2487
+ _DISCARDED_CHILD_REAP_SECONDS = 1.0
2488
+
2489
+
2490
+ def _reap_discarded_children() -> None:
2491
+ subprocess._cleanup()
2492
+
2493
+
2483
2494
  def main() -> None:
2484
2495
  emit_status("kernel-startup", force=True, stage="host-init")
2485
2496
  signal.signal(signal.SIGINT, signal.SIG_IGN)
@@ -2489,7 +2500,11 @@ def main() -> None:
2489
2500
  threading.Thread(target=_read_control, args=(commands,), name="senpi-control-reader", daemon=True).start()
2490
2501
  host_closed = False
2491
2502
  while True:
2492
- kind, payload = commands.get()
2503
+ try:
2504
+ kind, payload = commands.get(timeout=_DISCARDED_CHILD_REAP_SECONDS)
2505
+ except queue.Empty:
2506
+ _reap_discarded_children()
2507
+ continue
2493
2508
  if kind == "eof":
2494
2509
  break
2495
2510
  if kind == "malformed":
@@ -2501,6 +2516,7 @@ def main() -> None:
2501
2516
  break
2502
2517
  except BaseException as exc: # noqa: BROAD_EXCEPT_OK — process boundary serializes malformed input and interrupts.
2503
2518
  emit({"type": "init-failed", "error": bridge_error(exc)})
2519
+ _reap_discarded_children()
2504
2520
  # Reaching here without a close frame means the host's pipe hit EOF: it is gone,
2505
2521
  # so retire any subprocess the last cell left running before the interpreter exits.
2506
2522
  if not host_closed:
@@ -23,7 +23,7 @@ export const SESSION_ENVIRONMENT_KEYS = [
23
23
  /**
24
24
  * The environment a kernel and its children inherit from the host: `process.env` without the RPC host's
25
25
  * supervisor hand-off, plus the origin attribution (senpi#5635). Computed once by the extension through
26
- * `childEnvironmentOf` at each spawn, so a restarted kernel sees the host env as it is then; kernels
26
+ * `agentChildEnvironmentOf` at each spawn, so a restarted kernel sees the host env as it is then; kernels
27
27
  * default to `process.env` when none is given.
28
28
  */
29
29
  export type InheritedEnvironment = () => Readonly<Record<string, string | undefined>>;
@@ -36,7 +36,8 @@ export function inheritedEnvironmentDelta(
36
36
  base: Readonly<Record<string, string | undefined>>,
37
37
  inherited: Readonly<Record<string, string | undefined>>,
38
38
  ): { removedEnv: string[]; inheritedSet: Record<string, string> } {
39
- const removedEnv = Object.keys(base).filter((name) => !Object.hasOwn(inherited, name));
39
+ // An `undefined` entry is a withheld name (an engine-only variable), removed like an absent one.
40
+ const removedEnv = Object.keys(base).filter((name) => inherited[name] === undefined);
40
41
  const inheritedSet: Record<string, string> = {};
41
42
  for (const [name, value] of Object.entries(inherited)) {
42
43
  if (value !== undefined && base[name] !== value) inheritedSet[name] = value;