mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-10 03:03:54 +00:00
fix(auto-reply): deliver model directive acknowledgements (#100151)
This commit is contained in:
committed by
GitHub
parent
4d181b62a9
commit
2ec765edea
@@ -2,6 +2,7 @@
|
||||
import { beforeEach, describe, expect, it, vi } from "vitest";
|
||||
import type { SessionEntry } from "../../config/sessions.js";
|
||||
import { SessionWorkStartInvalidatedError } from "../../config/sessions/lifecycle.js";
|
||||
import { getReplyPayloadMetadata } from "../reply-payload.js";
|
||||
import type { TemplateContext } from "../templating.js";
|
||||
import { resolveReplyDirectives } from "./get-reply-directives.js";
|
||||
import { buildTestCtx } from "./test-ctx.js";
|
||||
@@ -369,6 +370,26 @@ describe("resolveReplyDirectives", () => {
|
||||
expect(mocks.applyInlineDirectiveOverrides).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it("marks terminal directive replies for delivery under source suppression", async () => {
|
||||
mocks.applyInlineDirectiveOverrides.mockResolvedValueOnce({
|
||||
kind: "reply",
|
||||
reply: { text: "Model set to fable (anthropic/claude-fable-5) for this session." },
|
||||
});
|
||||
|
||||
const { result } = await resolveHelloWithModelDefaults({
|
||||
body: "/model fable",
|
||||
commandAuthorized: true,
|
||||
defaultThinking: "off",
|
||||
defaultReasoning: "on",
|
||||
});
|
||||
|
||||
expect(result.kind).toBe("reply");
|
||||
if (result.kind !== "reply" || !result.reply || Array.isArray(result.reply)) {
|
||||
throw new Error("expected a single directive reply");
|
||||
}
|
||||
expect(getReplyPayloadMetadata(result.reply)?.deliverDespiteSourceReplySuppression).toBe(true);
|
||||
});
|
||||
|
||||
it("keeps one-turn fast mode with the resolved fast mode", async () => {
|
||||
const { result } = await resolveHelloWithModelDefaults({
|
||||
defaultThinking: "off",
|
||||
|
||||
@@ -15,6 +15,7 @@ import { normalizeAgentId } from "../../routing/session-key.js";
|
||||
import { createLazyImportLoader } from "../../shared/lazy-promise.js";
|
||||
import type { SkillCommandSpec } from "../../skills/types.js";
|
||||
import { shouldHandleTextCommands } from "../commands-text-routing.js";
|
||||
import { markCommandReplyForDelivery } from "../reply-payload.js";
|
||||
import type { MsgContext, TemplateContext } from "../templating.js";
|
||||
import {
|
||||
normalizeThinkLevel,
|
||||
@@ -651,7 +652,7 @@ export async function resolveReplyDirectives(params: {
|
||||
typing,
|
||||
});
|
||||
if (applyResult.kind === "reply") {
|
||||
return { kind: "reply", reply: applyResult.reply };
|
||||
return { kind: "reply", reply: markCommandReplyForDelivery(applyResult.reply) };
|
||||
}
|
||||
directives = applyResult.directives;
|
||||
provider = applyResult.provider;
|
||||
|
||||
Reference in New Issue
Block a user