mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-27 23:12:52 +00:00
fix(release): stabilize config restart QA
This commit is contained in:
@@ -66,6 +66,9 @@ steps:
|
||||
- ref: env
|
||||
- Capability flip
|
||||
- ref: sessionKey
|
||||
- set: setupStartIndex
|
||||
value:
|
||||
expr: state.getSnapshot().messages.length
|
||||
- try:
|
||||
actions:
|
||||
- call: patchConfig
|
||||
@@ -92,6 +95,15 @@ steps:
|
||||
expr: config.setupPrompt
|
||||
timeoutMs:
|
||||
expr: liveTurnTimeoutMs(env, 30000)
|
||||
- call: waitForOutboundMessage
|
||||
args:
|
||||
- ref: state
|
||||
- lambda:
|
||||
params: [candidate]
|
||||
expr: "candidate.conversation.id === 'qa-operator' && String(candidate.text ?? '').includes('Protocol note')"
|
||||
- expr: liveTurnTimeoutMs(env, 30000)
|
||||
- sinceIndex:
|
||||
ref: setupStartIndex
|
||||
- call: readEffectiveTools
|
||||
saveAs: beforeTools
|
||||
args:
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import fsSync from "node:fs";
|
||||
import fs from "node:fs/promises";
|
||||
import os from "node:os";
|
||||
import path from "node:path";
|
||||
@@ -763,6 +764,35 @@ describe("acquireSessionWriteLock", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("retries when a reported stale same-process lock disappears before recovery", async () => {
|
||||
await withTempSessionLockFile(async ({ sessionFile, lockPath }) => {
|
||||
await fs.writeFile(
|
||||
lockPath,
|
||||
JSON.stringify({
|
||||
pid: process.pid,
|
||||
createdAt: new Date().toISOString(),
|
||||
starttime: FAKE_STARTTIME,
|
||||
}),
|
||||
"utf8",
|
||||
);
|
||||
let resolverCalls = 0;
|
||||
testing.setProcessStartTimeResolverForTest((pid) => {
|
||||
if (pid !== process.pid) {
|
||||
return null;
|
||||
}
|
||||
resolverCalls += 1;
|
||||
if (resolverCalls === 1) {
|
||||
fsSync.rmSync(lockPath, { force: true });
|
||||
}
|
||||
return FAKE_STARTTIME;
|
||||
});
|
||||
|
||||
const lock = await acquireSessionWriteLock({ sessionFile, timeoutMs: 500 });
|
||||
await lock.release();
|
||||
expect(resolverCalls).toBeGreaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
it("removes held locks on termination signals", async () => {
|
||||
const signals = ["SIGINT", "SIGTERM", "SIGQUIT", "SIGABRT"] as const;
|
||||
const originalKill = process.kill.bind(process);
|
||||
|
||||
@@ -560,6 +560,16 @@ async function removeReportedStaleLockIfStillStale(params: {
|
||||
}): Promise<boolean> {
|
||||
const nowMs = Date.now();
|
||||
const payload = await readLockPayload(params.lockPath);
|
||||
if (payload === null) {
|
||||
try {
|
||||
await fs.access(params.lockPath);
|
||||
} catch (error) {
|
||||
if ((error as NodeJS.ErrnoException).code === "ENOENT") {
|
||||
return true;
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
const inspected = inspectLockPayloadForSession({
|
||||
payload,
|
||||
staleMs: params.staleMs,
|
||||
|
||||
Reference in New Issue
Block a user