Compare commits

...

1 Commits

Author SHA1 Message Date
Kevin Lin
fc26444f6d fix: preserve runtime alias with compat wrappers 2026-05-07 15:11:29 -07:00
3 changed files with 43 additions and 5 deletions

View File

@@ -155,6 +155,7 @@ Docs: https://docs.openclaw.ai
### Fixes
- TUI/local runs: keep stable runtime plugin aliases present when legacy compatibility wrappers already exist in dist, so sending a message no longer fails with a missing `runtime-plugins.runtime.js` module.
- Providers: preserve non-OK `text/event-stream` response bodies so provider HTTP errors keep their JSON detail instead of collapsing to generic streaming failures. Fixes #78180.
- Chat commands: make `/model default` reset the session model override instead of treating it as a literal model name. Fixes #78182.
- Cron: make rejected `payload.model` errors show the configured `agents.defaults.models` allowlist instead of echoing the rejected model twice. Fixes #79058.

View File

@@ -155,8 +155,18 @@ export function writeStableRootRuntimeAliases(params = {}) {
}
const resolveAliasCandidate = (aliasFileName, candidates) => {
if (candidates.length === 1) {
return candidates[0];
const implementationCandidates = candidates.filter((candidate) => {
const filePath = path.join(distDir, candidate);
let source;
try {
source = fsImpl.readFileSync(filePath, "utf8");
} catch {
return false;
}
return !source.includes(`"./${aliasFileName}"`);
});
if (implementationCandidates.length === 1) {
return implementationCandidates[0];
}
if (aliasFileName === PLUGIN_INSTALL_RUNTIME_ALIAS.aliasFileName) {
return resolveRootRuntimeCandidateByMarkers({
@@ -166,8 +176,8 @@ export function writeStableRootRuntimeAliases(params = {}) {
sourceIncludes: PLUGIN_INSTALL_RUNTIME_ALIAS.sourceIncludes,
});
}
const candidateSet = new Set(candidates);
const wrappers = candidates.filter((candidate) => {
const candidateSet = new Set(implementationCandidates);
const wrappers = implementationCandidates.filter((candidate) => {
const filePath = path.join(distDir, candidate);
let source;
try {
@@ -175,7 +185,7 @@ export function writeStableRootRuntimeAliases(params = {}) {
} catch {
return false;
}
return candidates.some(
return implementationCandidates.some(
(target) =>
target !== candidate &&
candidateSet.has(target) &&

View File

@@ -385,6 +385,33 @@ describe("runtime postbuild static assets", () => {
);
});
it("writes stable aliases when legacy compatibility wrappers already exist", async () => {
const rootDir = createTempDir("openclaw-runtime-postbuild-");
const distDir = path.join(rootDir, "dist");
await fs.mkdir(distDir, { recursive: true });
await fs.writeFile(
path.join(distDir, "runtime-plugins.runtime-NewHash.js"),
"export const ready = true;\n",
"utf8",
);
await fs.writeFile(
path.join(distDir, "runtime-plugins.runtime-CNAfmQRG.js"),
'export * from "./runtime-plugins.runtime.js";\n',
"utf8",
);
await fs.writeFile(
path.join(distDir, "runtime-plugins.runtime-fLHuT7Vs.js"),
'export * from "./runtime-plugins.runtime.js";\n',
"utf8",
);
writeStableRootRuntimeAliases({ rootDir });
expect(await fs.readFile(path.join(distDir, "runtime-plugins.runtime.js"), "utf8")).toBe(
'export * from "./runtime-plugins.runtime-NewHash.js";\n',
);
});
it("writes compatibility aliases for previous release runtime chunk names", async () => {
const rootDir = createTempDir("openclaw-runtime-postbuild-");
const distDir = path.join(rootDir, "dist");