mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-12 21:53:00 -06:00
fix(cli): report stale binding clears accurately (#114926)
Co-authored-by: Alix-007 <li.long15@xydigit.com>
This commit is contained in:
committed by
GitHub
parent
dfbc95e4ea
commit
4ade409cf2
@@ -1314,6 +1314,17 @@ describe("CLI attempt execution", () => {
|
||||
);
|
||||
await replaceSessionEntry({ sessionKey, storePath }, concurrentEntry);
|
||||
sessionStore[sessionKey] = concurrentEntry;
|
||||
const clearBeforeFreshRetry = runArgs.onBeforeFreshCliSessionRetry;
|
||||
expect(clearBeforeFreshRetry).toBeTypeOf("function");
|
||||
await expect(
|
||||
(
|
||||
clearBeforeFreshRetry as (params: {
|
||||
provider: string;
|
||||
reason: "timeout";
|
||||
sessionId: string;
|
||||
}) => Promise<boolean>
|
||||
)({ provider: "claude-cli", reason: "timeout", sessionId: forkedCliSessionId }),
|
||||
).resolves.toBe(false);
|
||||
throw recoveryError;
|
||||
});
|
||||
|
||||
|
||||
@@ -337,6 +337,7 @@ export async function clearCliSessionInStore(params: {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
let didClear = false;
|
||||
const persisted = await patchSessionEntry(
|
||||
{
|
||||
storePath,
|
||||
@@ -358,14 +359,16 @@ export async function clearCliSessionInStore(params: {
|
||||
const next = { ...currentEntry };
|
||||
clearCliSession(next, provider);
|
||||
next.updatedAt = Date.now();
|
||||
didClear = true;
|
||||
return next;
|
||||
},
|
||||
{ fallbackEntry: entry },
|
||||
);
|
||||
if (persisted) {
|
||||
if (persisted && didClear) {
|
||||
sessionStore[sessionKey] = persisted;
|
||||
return persisted;
|
||||
}
|
||||
return persisted ?? undefined;
|
||||
return undefined;
|
||||
}
|
||||
|
||||
/** Clears the one-shot fork marker before the resumed CLI process starts. */
|
||||
|
||||
Reference in New Issue
Block a user