feat: persist blocked executor jobs

This commit is contained in:
john
2026-07-24 23:07:46 +08:00
parent d21c4849a9
commit bbb43f97a3
17 changed files with 649 additions and 26 deletions
+12 -2
View File
@@ -3,6 +3,7 @@ import {
CODE_RUN_SHADOW_WORKFLOW,
createCodeRunShadowGraph,
} from './code-run-shadow-graph.mjs';
import { createExecutorGateway } from './executor-gateway.mjs';
function graphConfig(runId) {
return {
@@ -35,14 +36,22 @@ export function createLangGraphOrchestratorRuntime({
checkpointKind = 'unknown',
durable = false,
checkpointProbe = null,
executorJobStore = null,
executorJobProbe = null,
} = {}) {
const graph = createCodeRunShadowGraph({ checkpointer });
const executorGateway = createExecutorGateway({
...(executorJobStore ? { store: executorJobStore } : {}),
});
const graph = createCodeRunShadowGraph({ checkpointer, executorGateway });
const probe = typeof checkpointProbe === 'function'
? checkpointProbe
: async () => {
await checkpointer.getTuple(graphConfig('__orchestrator_readiness__'));
return true;
};
const probeExecutorJobs = typeof executorJobProbe === 'function'
? executorJobProbe
: async () => true;
async function getSnapshot(runId) {
return graph.getState(graphConfig(runId));
@@ -63,6 +72,7 @@ export function createLangGraphOrchestratorRuntime({
durable: Boolean(durable),
},
execution: 'observe-only',
executorGateway: executorGateway.status(),
};
}
@@ -122,7 +132,7 @@ export function createLangGraphOrchestratorRuntime({
health,
async ready() {
await probe();
await Promise.all([probe(), probeExecutorJobs()]);
return {
...health(),
ready: true,