feat: empty-container spawn (scratch workspace, no repo volume); fix bridge session isolation — explicit SessionManager per spawn stops SDK resuming the repo's old session (which also overrode LVMH_MODEL)
This commit is contained in:
@@ -7,6 +7,7 @@ import { existsSync } from "node:fs";
|
||||
import {
|
||||
createAgentSession,
|
||||
ModelRuntime,
|
||||
SessionManager,
|
||||
} from "/usr/local/lib/node_modules/@earendil-works/pi-coding-agent/dist/index.js";
|
||||
|
||||
const SETUP_PATH = "/workspace/.lvmh/setup.sh";
|
||||
@@ -85,8 +86,15 @@ try {
|
||||
console.error(`[lvmh-bridge] model resolution failed:`, err);
|
||||
}
|
||||
}
|
||||
// Fresh session per spawn: without an explicit sessionManager the SDK
|
||||
// picks up an existing session file for the cwd — sharing one transcript
|
||||
// (and its saved model) across every spawn of the repo. A dedicated dir
|
||||
// per daemon session id keeps spawns isolated and LVMH_MODEL authoritative.
|
||||
const sessionRoot = process.env.PI_SESSION_DIR ?? "/pi-sessions";
|
||||
const sessionDir = `${sessionRoot}/${process.env.LVMH_SESSION_ID ?? "default"}`;
|
||||
const sessionManager = SessionManager.create(process.cwd(), sessionDir);
|
||||
const { session } = await createAgentSession(
|
||||
model === undefined ? {} : { model },
|
||||
model === undefined ? { sessionManager } : { model, sessionManager },
|
||||
);
|
||||
// SDK does not bind extensions implicitly (unlike TUI/RPC modes); without
|
||||
// bindExtensions the session_start event never fires, so the lvmh plugin
|
||||
|
||||
Reference in New Issue
Block a user