fix(crabbox): reclaim sparse reused leases

This commit is contained in:
Vincent Koc 2026-06-23 09:50:53 +02:00
parent 023394000c
commit ca5905eb90
No known key found for this signature in database
2 changed files with 16 additions and 0 deletions

View file

@ -2675,6 +2675,20 @@ function assertFullCheckoutAvailableBeforeExit(dir) {
return false;
}
function injectFullCheckoutLeaseReclaim(commandArgs) {
if (
commandArgs[0] !== "run" ||
!hasOption(commandArgs, "--id") ||
hasOption(commandArgs, "--reclaim")
) {
return commandArgs;
}
const normalizedArgs = [...commandArgs];
const { optionEnd } = runCommandBounds(normalizedArgs);
normalizedArgs.splice(optionEnd, 0, "--reclaim");
return normalizedArgs;
}
const version = checkedOutput(binary, ["--version"]);
const help = checkedOutput(binary, ["run", "--help"]);
const providerAliases = new Map([
@ -2856,6 +2870,7 @@ try {
const changedGateBase = isChangedGateCommand(runWords) ? mergeBaseForChangedGate() : "";
const checkout = prepareFullCheckoutForSync({ changedGateBase });
fullCheckout = checkout;
normalizedArgs = injectFullCheckoutLeaseReclaim(normalizedArgs);
childCwd = checkout.dir;
cleanupChildCwd = () => checkout.cleanup();
remoteChangedGateBase = checkout.changedGateBase;

View file

@ -3720,6 +3720,7 @@ describe.concurrent("scripts/crabbox-wrapper", () => {
expect(result.status).toBe(0);
expect(result.stderr).toContain("syncing from temporary full checkout");
expect(parseFakeCrabboxOutput(result).args).toContain("--reclaim");
expect(parseFakeCrabboxOutput(result).cwd).toContain("openclaw-crabbox-sync-");
});