fix: recover interrupted controller cycles

This commit is contained in:
冰朔 2026-08-05 11:18:54 +08:00
commit 05aeab4817
3 changed files with 49 additions and 3 deletions

View file

@ -131,8 +131,11 @@ const server = http.createServer(async (request, response) => {
});
try {
engine.initialize();
const initialState = engine.initialize();
runtime.source_loaded = true;
if (initialState.status === "AWAITING_HUMAN_BINGSHUO") {
runtime.phase = "PAUSED_FOR_HUMAN";
}
} catch (error) {
process.stderr.write(
`${JSON.stringify({
@ -151,6 +154,7 @@ server.listen(PORT, HOST, () => {
port: PORT,
})}\n`,
);
if (runtime.phase === "PAUSED_FOR_HUMAN") return;
eventQueue = handleEvent(bootEvent()).catch((error) => {
runtime.phase = "FAILED_CLOSED";
runtime.last_error = String(error.message || error).slice(0, 240);