mirror of
https://github.com/farcasclaudiu/openclaw.git
synced 2026-06-28 21:01:43 +03:00
Add more tests; make fall back more resilient and visible
This commit is contained in:
committed by
Vignesh
parent
2c30ba400b
commit
3a57106c1e
@@ -242,7 +242,7 @@ describe("memory cli", () => {
|
||||
await program.parseAsync(["memory", "status", "--index"], { from: "user" });
|
||||
|
||||
expect(sync).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ reason: "cli", progress: expect.any(Function) }),
|
||||
expect.objectContaining({ reason: "cli", force: true, progress: expect.any(Function) }),
|
||||
);
|
||||
expect(probeEmbeddingAvailability).toHaveBeenCalled();
|
||||
expect(close).toHaveBeenCalled();
|
||||
@@ -267,7 +267,7 @@ describe("memory cli", () => {
|
||||
await program.parseAsync(["memory", "index"], { from: "user" });
|
||||
|
||||
expect(sync).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ reason: "cli", force: false, progress: expect.any(Function) }),
|
||||
expect.objectContaining({ reason: "cli", force: true, progress: expect.any(Function) }),
|
||||
);
|
||||
expect(close).toHaveBeenCalled();
|
||||
expect(log).toHaveBeenCalledWith("Memory index updated (main).");
|
||||
@@ -294,7 +294,7 @@ describe("memory cli", () => {
|
||||
await program.parseAsync(["memory", "index"], { from: "user" });
|
||||
|
||||
expect(sync).toHaveBeenCalledWith(
|
||||
expect.objectContaining({ reason: "cli", force: false, progress: expect.any(Function) }),
|
||||
expect.objectContaining({ reason: "cli", force: true, progress: expect.any(Function) }),
|
||||
);
|
||||
expect(close).toHaveBeenCalled();
|
||||
expect(error).toHaveBeenCalledWith(
|
||||
|
||||
@@ -284,6 +284,7 @@ export async function runMemoryStatus(opts: MemoryCommandOptions) {
|
||||
try {
|
||||
await manager.sync({
|
||||
reason: "cli",
|
||||
force: true,
|
||||
progress: (syncUpdate) => {
|
||||
update({
|
||||
completed: syncUpdate.completed,
|
||||
@@ -492,9 +493,8 @@ export function registerMemoryCli(program: Command) {
|
||||
.command("index")
|
||||
.description("Reindex memory files")
|
||||
.option("--agent <id>", "Agent id (default: default agent)")
|
||||
.option("--force", "Force full reindex", false)
|
||||
.option("--verbose", "Verbose logging", false)
|
||||
.action(async (opts: MemoryCommandOptions & { force?: boolean }) => {
|
||||
.action(async (opts: MemoryCommandOptions) => {
|
||||
setVerbose(Boolean(opts.verbose));
|
||||
const cfg = loadConfig();
|
||||
const agentIds = resolveAgentIds(cfg, opts.agent);
|
||||
@@ -584,7 +584,7 @@ export function registerMemoryCli(program: Command) {
|
||||
try {
|
||||
await manager.sync({
|
||||
reason: "cli",
|
||||
force: opts.force,
|
||||
force: true,
|
||||
progress: (syncUpdate) => {
|
||||
if (syncUpdate.label) {
|
||||
lastLabel = syncUpdate.label;
|
||||
|
||||
Reference in New Issue
Block a user