mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 21:21:38 +00:00
fix(types): align restart sentinel and typing test mocks
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||||
import type { ReplyPayload } from "../types.js";
|
import type { ReplyPayload } from "../types.js";
|
||||||
|
import type { TypingSignaler } from "./typing-mode.js";
|
||||||
|
|
||||||
const hoisted = vi.hoisted(() => {
|
const hoisted = vi.hoisted(() => {
|
||||||
const loadSessionStoreMock = vi.fn();
|
const loadSessionStoreMock = vi.fn();
|
||||||
@@ -100,7 +101,7 @@ describe("agent runner helpers", () => {
|
|||||||
|
|
||||||
it("signals typing only when any payload has text or media", async () => {
|
it("signals typing only when any payload has text or media", async () => {
|
||||||
const signalRunStart = vi.fn().mockResolvedValue(undefined);
|
const signalRunStart = vi.fn().mockResolvedValue(undefined);
|
||||||
const typingSignals = { signalRunStart };
|
const typingSignals = { signalRunStart } as unknown as TypingSignaler;
|
||||||
const emptyPayloads: ReplyPayload[] = [{ text: " " }, {}];
|
const emptyPayloads: ReplyPayload[] = [{ text: " " }, {}];
|
||||||
await signalTypingIfNeeded(emptyPayloads, typingSignals);
|
await signalTypingIfNeeded(emptyPayloads, typingSignals);
|
||||||
expect(signalRunStart).not.toHaveBeenCalled();
|
expect(signalRunStart).not.toHaveBeenCalled();
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ export async function scheduleRestartSentinelWake(_params: { deps: CliDeps }) {
|
|||||||
const { baseSessionKey, threadId: sessionThreadId } = parseSessionThreadInfo(sessionKey);
|
const { baseSessionKey, threadId: sessionThreadId } = parseSessionThreadInfo(sessionKey);
|
||||||
|
|
||||||
const { cfg, entry } = loadSessionEntry(sessionKey);
|
const { cfg, entry } = loadSessionEntry(sessionKey);
|
||||||
const parsedTarget = resolveAnnounceTargetFromKey(baseSessionKey);
|
const parsedTarget = resolveAnnounceTargetFromKey(baseSessionKey ?? sessionKey);
|
||||||
|
|
||||||
// Prefer delivery context from sentinel (captured at restart) over session store
|
// Prefer delivery context from sentinel (captured at restart) over session store
|
||||||
// Handles race condition where store wasn't flushed before restart
|
// Handles race condition where store wasn't flushed before restart
|
||||||
|
|||||||
Reference in New Issue
Block a user