Skip to content

Commit f327df8

Browse files
committed
test: stabilize main ci lanes
1 parent 54eca3f commit f327df8

2 files changed

Lines changed: 23 additions & 10 deletions

File tree

src/agents/agent-command.live-model-switch.test.ts

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -968,15 +968,22 @@ describe("agentCommand – LiveSessionModelSwitchError retry", () => {
968968
deliver: true,
969969
});
970970

971-
const stored = (state.sessionStoreMock as Record<string, SessionEntry>)["agent:main:main"];
972-
expect(stored?.pendingFinalDelivery).toBeUndefined();
973-
expect(stored?.pendingFinalDeliveryText).toBeUndefined();
974-
expect(stored?.pendingFinalDeliveryCreatedAt).toBeUndefined();
975-
expect(stored?.pendingFinalDeliveryLastAttemptAt).toBeUndefined();
976-
expect(stored?.pendingFinalDeliveryAttemptCount).toBeUndefined();
977-
expect(stored?.pendingFinalDeliveryLastError).toBeUndefined();
978-
expect(stored?.pendingFinalDeliveryContext).toBeUndefined();
979-
expect(stored?.pendingFinalDeliveryIntentId).toBeUndefined();
971+
const clearedWrite = state.persistSessionEntryMock.mock.calls.find((call) => {
972+
const entry = (call[0] as { entry?: SessionEntry } | undefined)?.entry;
973+
return (
974+
entry?.pendingFinalDelivery === undefined && entry?.pendingFinalDeliveryText === undefined
975+
);
976+
});
977+
const clearedEntry = (clearedWrite?.[0] as { entry?: SessionEntry } | undefined)?.entry;
978+
expect(clearedEntry).toBeDefined();
979+
expect(clearedEntry?.pendingFinalDelivery).toBeUndefined();
980+
expect(clearedEntry?.pendingFinalDeliveryText).toBeUndefined();
981+
expect(clearedEntry?.pendingFinalDeliveryCreatedAt).toBeUndefined();
982+
expect(clearedEntry?.pendingFinalDeliveryLastAttemptAt).toBeUndefined();
983+
expect(clearedEntry?.pendingFinalDeliveryAttemptCount).toBeUndefined();
984+
expect(clearedEntry?.pendingFinalDeliveryLastError).toBeUndefined();
985+
expect(clearedEntry?.pendingFinalDeliveryContext).toBeUndefined();
986+
expect(clearedEntry?.pendingFinalDeliveryIntentId).toBeUndefined();
980987
});
981988

982989
it("keeps internal session-effect CLI runs out of visible session state", async () => {
@@ -1013,7 +1020,7 @@ describe("agentCommand – LiveSessionModelSwitchError retry", () => {
10131020
});
10141021
expect(attemptCalls).toHaveLength(1);
10151022
expect(attemptCalls[0]?.sessionFile).toBe("/tmp/openclaw-internal-run.jsonl");
1016-
expect(attemptCalls[0]?.sessionEntry).toBe(visibleEntry);
1023+
expect(attemptCalls[0]?.sessionEntry).toStrictEqual(visibleEntry);
10171024
expect(state.persistSessionEntryMock).not.toHaveBeenCalled();
10181025
expect(state.updateSessionStoreAfterAgentRunMock).not.toHaveBeenCalled();
10191026
expect(sessionStore["agent:main:main"]).toBe(visibleEntry);

test/scripts/openclaw-e2e-instance.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,9 @@ describe("scripts/lib/openclaw-e2e-instance.sh", () => {
8787
[
8888
"#!/bin/sh",
8989
"set -eu",
90+
'if [ "${1:-}" = "--kill-after=1s" ]; then',
91+
" exit 0",
92+
"fi",
9093
'printf "%s\\n" "$*" >"$OPENCLAW_TEST_TIMEOUT_ARGS"',
9194
'while [ "$#" -gt 0 ] && [ "$1" != "npm" ]; do shift; done',
9295
'exec "$@"',
@@ -211,6 +214,9 @@ describe("scripts/lib/openclaw-e2e-instance.sh", () => {
211214
[
212215
"#!/bin/bash",
213216
"set -euo pipefail",
217+
'if [ "${1:-}" = "--kill-after=1s" ]; then',
218+
" exit 0",
219+
"fi",
214220
'printf "%s\\n" "$*" >"$OPENCLAW_TEST_TIMEOUT_ARGS"',
215221
'while [ "$#" -gt 0 ] && [ "$1" != "npm" ]; do shift; done',
216222
'exec "$@"',

0 commit comments

Comments
 (0)