Skip to content

Commit 0844983

Browse files
committed
fix(crabbox): require confirmed worker lease cleanup
Treat known non-runnable Crabbox states as loss of a usable lease, so core fences the worker and requests explicit teardown instead of assuming the machine is gone. Stop renewing those leases and share the classification with provisioning, including archived resources. Only normal zero-exit stop results prove provider-owned cleanup. Preserve failed release diagnostics even after an earlier missing-lease warning, and reconcile AWS profile rejections through stop when recognition is lost. Clarify the existing inspection contract without changing its SDK shape. Preserves the optional-class and warm-image policy in #131009.
1 parent 27cbd86 commit 0844983

5 files changed

Lines changed: 203 additions & 173 deletions

File tree

‎docs/gateway/cloud-workers.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,8 @@ openclaw gateway call sessions.reclaim \
351351

352352
The result placement is `reclaimed` after an active worker is safely stopped. Reclaim also waits for an in-flight dispatch and retries pending teardown for a failed placement before returning `local`. No other placement states are successful reclaim results.
353353

354+
An ended or unusable provider lease is not proof that its machine was deleted. OpenClaw fences that worker, stops renewing the lease, and requests explicit provider teardown. Failed teardown stays retryable; a missing local claim or an earlier “not found” warning does not turn a failed stop into success.
355+
354356
For automation, read the active placement's `generation`, `environmentId`, and `activeOwnerEpoch` from `sessions.describe`, then supply those exact source facts to `sessions.move`:
355357

356358
```bash

‎extensions/crabbox/src/crabbox-worker-command.ts‎

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,8 @@ export function provisionProfileError(result: SpawnResult): WorkerProviderError
9494
return undefined;
9595
}
9696

97-
export function isAuthoritativeLeaseAbsence(result: SpawnResult, identifier: string): boolean {
97+
// Recognition failure does not prove resource absence; only the stop owner can confirm cleanup.
98+
export function isUnrecognizedLease(result: SpawnResult, identifier: string): boolean {
9899
const output = `${result.stderr}\n${result.stdout}`;
99100
if (
100101
!output.includes(identifier) ||
@@ -137,16 +138,5 @@ export async function stopCrabboxLease(params: {
137138
if (result.termination === "exit" && result.code === 0) {
138139
return;
139140
}
140-
const alreadyStopped =
141-
`${result.stderr}\n${result.stdout}`.includes(params.id) &&
142-
/\balready (?:destroyed|released|stopped|terminated)\b/iu.test(
143-
`${result.stderr}\n${result.stdout}`,
144-
);
145-
if (
146-
result.termination === "exit" &&
147-
(isAuthoritativeLeaseAbsence(result, params.id) || alreadyStopped)
148-
) {
149-
return;
150-
}
151141
throw crabboxCommandError("stop", result);
152142
}

0 commit comments

Comments
 (0)