Skip to content

Commit f79b961

Browse files
committed
test: align compaction opt-in CI coverage
1 parent f182fb2 commit f79b961

2 files changed

Lines changed: 26 additions & 1 deletion

File tree

src/auto-reply/reply/agent-runner.misc.runreplyagent.test.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
isEmbeddedPiRunActive,
99
} from "../../agents/pi-embedded-runner/runs.js";
1010
import { clearRuntimeConfigSnapshot } from "../../config/config.js";
11+
import type { OpenClawConfig } from "../../config/config.js";
1112
import * as sessionTypesModule from "../../config/sessions.js";
1213
import type { SessionEntry } from "../../config/sessions.js";
1314
import { loadSessionStore, saveSessionStore } from "../../config/sessions.js";
@@ -292,6 +293,7 @@ describe("runReplyAgent auto-compaction token update", () => {
292293
async function runBaseReplyWithAgentMeta(params: {
293294
agentMeta: Record<string, unknown>;
294295
collectDiagnostics?: boolean;
296+
config?: OpenClawConfig;
295297
tmpPrefix: string;
296298
workspaceDir?: string;
297299
}) {
@@ -322,6 +324,7 @@ describe("runReplyAgent auto-compaction token update", () => {
322324
const { typing, sessionCtx, resolvedQueue, followupRun } = createBaseRun({
323325
storePath,
324326
sessionEntry,
327+
config: params.config,
325328
workspaceDir: params.workspaceDir,
326329
});
327330

@@ -507,7 +510,7 @@ describe("runReplyAgent auto-compaction token update", () => {
507510
);
508511
});
509512

510-
it("reads post-compaction context from the queued workspace instead of process cwd", async () => {
513+
it("reads opted-in post-compaction context from the queued workspace instead of process cwd", async () => {
511514
const workspaceDir = await fs.mkdtemp(
512515
path.join(os.tmpdir(), "openclaw-post-compaction-workspace-"),
513516
);
@@ -529,6 +532,13 @@ describe("runReplyAgent auto-compaction token update", () => {
529532
const { sessionKey } = await runBaseReplyWithAgentMeta({
530533
tmpPrefix: "openclaw-post-compaction-workspace-root-",
531534
workspaceDir,
535+
config: {
536+
agents: {
537+
defaults: {
538+
compaction: { postCompactionSections: ["Session Startup", "Red Lines"] },
539+
},
540+
},
541+
},
532542
agentMeta: {
533543
compactionCount: 1,
534544
lastCallUsage: { input: 10_000, output: 500, total: 10_500 },

test/scripts/test-projects.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
buildFullSuiteVitestRunPlans,
1111
buildVitestArgs,
1212
buildVitestRunPlans,
13+
findUnmatchedExplicitTestTargets,
1314
listFullExtensionVitestProjectConfigs,
1415
orderFullSuiteSpecsForParallelRun,
1516
shouldAcquireLocalHeavyCheckLock,
@@ -272,6 +273,20 @@ describe("scripts/test-projects changed-target routing", () => {
272273
]);
273274
});
274275

276+
it("allows explicit split Vitest config targets without treating them as unmatched tests", () => {
277+
expect(
278+
findUnmatchedExplicitTestTargets(
279+
[
280+
"test/vitest/vitest.agents-core.config.ts",
281+
"test/vitest/vitest.agents-pi-embedded.config.ts",
282+
"test/vitest/vitest.agents-support.config.ts",
283+
"test/vitest/vitest.agents-tools.config.ts",
284+
],
285+
process.cwd(),
286+
),
287+
).toEqual([]);
288+
});
289+
275290
it("routes contract roots to separate contract shards", () => {
276291
const plans = buildVitestRunPlans([
277292
"src/channels/plugins/contracts/channel-catalog.contract.test.ts",

0 commit comments

Comments
 (0)