fix: harden executor session handling

This commit is contained in:
liujing
2026-07-16 23:00:48 +08:00
parent 35e8fa3717
commit 3566a73a03
5 changed files with 207 additions and 28 deletions
+10 -3
View File
@@ -326,6 +326,7 @@ export async function startWorkflow(opts: StartWorkflowOpts): Promise<{ runId: s
runDir: dir,
cycleIndex,
config: config.executorConfig,
timeoutSeconds: state.timeoutSeconds,
signal: ac.signal,
});
} catch (err) {
@@ -338,8 +339,8 @@ export async function startWorkflow(opts: StartWorkflowOpts): Promise<{ runId: s
persistExecutorAttempt(dir, cycleRecord, execResult);
if (execResult.sessionHandle) {
state.sessionHandle = execResult.sessionHandle;
if (execResult.sessionHandle.kind === "agy" && execResult.sessionHandle.degraded) {
state.agyDegraded = true;
if (execResult.sessionHandle.kind === "agy") {
state.agyDegraded = execResult.sessionHandle.degraded;
}
}
@@ -725,6 +726,7 @@ async function resumeExecutorCycle(
runDir: dir,
cycleIndex,
config: state.executorConfig ?? {},
timeoutSeconds: state.timeoutSeconds,
signal: ac.signal,
});
} catch (err) {
@@ -741,7 +743,12 @@ async function resumeExecutorCycle(
cleanup();
persistExecutorAttempt(dir, cycleRecord, execResult);
if (execResult.sessionHandle) state.sessionHandle = execResult.sessionHandle;
if (execResult.sessionHandle) {
state.sessionHandle = execResult.sessionHandle;
if (execResult.sessionHandle.kind === "agy") {
state.agyDegraded = execResult.sessionHandle.degraded;
}
}
appendEvent(dir, {
kind: "executor_completed",