fix: persist session workspace across runs

This commit is contained in:
lyon
2026-06-21 15:11:41 +08:00
parent da52d685e5
commit e8e2a50fe4
3 changed files with 18 additions and 2 deletions
+4 -1
View File
@@ -142,7 +142,9 @@ export async function createKubernetesRunnerJob(options: { store: AgentRunStore;
const pvcName = refreshed?.storagePvcName ?? ensured.pvcName;
if (!pvcName) throw new AgentRunError("infra-failed", `session ${run.sessionRef.sessionId} PVC was not resolved for runner job`, { httpStatus: 502 });
const subdir = refreshed?.codexRolloutSubdir ?? ensured.codexRolloutSubdir ?? "sessions";
sessionPvc = { pvcName, namespace: refreshed?.storageNamespace ?? ensured.namespace ?? namespace, mountPath: `/home/agentrun/.codex-${run.backendProfile}/${subdir}`, codexRolloutSubdir: subdir };
const mountPath = `/home/agentrun/.codex-${run.backendProfile}/${subdir}`;
const workspacePath = `${mountPath}/agentrun-workspace`;
sessionPvc = { pvcName, namespace: refreshed?.storageNamespace ?? ensured.namespace ?? namespace, mountPath, codexRolloutSubdir: subdir, workspacePath };
sessionPvcSummary = {
sessionId: run.sessionRef.sessionId,
pvcName: sessionPvc.pvcName,
@@ -150,6 +152,7 @@ export async function createKubernetesRunnerJob(options: { store: AgentRunStore;
pvcPhase: refreshed?.storagePvcPhase ?? ensured.pvcPhase ?? null,
mountPath: sessionPvc.mountPath,
codexRolloutSubdir: sessionPvc.codexRolloutSubdir,
workspacePath: sessionPvc.workspacePath ?? null,
valuesPrinted: false,
};
if (ensured.pvcPhase === "NotFound" || ensured.pvcPhase === "Unknown") {