Skip to content

Commit 59533cb

Browse files
authored
test: remove latest direct test mirrors (#123704)
1 parent 621220a commit 59533cb

7 files changed

Lines changed: 6 additions & 291 deletions

File tree

‎src/agents/embedded-agent-runner/thinking-replay-repair.test.ts‎

Lines changed: 1 addition & 159 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,8 @@
11
// Provider thinking replay repair tests cover durable transcript cleanup after
22
// Anthropic/Bedrock proves a signed thinking block invalid.
3-
import fs from "node:fs/promises";
4-
import os from "node:os";
5-
import path from "node:path";
63
import type { AgentMessage } from "openclaw/plugin-sdk/agent-core";
74
import { SessionManager } from "openclaw/plugin-sdk/agent-sessions";
8-
import type { Model } from "openclaw/plugin-sdk/llm";
9-
import { describe, expect, it, vi } from "vitest";
10-
import { formatSqliteSessionFileMarker } from "../../config/sessions/legacy-sqlite-marker.js";
11-
import { replaceSessionEntry } from "../../config/sessions/session-accessor.js";
12-
import type { SessionEntry } from "../../config/sessions/types.js";
13-
import { testing } from "../openai-transport-stream.test-support.js";
14-
import { convertToLlm } from "../sessions/messages.js";
5+
import { describe, expect, it } from "vitest";
156
import {
167
repairRejectedCompactionReplayInSessionManager,
178
repairRejectedThinkingReplayInSessionManager,
@@ -189,153 +180,4 @@ describe("repairRejectedCompactionReplayInSessionManager", () => {
189180
.map((message) => message.providerReplay),
190181
).toEqual([undefined, undefined]);
191182
});
192-
193-
it("removes a rejected checkpoint from the reopened SQLite branch", async () => {
194-
const dir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-compaction-repair-"));
195-
try {
196-
const storePath = path.join(dir, "sessions.json");
197-
const sessionId = "compaction-repair-session";
198-
const sessionKey = "agent:main:compaction-repair";
199-
const sessionFile = formatSqliteSessionFileMarker({
200-
agentId: "main",
201-
sessionId,
202-
storePath,
203-
});
204-
const target = { agentId: "main", sessionId, sessionKey, storePath };
205-
await replaceSessionEntry({ sessionKey, storePath }, {
206-
sessionFile,
207-
sessionId,
208-
updatedAt: 10,
209-
} as SessionEntry);
210-
211-
const model = {
212-
id: "gpt-5.5",
213-
name: "GPT-5.5",
214-
api: "openai-responses",
215-
provider: "openai",
216-
baseUrl: "https://api.openai.com/v1",
217-
reasoning: true,
218-
input: ["text"],
219-
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
220-
contextWindow: 128_000,
221-
maxTokens: 8_192,
222-
} satisfies Model<"openai-responses">;
223-
const identity = { sessionId, authProfileId: "profile-a" };
224-
const replayContext = testing.buildOpenAIResponsesReasoningReplayMetadata(model, identity);
225-
const checkpointContext = {
226-
provider: replayContext.provider,
227-
api: replayContext.api,
228-
model: replayContext.model,
229-
baseUrlHash: replayContext.baseUrlHash,
230-
sessionHash: replayContext.sessionHash,
231-
authProfileHash: replayContext.authProfileHash,
232-
};
233-
const sessionManager = SessionManager.open(target, dir);
234-
sessionManager.appendMessage(
235-
asAppendMessage({ role: "user", content: "full history prefix", timestamp: 1 }),
236-
);
237-
sessionManager.appendMessage(
238-
asAppendMessage({
239-
role: "assistant",
240-
content: [{ type: "toolCall", id: "call_1", name: "read", arguments: {} }],
241-
api: model.api,
242-
provider: model.provider,
243-
model: model.id,
244-
stopReason: "toolUse",
245-
timestamp: 2,
246-
providerReplay: {
247-
v: 1,
248-
type: "openai-responses-compaction",
249-
id: "cmp_rejected",
250-
data: "rejected-compaction-ciphertext",
251-
replayIndex: 0,
252-
...checkpointContext,
253-
},
254-
}),
255-
);
256-
sessionManager.appendMessage(
257-
asAppendMessage({
258-
role: "toolResult",
259-
toolCallId: "call_1",
260-
toolName: "read",
261-
content: [{ type: "text", text: "result" }],
262-
isError: false,
263-
timestamp: 3,
264-
}),
265-
);
266-
sessionManager.appendMessage(
267-
asAppendMessage({ role: "user", content: "current turn", timestamp: 4 }),
268-
);
269-
270-
const invalidEncryptedContent = Object.assign(new Error("invalid encrypted content"), {
271-
code: "invalid_encrypted_content",
272-
});
273-
const retryStream = {
274-
[Symbol.asyncIterator]() {
275-
return {
276-
next: async () => {
277-
throw new Error("retry stream failed");
278-
},
279-
};
280-
},
281-
};
282-
const create = vi
283-
.fn()
284-
.mockReturnValueOnce({ withResponse: vi.fn().mockRejectedValue(invalidEncryptedContent) })
285-
.mockReturnValueOnce({
286-
withResponse: vi.fn().mockResolvedValue({
287-
data: retryStream,
288-
response: new Response(null, { status: 200 }),
289-
}),
290-
});
291-
let repairResult:
292-
| ReturnType<typeof repairRejectedCompactionReplayInSessionManager>
293-
| undefined;
294-
const recovery = await testing.createResponsesStreamWithEncryptedContentRetry({
295-
client: { responses: { create } } as never,
296-
request: {
297-
model: model.id,
298-
stream: true,
299-
input: [
300-
{
301-
type: "compaction",
302-
id: "cmp_rejected",
303-
encrypted_content: "rejected-compaction-ciphertext",
304-
},
305-
],
306-
},
307-
requestOptions: undefined,
308-
model,
309-
onCompactionRejected: (checkpoint) => {
310-
repairResult = repairRejectedCompactionReplayInSessionManager({
311-
sessionManager,
312-
checkpoint,
313-
});
314-
},
315-
});
316-
await expect(recovery.stream[Symbol.asyncIterator]().next()).rejects.toThrow(
317-
"retry stream failed",
318-
);
319-
expect(repairResult).toMatchObject({ repaired: true, repairedCount: 1 });
320-
321-
const reopened = SessionManager.open(target, dir);
322-
const messages = reopened.buildSessionContext().messages;
323-
expect(
324-
messages.find((message) => message.role === "assistant")?.providerReplay,
325-
).toBeUndefined();
326-
const request = testing.buildOpenAIResponsesParams(
327-
model,
328-
{ systemPrompt: "system", messages: convertToLlm(messages) },
329-
identity,
330-
);
331-
expect(request.input.some((item) => item.type === "compaction")).toBe(false);
332-
const encoded = JSON.stringify(request.input);
333-
expect(encoded).not.toContain("rejected-compaction-ciphertext");
334-
expect(encoded).toContain("full history prefix");
335-
expect(encoded).toContain("function_call");
336-
expect(encoded).toContain("function_call_output");
337-
} finally {
338-
await fs.rm(dir, { recursive: true, force: true });
339-
}
340-
});
341183
});

