mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-28 03:10:36 +00:00
fix(agents): preserve accepted spawn terminal success
This commit is contained in:
@@ -24,12 +24,14 @@ export function normalizeAcceptedSessionSpawnResult(result: unknown): AcceptedSe
|
||||
return { runId, childSessionKey };
|
||||
}
|
||||
|
||||
export function hasAcceptedSessionSpawn(
|
||||
acceptedSessionSpawns?: readonly AcceptedSessionSpawn[],
|
||||
): boolean {
|
||||
export function hasAcceptedSessionSpawn(acceptedSessionSpawns?: readonly unknown[]): boolean {
|
||||
return (acceptedSessionSpawns ?? []).some((spawn) => {
|
||||
const record = asRecord(spawn);
|
||||
if (!record) {
|
||||
return false;
|
||||
}
|
||||
return Boolean(
|
||||
normalizeOptionalString(spawn.runId) && normalizeOptionalString(spawn.childSessionKey),
|
||||
normalizeOptionalString(record.runId) && normalizeOptionalString(record.childSessionKey),
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1883,6 +1883,20 @@ describe("runEmbeddedPiAgent incomplete-turn safety", () => {
|
||||
expect(hasOutboundDeliveryEvidence({ acceptedSessionSpawns })).toBe(true);
|
||||
});
|
||||
|
||||
it("ignores malformed accepted sessions_spawn delivery evidence", () => {
|
||||
expect(
|
||||
hasOutboundDeliveryEvidence({
|
||||
acceptedSessionSpawns: [
|
||||
null,
|
||||
{
|
||||
runId: "run-child",
|
||||
childSessionKey: " ",
|
||||
},
|
||||
],
|
||||
}),
|
||||
).toBe(false);
|
||||
});
|
||||
|
||||
it("leaves committed delivery plus tool errors to the tool-error payload path", () => {
|
||||
const incompleteTurnText = resolveIncompleteTurnPayloadText({
|
||||
payloadCount: 0,
|
||||
|
||||
Reference in New Issue
Block a user