
























@@ -721,6 +721,57 @@ describe("runEmbeddedAttempt context engine sessionKey forwarding", () => {
721721expect(contextCompiled?.data?.systemPrompt).toContain("internal heartbeat event");
722722});
723723724+it("submits suppressed room event context as the model prompt", async () => {
725+let seenPrompt: string | undefined;
726+727+const result = await createContextEngineAttemptRunner({
728+contextEngine: createContextEngineBootstrapAndAssemble(),
729+ sessionKey,
730+ tempPaths,
731+trajectory: true,
732+attemptOverrides: {
733+prompt: "[OpenClaw room event]",
734+transcriptPrompt: "",
735+currentTurnKind: "room_event",
736+currentTurnContext: {
737+text: [
738+"[OpenClaw turn]",
739+"kind: room_event",
740+"visible_reply_contract: message_tool_only",
741+"Room context:\n#2001 Alice: lunch at 2?\n#2002 Bob: works",
742+"Current event:\n#2003 Bob: hey claw summarize the plan",
743+"Treat this as observed room activity. Decide whether to act.",
744+].join("\n\n"),
745+},
746+suppressNextUserMessagePersistence: true,
747+},
748+sessionPrompt: async (session, prompt) => {
749+seenPrompt = prompt;
750+session.messages = [
751+ ...session.messages,
752+{ role: "assistant", content: "done", timestamp: 2 },
753+];
754+},
755+});
756+757+expect(seenPrompt).toContain("[OpenClaw turn]");
758+expect(seenPrompt).toContain("kind: room_event");
759+expect(seenPrompt).toContain("visible_reply_contract: message_tool_only");
760+expect(seenPrompt).toContain("Current event:\n#2003 Bob: hey claw summarize the plan");
761+expect(seenPrompt?.trim().endsWith("[OpenClaw room event]")).toBe(true);
762+expect(seenPrompt).not.toBe("Continue the OpenClaw runtime event.");
763+expect(result.finalPromptText).toBe(seenPrompt);
764+const trajectoryEvents = (
765+await fs.readFile(path.join(tempPaths[0] ?? "", "session.trajectory.jsonl"), "utf8")
766+)
767+.trim()
768+.split("\n")
769+.map((line) => JSON.parse(line) as TrajectoryEvent);
770+const contextCompiled = trajectoryEvents.find((event) => event.type === "context.compiled");
771+expect(contextCompiled?.data?.prompt).toContain("visible_reply_contract: message_tool_only");
772+expect(contextCompiled?.data?.prompt).toContain("[OpenClaw room event]");
773+});
774+724775it("skips blank visible prompts with replay history before provider submission", async () => {
725776const sessionPrompt = vi.fn(async () => {
726777throw new Error("blank prompt should not be submitted");
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。