Files
openclaw/src/shared/agent-liveness.ts
Andy Ye c2004fe662 fix(agents): surface blocked subagent completions (#80886)
Summary:
- The PR adds shared blocked-liveness normalization, applies it to agent.wait, gateway dedupe, subagent registry, and announcement paths, and adds regression tests plus a changelog entry.
- Reproducibility: yes. from source inspection: current main accepts blocked lifecycle/wait metadata as ok thr ...  gateway wait and registry completion paths. I did not run a live provider overflow in this read-only pass.

Automerge notes:
- PR branch already contained follow-up commit before automerge: fix(agents): normalize blocked wait completions
- PR branch already contained follow-up commit before automerge: fix(agents): surface blocked subagent completions

Validation:
- ClawSweeper review passed for head 224785c8a6.
- Required merge gates passed before the squash merge.

Prepared head SHA: 224785c8a6
Review: https://github.com/openclaw/openclaw/pull/80886#issuecomment-4427552621

Co-authored-by: Andy Ye <35905412+TurboTheTurtle@users.noreply.github.com>
Co-authored-by: clawsweeper <274271284+clawsweeper[bot]@users.noreply.github.com>
Co-authored-by: clawsweeper[bot] <274271284+clawsweeper[bot]@users.noreply.github.com>
2026-05-21 22:34:21 +00:00

26 lines
890 B
TypeScript

export function isBlockedLivenessState(livenessState: unknown): boolean {
return typeof livenessState === "string" && livenessState.trim().toLowerCase() === "blocked";
}
export function formatBlockedLivenessError(error: unknown): string {
const message = typeof error === "string" ? error.trim() : "";
return message || "Agent run blocked before producing a usable result.";
}
export function normalizeBlockedLivenessWaitStatus<
TStatus extends "ok" | "error" | "timeout" | "pending",
>(params: {
status: TStatus;
livenessState?: unknown;
error?: unknown;
}): { status: TStatus | "error"; error?: string } {
const error = typeof params.error === "string" ? params.error : undefined;
if (!isBlockedLivenessState(params.livenessState)) {
return { status: params.status, error };
}
return {
status: "error",
error: formatBlockedLivenessError(error),
};
}