mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-13 23:06:38 +00:00
feat: lightweight bootstrap context mode for heartbeat/cron runs (openclaw#26064) thanks @jose-velez
Verified: - pnpm build - pnpm check (fails on pre-existing unrelated repo issues in extensions/diffs and src/agents/tools/nodes-tool.test.ts) - pnpm vitest run src/agents/bootstrap-files.test.ts src/infra/heartbeat-runner.model-override.test.ts src/cli/cron-cli.test.ts - pnpm test:macmini (fails on pre-existing extensions/diffs import errors; touched suites pass) Co-authored-by: jose-velez <10926182+jose-velez@users.noreply.github.com> Co-authored-by: Tak Hoffman <781889+Takhoffman@users.noreply.github.com>
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
||||
import {
|
||||
@@ -97,4 +98,32 @@ describe("resolveBootstrapContextForRun", () => {
|
||||
|
||||
expect(extra?.content).toBe("extra");
|
||||
});
|
||||
|
||||
it("uses heartbeat-only bootstrap files in lightweight heartbeat mode", async () => {
|
||||
const workspaceDir = await makeTempWorkspace("openclaw-bootstrap-");
|
||||
await fs.writeFile(path.join(workspaceDir, "HEARTBEAT.md"), "check inbox", "utf8");
|
||||
await fs.writeFile(path.join(workspaceDir, "SOUL.md"), "persona", "utf8");
|
||||
|
||||
const files = await resolveBootstrapFilesForRun({
|
||||
workspaceDir,
|
||||
contextMode: "lightweight",
|
||||
runKind: "heartbeat",
|
||||
});
|
||||
|
||||
expect(files.length).toBeGreaterThan(0);
|
||||
expect(files.every((file) => file.name === "HEARTBEAT.md")).toBe(true);
|
||||
});
|
||||
|
||||
it("keeps bootstrap context empty in lightweight cron mode", async () => {
|
||||
const workspaceDir = await makeTempWorkspace("openclaw-bootstrap-");
|
||||
await fs.writeFile(path.join(workspaceDir, "HEARTBEAT.md"), "check inbox", "utf8");
|
||||
|
||||
const files = await resolveBootstrapFilesForRun({
|
||||
workspaceDir,
|
||||
contextMode: "lightweight",
|
||||
runKind: "cron",
|
||||
});
|
||||
|
||||
expect(files).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user