


























@@ -64,7 +64,7 @@ describe("loadCliSessionHistoryMessages", () => {
6464vi.unstubAllEnvs();
6565});
666667-it("reads the canonical session transcript instead of an arbitrary external path", () => {
67+it("reads the canonical session transcript instead of an arbitrary external path", async () => {
6868const stateDir = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-cli-state-"));
6969const outsideDir = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-cli-outside-"));
7070vi.stubEnv("OPENCLAW_STATE_DIR", stateDir);
@@ -82,7 +82,7 @@ describe("loadCliSessionHistoryMessages", () => {
82828383try {
8484expect(
85-loadCliSessionHistoryMessages({
85+await loadCliSessionHistoryMessages({
8686sessionId: "session-test",
8787sessionFile: outsideFile,
8888sessionKey: "agent:main:main",
@@ -95,7 +95,7 @@ describe("loadCliSessionHistoryMessages", () => {
9595}
9696});
979798-it("keeps only the newest bounded history window", () => {
98+it("keeps only the newest bounded history window", async () => {
9999const stateDir = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-cli-state-"));
100100vi.stubEnv("OPENCLAW_STATE_DIR", stateDir);
101101const sessionFile = createSessionTranscript({
@@ -108,7 +108,7 @@ describe("loadCliSessionHistoryMessages", () => {
108108});
109109110110try {
111-const history = loadCliSessionHistoryMessages({
111+const history = await loadCliSessionHistoryMessages({
112112sessionId: "session-bounded",
113113 sessionFile,
114114sessionKey: "agent:main:main",
@@ -125,7 +125,7 @@ describe("loadCliSessionHistoryMessages", () => {
125125}
126126});
127127128-it("rejects symlinked transcripts instead of following them outside the sessions directory", () => {
128+it("rejects symlinked transcripts instead of following them outside the sessions directory", async () => {
129129const stateDir = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-cli-state-"));
130130const outsideDir = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-cli-outside-"));
131131vi.stubEnv("OPENCLAW_STATE_DIR", stateDir);
@@ -147,7 +147,7 @@ describe("loadCliSessionHistoryMessages", () => {
147147148148try {
149149expect(
150-loadCliSessionHistoryMessages({
150+await loadCliSessionHistoryMessages({
151151sessionId: "session-symlink",
152152sessionFile: canonicalSessionFile,
153153sessionKey: "agent:main:main",
@@ -160,7 +160,7 @@ describe("loadCliSessionHistoryMessages", () => {
160160}
161161});
162162163-it("drops oversized transcript files instead of loading them into hook payloads", () => {
163+it("drops oversized transcript files instead of loading them into hook payloads", async () => {
164164const stateDir = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-cli-state-"));
165165vi.stubEnv("OPENCLAW_STATE_DIR", stateDir);
166166const sessionFile = path.join(
@@ -175,7 +175,7 @@ describe("loadCliSessionHistoryMessages", () => {
175175176176try {
177177expect(
178-loadCliSessionHistoryMessages({
178+await loadCliSessionHistoryMessages({
179179sessionId: "session-oversized",
180180 sessionFile,
181181sessionKey: "agent:main:main",
@@ -187,7 +187,7 @@ describe("loadCliSessionHistoryMessages", () => {
187187}
188188});
189189190-it("honors custom session store roots when resolving hook history transcripts", () => {
190+it("honors custom session store roots when resolving hook history transcripts", async () => {
191191const stateDir = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-cli-state-"));
192192const customStoreDir = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-cli-store-"));
193193vi.stubEnv("OPENCLAW_STATE_DIR", stateDir);
@@ -202,7 +202,7 @@ describe("loadCliSessionHistoryMessages", () => {
202202203203try {
204204expect(
205-loadCliSessionHistoryMessages({
205+await loadCliSessionHistoryMessages({
206206sessionId: "session-custom-store",
207207 sessionFile,
208208sessionKey: "agent:main:main",
@@ -226,7 +226,7 @@ describe("loadCliSessionReseedMessages", () => {
226226vi.unstubAllEnvs();
227227});
228228229-it("does not reseed fresh CLI sessions from raw transcript history before compaction", () => {
229+it("does not reseed fresh CLI sessions from raw transcript history before compaction", async () => {
230230const stateDir = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-cli-state-"));
231231vi.stubEnv("OPENCLAW_STATE_DIR", stateDir);
232232const sessionFile = createSessionTranscript({
@@ -237,7 +237,7 @@ describe("loadCliSessionReseedMessages", () => {
237237238238try {
239239expect(
240-loadCliSessionReseedMessages({
240+await loadCliSessionReseedMessages({
241241sessionId: "session-no-compaction",
242242 sessionFile,
243243sessionKey: "agent:main:main",
@@ -249,7 +249,7 @@ describe("loadCliSessionReseedMessages", () => {
249249}
250250});
251251252-it("reseeds fresh CLI sessions from the latest compaction summary and post-compaction tail", () => {
252+it("reseeds fresh CLI sessions from the latest compaction summary and post-compaction tail", async () => {
253253const stateDir = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-cli-state-"));
254254vi.stubEnv("OPENCLAW_STATE_DIR", stateDir);
255255const sessionFile = createSessionTranscript({
@@ -287,7 +287,7 @@ describe("loadCliSessionReseedMessages", () => {
287287);
288288289289try {
290-const reseed = loadCliSessionReseedMessages({
290+const reseed = await loadCliSessionReseedMessages({
291291sessionId: "session-compacted",
292292 sessionFile,
293293sessionKey: "agent:main:main",
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。