‎src/agents/embedded-agent-runner/transcript-rewrite.test.ts‎

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -176,57 +176,6 @@ describe("rewriteTranscriptEntriesInSessionManager", () => {
176176
]);
177177
});
178178

179-
it("preserves a newly captured compaction checkpoint on its replacement owner", () => {
180-
const sessionManager = SessionManager.inMemory();
181-
appendSessionMessages(sessionManager, [
182-
asAppendMessage({ role: "user", content: "compact this", timestamp: 1 }),
183-
asAppendMessage({
184-
role: "assistant",
185-
content: createTextContent("checkpoint owner"),
186-
timestamp: 2,
187-
}),
188-
]);
189-
const owner = requireValue(
190-
findAssistantEntryByText(sessionManager, "checkpoint owner"),
191-
"checkpoint owner",
192-
);
193-
if (owner.type !== "message" || owner.message.role !== "assistant") {
194-
throw new Error("expected assistant checkpoint owner");
195-
}
196-
const checkpoint = {
197-
v: 1,
198-
type: "openai-responses-compaction",
199-
id: "cmp_new",
200-
data: "opaque",
201-
replayIndex: owner.message.content.length,
202-
provider: "xai",
203-
api: "openai-responses",
204-
model: "grok-4.5",
205-
baseUrlHash: "base-url",
206-
};
207-
208-
const result = rewriteTranscriptEntriesInSessionManager({
209-
sessionManager,
210-
replacements: [
211-
{
212-
entryId: owner.id,
213-
message: { ...owner.message, providerReplay: checkpoint } as AgentMessage,
214-
},
215-
],
216-
preserveReplacementCompactionReplay: true,
217-
});
218-
219-
expect(result.changed).toBe(true);
220-
const rewrittenOwner = requireValue(
221-
findAssistantEntryByText(sessionManager, "checkpoint owner"),
222-
"rewritten checkpoint owner",
223-
);
224-
if (rewrittenOwner.type !== "message" || rewrittenOwner.message.role !== "assistant") {
225-
throw new Error("expected rewritten assistant checkpoint owner");
226-
}
227-
expect(rewrittenOwner.message.providerReplay).toEqual(checkpoint);
228-
});
229-
230179
it("preserves active-branch labels after rewritten entries are re-appended", () => {
231180
const { sessionManager, toolResultEntryId } = createReadRewriteSession();
232181
const summaryEntry = requireValue(

‎src/auto-reply/reply/commentary-progress-owner.test.ts‎

Lines changed: 0 additions & 56 deletions
This file was deleted.

‎src/auto-reply/reply/reply-run-registry.test.ts‎

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -162,19 +162,6 @@ describe("reply run registry", () => {
162162
);
163163
});
164164

165-
it("projects inbound authority through the canonical full fingerprint", () => {
166-
const run = createQueueTestRun({ prompt: "projected authority" });
167-
run.toolsAllow = attachToolAllowlistIntersection(["exec"], [["exec"], ["message"]]);
168-
const route = { provider: "openai", model: "gpt-fallback" };
169-
const projector = createFollowupRunToolAuthorityProjector(run);
170-
const overlay = toolAuthorityOverlay(run);
171-
172-
expect(projector(overlay, route)).toBe(resolveFollowupRunToolAuthorityFingerprint(run, route));
173-
expect(projector({ ...overlay, clientCaps: ["different-capability"] }, route)).not.toBe(
174-
resolveFollowupRunToolAuthorityFingerprint(run, route),
175-
);
176-
});
177-
178165
it("projects only while the active operation owns a concrete route", () => {
179166
const run = createQueueTestRun({ prompt: "operation projection" });
180167
const operation = createTestReplyOperation({ sessionId: "session-projector" });

‎src/channels/message-access/context-builder-callers.test.ts‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -217,22 +217,19 @@ function source(relativePath: string): string {
217217
}
218218

219219
describe("channel context builder caller inventory", () => {
220-
it("keeps all 26 production sinks wired to exact ingress or named unsupported paths", () => {
221-
expect(CALLERS).toHaveLength(26);
220+
it("keeps all production sinks wired to exact ingress or named unsupported paths", () => {
222221
for (const [relativePath, marker] of CALLERS) {
223222
expect(source(relativePath), relativePath).toContain(marker);
224223
}
225224
});
226225

227-
it("binds all 23 supported producers to finalized host context identity", () => {
228-
expect(CONTEXT_BINDING_PRODUCERS).toHaveLength(23);
226+
it("binds all supported producers to finalized host context identity", () => {
229227
for (const relativePath of CONTEXT_BINDING_PRODUCERS) {
230228
expect(source(relativePath), relativePath).toContain("contextBinding");
231229
}
232230
});
233231

234232
it("routes every production sink through its selected context builder", () => {
235-
expect(HOST_BUILDERS).toHaveLength(26);
236233
for (const [relativePath, marker] of HOST_BUILDERS) {
237234
expect(source(relativePath), relativePath).toContain(marker);
238235
}

‎src/gateway/worker-environments/node-launch-adapter.test.ts‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,14 +138,12 @@ describe("node worker launch adapter", () => {
138138
const onDispatchReady = vi.fn();
139139
const adapter = createNodeWorkerLaunchAdapter({
140140
getTransport: () => transportWith(vi.fn(), async () => []),
141-
availabilityTimeoutMs: 100,
142-
pollIntervalMs: 10,
143141
});
144142
try {
145143
const launch = adapter
146-
.launch({ ...launchRequest(), timeoutMs: 1_000, onDispatchReady })
144+
.launch({ ...launchRequest(), timeoutMs: 30_000, onDispatchReady })
147145
.catch((error: unknown) => error);
148-
await vi.advanceTimersByTimeAsync(100);
146+
await vi.runAllTimersAsync();
149147

150148
expect(await launch).toMatchObject({
151149
name: "WorkerRunnerUnavailableError",

‎src/gateway/worker-environments/node-launch-adapter.ts‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ type NodeWorkerLaunchAdapterOptions = {
5959
rpcTimeoutMs?: number;
6060
pollIntervalMs?: number;
6161
cancellationTimeoutMs?: number;
62-
availabilityTimeoutMs?: number;
6362
};
6463

6564
type OperationDeadline = {
@@ -208,7 +207,6 @@ export function createNodeWorkerLaunchAdapter(options: NodeWorkerLaunchAdapterOp
208207
const rpcTimeoutMs = options.rpcTimeoutMs ?? DEFAULT_RPC_TIMEOUT_MS;
209208
const pollIntervalMs = options.pollIntervalMs ?? DEFAULT_POLL_INTERVAL_MS;
210209
const cancellationTimeoutMs = options.cancellationTimeoutMs ?? DEFAULT_CANCELLATION_TIMEOUT_MS;
211-
const availabilityTimeoutMs = options.availabilityTimeoutMs ?? DEFAULT_AVAILABILITY_TIMEOUT_MS;
212210

213211
const findNode = async (params: {
214212
transport: NodeWorkerSupervisorTransport;
@@ -419,7 +417,7 @@ export function createNodeWorkerLaunchAdapter(options: NodeWorkerLaunchAdapterOp
419417
});
420418
const availabilityDeadline = createDeadline({
421419
now,
422-
timeoutMs: availabilityTimeoutMs,
420+
timeoutMs: DEFAULT_AVAILABILITY_TIMEOUT_MS,
423421
signal: deadline.signal,
424422
label: "node worker availability",
425423
});

0 commit comments

Comments
 (0)