fix: glm not found in dotfiles-less workers — bridge promotes models.json.fallback at startup (the fallback was never read by anything)

This commit is contained in:
2026-09-04 07:59:54 +00:00
parent 310127cf7a
commit b62e4e717a
+8 -1
View File
@@ -3,7 +3,7 @@
// web prompts through pi.sendUserMessage. This process just hosts the session.
// Global npm layout: resolve pi via absolute path (NODE_PATH does not apply to ESM).
import { spawn } from "node:child_process";
import { existsSync } from "node:fs";
import { copyFileSync, existsSync } from "node:fs";
import {
createAgentSession,
ModelRuntime,
@@ -61,6 +61,13 @@ process.on("unhandledRejection", (err) => {
try {
await runRepoSetup();
// Dotfiles-less bakes ship only models.json.fallback: promote it so the
// registry always resolves the zai provider (glm) instead of "not found".
const piAgent = "/root/.pi/agent";
if (!existsSync(`${piAgent}/models.json`) && existsSync(`${piAgent}/models.json.fallback`)) {
copyFileSync(`${piAgent}/models.json.fallback`, `${piAgent}/models.json`);
console.error("[lvmh-bridge] promoted models.json.fallback -> models.json");
}
// Optional initial model: LVMH_MODEL="provider/model-id" from the spawn
// request. Resolved against the session's model registry; a bad value is
// logged and falls back to the default model.