refactor: store gateway restart recovery in SQLite (#110014)

* refactor: move restart sentinel state to sqlite

* fix: satisfy restart sentinel architecture gates

* test: avoid cold startup migration timeout

* fix: bound durable restart notice retries

* test: type restart notice contention mock

* fix: detect legacy restart sentinel before reads

* fix: keep delivery attempt result internal

* fix: narrow restart sentinel preflight guard
This commit is contained in:
Peter Steinberger
2026-07-17 17:43:22 +01:00
committed by GitHub
parent b75b62fb1c
commit 5366b6de81
30 changed files with 3717 additions and 633 deletions
+17
View File
@@ -207,6 +207,23 @@ describe("ensureConfigReady", () => {
});
});
it.each(["restart-sentinel.json", "restart-sentinel.json.doctor-importing"])(
"runs doctor flow when lightweight startup detection finds %s",
async (relativePath) => {
const root = useTempOpenClawHome();
writeStateMarker(root, relativePath);
await runEnsureConfigReady(["status"]);
expect(loadAndMaybeMigrateDoctorConfigMock).toHaveBeenCalledWith({
migrateState: true,
migrateLegacyConfig: false,
invalidConfigNote: false,
observe: false,
});
},
);
it("runs doctor flow when lightweight startup detection finds a pending SQLite archive", async () => {
const root = useTempOpenClawHome();
writePendingTaskSidecarArchiveMarker(root);
+2
View File
@@ -124,6 +124,8 @@ function hasLegacyStateMigrationInputs(): boolean {
path.join(stateDir, "agent"),
path.join(stateDir, "agents"),
path.join(stateDir, "plugins", "installs.json"),
path.join(stateDir, "restart-sentinel.json"),
path.join(stateDir, "restart-sentinel.json.doctor-importing"),
path.join(stateDir, "sessions"),
path.join(stateDir, "state", "openclaw.sqlite"),
].some(fileOrDirExists) ||