@code-yeongyu/senpi-codemode 2026.8.24 → 2026.8.26

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
@@ -12,6 +12,30 @@
12
12
 
13
13
  ### Removed
14
14
 
15
+ ## [2026.8.26] - 2026-08-26
16
+
17
+ ### Breaking Changes
18
+
19
+ ### Added
20
+
21
+ ### Changed
22
+
23
+ ### Fixed
24
+
25
+ ### Removed
26
+
27
+ ## [2026.8.25] - 2026-08-25
28
+
29
+ ### Breaking Changes
30
+
31
+ ### Added
32
+
33
+ ### Changed
34
+
35
+ ### Fixed
36
+
37
+ ### Removed
38
+
15
39
  ## [2026.8.24] - 2026-08-24
16
40
 
17
41
  ### Breaking Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@code-yeongyu/senpi-codemode",
3
- "version": "2026.8.24",
3
+ "version": "2026.8.26",
4
4
  "description": "Source-only senpi extension package for codemode evaluation tools",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
@@ -30,14 +30,14 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "@babel/parser": "8.0.4",
33
- "@earendil-works/pi-ai": "npm:@code-yeongyu/senpi-ai@2026.8.24",
33
+ "@earendil-works/pi-ai": "npm:@code-yeongyu/senpi-ai@2026.8.26",
34
34
  "typebox": "1.3.18"
35
35
  },
36
36
  "peerDependencies": {
37
- "@code-yeongyu/senpi": "2026.8.24"
37
+ "@code-yeongyu/senpi": "2026.8.26"
38
38
  },
39
39
  "devDependencies": {
40
- "@code-yeongyu/senpi": "2026.8.24"
40
+ "@code-yeongyu/senpi": "2026.8.26"
41
41
  },
42
42
  "keywords": [
43
43
  "senpi",
@@ -21,12 +21,30 @@ export class CodemodeSessionNotStartedError extends Error {
21
21
  }
22
22
  }
23
23
 
24
+ const defaultTeardownFailureReporter = (error: unknown): void => {
25
+ globalThis.process.stderr.write(`[senpi-codemode] ${describeTeardownFailure(error)}\n`);
26
+ };
27
+
28
+ function describeTeardownFailure(error: unknown): string {
29
+ const message = error instanceof Error ? error.message : String(error);
30
+ if (error instanceof AggregateError && error.errors.length > 0) {
31
+ const causes = error.errors.map((cause) => (cause instanceof Error ? cause.message : String(cause))).join("; ");
32
+ return `session teardown failed: ${message} (${causes})`;
33
+ }
34
+ return `session teardown failed: ${message}`;
35
+ }
36
+
24
37
  export class SessionManagerProxy implements CodemodeSessionManager, EvalExecutionTracker {
25
38
  #current: CodemodeSessionManager | undefined;
26
39
  #generation = 0;
27
40
  #started = false;
28
41
  #acceptingExecutions = false;
29
42
  readonly #executions = new Set<TrackedExecution>();
43
+ readonly #onTeardownFailure: (error: unknown) => void;
44
+
45
+ constructor(onTeardownFailure: (error: unknown) => void = defaultTeardownFailureReporter) {
46
+ this.#onTeardownFailure = onTeardownFailure;
47
+ }
30
48
 
31
49
  beginReplacement(): number {
32
50
  this.#generation++;
@@ -37,19 +55,19 @@ export class SessionManagerProxy implements CodemodeSessionManager, EvalExecutio
37
55
 
38
56
  async replace(generation: number, next: CodemodeSessionManager): Promise<boolean> {
39
57
  if (generation !== this.#generation) {
40
- await next.dispose();
58
+ await this.#disposeQuietly(next);
41
59
  return false;
42
60
  }
43
61
  await this.#settleExecutions();
44
62
  if (generation !== this.#generation) {
45
- await next.dispose();
63
+ await this.#disposeQuietly(next);
46
64
  return false;
47
65
  }
48
66
  const current = this.#current;
49
67
  this.#current = undefined;
50
- await current?.dispose();
68
+ await this.#disposeQuietly(current);
51
69
  if (generation !== this.#generation) {
52
- await next.dispose();
70
+ await this.#disposeQuietly(next);
53
71
  return false;
54
72
  }
55
73
  this.#current = next;
@@ -100,7 +118,23 @@ export class SessionManagerProxy implements CodemodeSessionManager, EvalExecutio
100
118
  await this.#settleExecutions();
101
119
  const current = this.#current;
102
120
  this.#current = undefined;
103
- await current?.dispose();
121
+ await this.#disposeQuietly(current);
122
+ }
123
+
124
+ /**
125
+ * Session teardown is best-effort: a kernel or bridge that fails to confirm
126
+ * close (e.g. a SIGKILLed interpreter missing its reap window throws
127
+ * KernelRetirementError into the manager's dispose AggregateError) must not
128
+ * reject the session lifecycle handler that triggered the teardown — the
129
+ * extension host surfaces such rejections as user-facing extension errors.
130
+ */
131
+ async #disposeQuietly(manager: CodemodeSessionManager | undefined): Promise<void> {
132
+ if (manager === undefined) return;
133
+ try {
134
+ await manager.dispose();
135
+ } catch (error) {
136
+ this.#onTeardownFailure(error);
137
+ }
104
138
  }
105
139
 
106
140
  #abortExecutions(): void {