Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions examples/openclaw-plugin/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,12 @@ const contextEnginePlugin = {
);
return;
}
if (contextEngineRef) {
verboseRoutingInfo(
`openviking: skipping before_prompt_build auto-recall because context-engine is active (sessionKey=${ctx?.sessionKey ?? "none"}, sessionId=${ctx?.sessionId ?? "none"})`,
);
return;
}
const agentId = resolveAgentId(ctx?.sessionId, ctx?.sessionKey);
let client: OpenVikingClient;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,33 @@ describe("plugin bypass session patterns", () => {
);
});

it("skips before_prompt_build auto-recall once context-engine is active", async () => {
const { handlers, logger, registerContextEngine } = setupPlugin();

const factory = registerContextEngine.mock.calls[0]?.[1] as (() => unknown) | undefined;
expect(factory).toBeTruthy();
factory!();

const hook = handlers.get("before_prompt_build");
expect(hook).toBeTruthy();

const result = await hook!(
{
messages: [{ role: "user", content: "remember the launch checklist" }],
prompt: "remember the launch checklist",
},
{
sessionId: "runtime-session",
sessionKey: "agent:main:test:1",
},
);

expect(result).toBeUndefined();
expect(logger.warn).not.toHaveBeenCalledWith(
expect.stringContaining("failed to get client"),
);
});

it("bypasses before_reset without calling commitOVSession", async () => {
const { handlers, registerContextEngine } = setupPlugin({
bypassSessionPatterns: ["agent:*:cron:**"],
Expand Down
Loading