mirror of
https://github.com/farcasclaudiu/openclaw.git
synced 2026-06-28 23:02:02 +03:00
fix: preserve off-mode semantics in auto reply threading (#14976) (thanks @Diaspar4u)
This commit is contained in:
@@ -7,6 +7,7 @@ Docs: https://docs.openclaw.ai
|
|||||||
### Fixes
|
### Fixes
|
||||||
|
|
||||||
- Security/Audit: distinguish external webhooks (`hooks.enabled`) from internal hooks (`hooks.internal.enabled`) in attack-surface summaries to avoid false exposure signals when only internal hooks are enabled. (#13474) Thanks @mcaxtr.
|
- Security/Audit: distinguish external webhooks (`hooks.enabled`) from internal hooks (`hooks.internal.enabled`) in attack-surface summaries to avoid false exposure signals when only internal hooks are enabled. (#13474) Thanks @mcaxtr.
|
||||||
|
- Auto-reply/Threading: auto-inject implicit reply threading so `replyToMode` works without requiring model-emitted `[[reply_to_current]]`, while preserving `replyToMode: "off"` behavior for implicit Slack replies and keeping block-streaming chunk coalescing stable under `replyToMode: "first"`. (#14976) Thanks @Diaspar4u.
|
||||||
- Sandbox: pass configured `sandbox.docker.env` variables to sandbox containers at `docker create` time. (#15138) Thanks @stevebot-alive.
|
- Sandbox: pass configured `sandbox.docker.env` variables to sandbox containers at `docker create` time. (#15138) Thanks @stevebot-alive.
|
||||||
- Onboarding/CLI: restore terminal state without resuming paused `stdin`, so onboarding exits cleanly after choosing Web UI and the installer returns instead of appearing stuck.
|
- Onboarding/CLI: restore terminal state without resuming paused `stdin`, so onboarding exits cleanly after choosing Web UI and the installer returns instead of appearing stuck.
|
||||||
- macOS Voice Wake: fix a crash in trigger trimming for CJK/Unicode transcripts by matching and slicing on original-string ranges instead of transformed-string indices. (#11052) Thanks @Flash-LHR.
|
- macOS Voice Wake: fix a crash in trigger trimming for CJK/Unicode transcripts by matching and slicing on original-string ranges instead of transformed-string indices. (#11052) Thanks @Flash-LHR.
|
||||||
|
|||||||
@@ -376,9 +376,11 @@ export async function runAgentTurnWithFallback(params: {
|
|||||||
text,
|
text,
|
||||||
mediaUrls: payload.mediaUrls,
|
mediaUrls: payload.mediaUrls,
|
||||||
mediaUrl: payload.mediaUrls?.[0],
|
mediaUrl: payload.mediaUrls?.[0],
|
||||||
replyToId: payload.replyToId,
|
replyToId:
|
||||||
|
payload.replyToId ??
|
||||||
|
(payload.replyToCurrent === false ? undefined : currentMessageId),
|
||||||
replyToTag: payload.replyToTag,
|
replyToTag: payload.replyToTag,
|
||||||
replyToCurrent: true,
|
replyToCurrent: payload.replyToCurrent,
|
||||||
},
|
},
|
||||||
currentMessageId,
|
currentMessageId,
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -100,10 +100,12 @@ export function createBlockReplyCoalescer(params: {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
const replyToConflict = Boolean(
|
||||||
bufferText &&
|
bufferText &&
|
||||||
(bufferReplyToId !== payload.replyToId || bufferAudioAsVoice !== payload.audioAsVoice)
|
payload.replyToId &&
|
||||||
) {
|
(!bufferReplyToId || bufferReplyToId !== payload.replyToId),
|
||||||
|
);
|
||||||
|
if (bufferText && (replyToConflict || bufferAudioAsVoice !== payload.audioAsVoice)) {
|
||||||
void flush({ force: true });
|
void flush({ force: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import { describe, expect, it } from "vitest";
|
import { describe, expect, it } from "vitest";
|
||||||
import { applyReplyThreading } from "./reply-payloads.js";
|
import { applyReplyThreading } from "./reply-payloads.js";
|
||||||
|
|
||||||
describe("applyReplyThreading auto-injects replyToCurrent", () => {
|
describe("applyReplyThreading auto-threading", () => {
|
||||||
it("sets replyToId to currentMessageId even without [[reply_to_current]] tag", () => {
|
it("sets replyToId to currentMessageId even without [[reply_to_current]] tag", () => {
|
||||||
const result = applyReplyThreading({
|
const result = applyReplyThreading({
|
||||||
payloads: [{ text: "Hello" }],
|
payloads: [{ text: "Hello" }],
|
||||||
@@ -47,4 +47,29 @@ describe("applyReplyThreading auto-injects replyToCurrent", () => {
|
|||||||
expect(result).toHaveLength(1);
|
expect(result).toHaveLength(1);
|
||||||
expect(result[0].replyToId).toBeUndefined();
|
expect(result[0].replyToId).toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("does not bypass off mode for Slack when reply is implicit", () => {
|
||||||
|
const result = applyReplyThreading({
|
||||||
|
payloads: [{ text: "A" }],
|
||||||
|
replyToMode: "off",
|
||||||
|
replyToChannel: "slack",
|
||||||
|
currentMessageId: "42",
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(result).toHaveLength(1);
|
||||||
|
expect(result[0].replyToId).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("keeps explicit tags for Slack when off mode allows tags", () => {
|
||||||
|
const result = applyReplyThreading({
|
||||||
|
payloads: [{ text: "[[reply_to_current]]A" }],
|
||||||
|
replyToMode: "off",
|
||||||
|
replyToChannel: "slack",
|
||||||
|
currentMessageId: "42",
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(result).toHaveLength(1);
|
||||||
|
expect(result[0].replyToId).toBe("42");
|
||||||
|
expect(result[0].replyToTag).toBe(true);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -62,10 +62,15 @@ export function applyReplyThreading(params: {
|
|||||||
}): ReplyPayload[] {
|
}): ReplyPayload[] {
|
||||||
const { payloads, replyToMode, replyToChannel, currentMessageId } = params;
|
const { payloads, replyToMode, replyToChannel, currentMessageId } = params;
|
||||||
const applyReplyToMode = createReplyToModeFilterForChannel(replyToMode, replyToChannel);
|
const applyReplyToMode = createReplyToModeFilterForChannel(replyToMode, replyToChannel);
|
||||||
|
const implicitReplyToId = currentMessageId?.trim() || undefined;
|
||||||
return payloads
|
return payloads
|
||||||
.map((payload) =>
|
.map((payload) => {
|
||||||
applyReplyTagsToPayload({ ...payload, replyToCurrent: true }, currentMessageId),
|
const autoThreaded =
|
||||||
)
|
payload.replyToId || payload.replyToCurrent === false || !implicitReplyToId
|
||||||
|
? payload
|
||||||
|
: { ...payload, replyToId: implicitReplyToId };
|
||||||
|
return applyReplyTagsToPayload(autoThreaded, currentMessageId);
|
||||||
|
})
|
||||||
.filter(isRenderablePayload)
|
.filter(isRenderablePayload)
|
||||||
.map(applyReplyToMode);
|
.map(applyReplyToMode);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user