From f4d04af5cbb203020af0ba9f4be44606dd623962 Mon Sep 17 00:00:00 2001 From: luvs01 Date: Thu, 13 Aug 2026 10:01:06 +0900 Subject: [PATCH] fix(lab): restore automation scheduler intent on restart --- src/server/index.ts | 4 ++-- tests/lab-automation.test.ts | 6 ++++++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/server/index.ts b/src/server/index.ts index 0a5a8a36f3..c249db54ea 100644 --- a/src/server/index.ts +++ b/src/server/index.ts @@ -49,7 +49,7 @@ import { setLabAutomationDispatchDeps, startLabAutomationScheduler, } from "../lab/automation/orchestrator"; -import { loadLabAutomationPolicy } from "../lab/automation/persistence"; +import { loadLabAutomationConfig } from "../lab/automation/config-persistence"; import { createProductionLabRouteExecutor } from "../lib/lab-live-route-production"; import { runOpenAiTierStartupMigration } from "../providers/openai-tier-startup"; import { runAlibabaRegionStartupMigration } from "../providers/alibaba-region-startup"; @@ -1744,7 +1744,7 @@ export function startServer(port?: number, deps: StartServerDeps = {}): Server config, routeExecutor: productionLabRouteExecutor, }); - if (loadLabAutomationPolicy(labConfigDir).enabled) { + if (loadLabAutomationConfig(labConfigDir).policy.enabled) { startLabAutomationScheduler(labConfigDir); } diff --git a/tests/lab-automation.test.ts b/tests/lab-automation.test.ts index ad63896582..eca36e4349 100644 --- a/tests/lab-automation.test.ts +++ b/tests/lab-automation.test.ts @@ -380,6 +380,12 @@ describe("CL-08 lab automation", () => { } }); + test("server startup reads scheduler intent from the committed automation config", () => { + const src = readFileSync(join(process.cwd(), "src/server/index.ts"), "utf8"); + expect(src).toContain("loadLabAutomationConfig(labConfigDir).policy.enabled"); + expect(src).not.toContain("loadLabAutomationPolicy(labConfigDir).enabled"); + }); + test("corrupt scheduler state fails closed on load", () => { withHome((home) => { const path = join(home, "lab");