mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-26 20:35:39 -06:00
fix(update): fail closed on unreadable TUI identity
This commit is contained in:
@@ -134,6 +134,22 @@ describe("local TUI processes", () => {
|
||||
).resolves.toEqual({ stopped: [], failed: [101] });
|
||||
});
|
||||
|
||||
it("fails closed when a live process identity can no longer be read", async () => {
|
||||
const controller = { kill: vi.fn(() => true) };
|
||||
let reads = 0;
|
||||
|
||||
await expect(
|
||||
terminateLocalTuiProcesses({
|
||||
processes: [{ pid: 101, command: "openclaw-tui", startTime: "start" }],
|
||||
controller,
|
||||
graceMs: 0,
|
||||
killGraceMs: 0,
|
||||
readStartTime: () => (++reads === 1 ? "start" : undefined),
|
||||
}),
|
||||
).resolves.toEqual({ stopped: [], failed: [101] });
|
||||
expect(controller.kill).not.toHaveBeenCalledWith(101, "SIGKILL");
|
||||
});
|
||||
|
||||
it("refuses shared update mutation when a matched client survives", async () => {
|
||||
const processes = [{ pid: 101, command: "openclaw --profile work tui" }];
|
||||
|
||||
|
||||
@@ -182,7 +182,12 @@ export async function terminateLocalTuiProcesses(params: {
|
||||
stopped.push(proc.pid);
|
||||
continue;
|
||||
}
|
||||
if (!proc.startTime || readStartTime(proc.pid) !== proc.startTime) {
|
||||
const currentStartTime = readStartTime(proc.pid);
|
||||
if (!currentStartTime) {
|
||||
failed.push(proc.pid);
|
||||
continue;
|
||||
}
|
||||
if (currentStartTime !== proc.startTime) {
|
||||
stopped.push(proc.pid);
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user