fix(durable): import toCodemodeIdentifier from pi-codemode/declarations

The Code Mode extension imported it from /portable, which loads the WASM
QuickJS runtime the extension never uses.

closes #11254
This commit is contained in:
Mario Zechner 2026-10-27 21:31:47 +00:00
parent 5f312dac4c
commit bb65e3e497
3 changed files with 19 additions and 7 deletions

View file

@ -123,6 +123,7 @@
- Fixed a commit that Storage rejects after adopting it (a failed JSONL reclaim) publishing nothing: it is published and its waits resolve before the Session fails, so a replica built from `subscribeCommits()` stays equal to Storage and `pi.durable.tasks.active` stays balanced.
- Fixed a throwing telemetry adapter (a commit's `pi.durable.entry` or `pi.durable.submission` event, `pi.durable.tasks.active`) rejecting a durable commit and leaving the views and the scheduler without it: it is reported as `host_error` with callback `"telemetry"`, and the commit resolves. A throwing report metric or report event is dropped.
- Fixed a host that crashes during a model request resending it forever, adding an aborted entry each time: the interrupted request is a failed attempt under the retry policy, and the run ends with `runFailure` reason `interrupted` once no retry is left; other work cut off `restartLimit` times ends instead of keeping its conversation busy ([#11139](https://github.com/earendil-works/pi/issues/11139))
- Fixed the Code Mode extension loading pi-codemode's WASM QuickJS runtime (`quickjs-wasi`) although it only runs scripts in the sandbox the host passes: it imports `toCodemodeIdentifier` from `@earendil-works/pi-codemode/declarations` instead of `/portable` ([#11254](https://github.com/earendil-works/pi/issues/11254))
## [1.4.0] - 2026-10-21

View file

@ -37,13 +37,13 @@
import { type Context, copyJson, type JsonValue } from "@earendil-works/chord";
import { ownedSlice } from "@earendil-works/chord/delta";
import type { TextContent } from "@earendil-works/pi-ai";
import {
type CodemodeHostCall,
type CodemodeOutcome,
type CodemodeResult,
type CodemodeRun,
type CodemodeSandboxBase,
toCodemodeIdentifier,
import { toCodemodeIdentifier } from "@earendil-works/pi-codemode/declarations";
import type {
CodemodeHostCall,
CodemodeOutcome,
CodemodeResult,
CodemodeRun,
CodemodeSandboxBase,
} from "@earendil-works/pi-codemode/portable";
import { CODEMODE_SOURCE_GRAMMAR, parseCodemodeSource } from "@earendil-works/pi-codemode/source";
import { type Static, Type } from "typebox";

View file

@ -0,0 +1,11 @@
import { expect, test, vi } from "vitest";
import { createCodemodeExtension } from "../src/codemode/codemode.ts";
// The extension runs scripts in the sandbox the host passes, so loading it must not load the WASM VM (#11254).
vi.mock("quickjs-wasi", () => {
throw new Error("the Code Mode extension loaded quickjs-wasi");
});
test("the Code Mode extension loads without pi-codemode's WASM runtime", () => {
expect(createCodemodeExtension).toBeTypeOf("function");
});