mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-11 04:24:31 +00:00
fix(subagents): strip leaked [[reply_to]] tags from completion announces (#34503)
* fix(subagents): strip reply tags from completion delivery text * test(subagents): cover reply-tag stripping in cron completion sends * changelog: note iMessage reply-tag stripping in completion announces * Update CHANGELOG.md * Apply suggestion from @greptile-apps[bot] Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --------- Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
This commit is contained in:
@@ -20,6 +20,7 @@ Docs: https://docs.openclaw.ai
|
|||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
|
|
||||||
|
- iMessage/cron completion announces: strip leaked inline reply tags (for example `[[reply_to:6100]]`) from user-visible completion text so announcement deliveries do not expose threading metadata. (#24600) Thanks @vincentkoc.
|
||||||
- Agents/context pruning: guard assistant thinking/text char estimation against malformed blocks (missing `thinking`/`text` strings or null entries) so pruning no longer crashes with malformed provider content. (openclaw#35146) thanks @Sid-Qin.
|
- Agents/context pruning: guard assistant thinking/text char estimation against malformed blocks (missing `thinking`/`text` strings or null entries) so pruning no longer crashes with malformed provider content. (openclaw#35146) thanks @Sid-Qin.
|
||||||
- Agents/schema cleaning: detect Venice + Grok model IDs as xAI-proxied targets so unsupported JSON Schema keywords are stripped before requests, preventing Venice/Grok `Invalid arguments` failures. (openclaw#35355) thanks @Sid-Qin.
|
- Agents/schema cleaning: detect Venice + Grok model IDs as xAI-proxied targets so unsupported JSON Schema keywords are stripped before requests, preventing Venice/Grok `Invalid arguments` failures. (openclaw#35355) thanks @Sid-Qin.
|
||||||
- Skills/native command deduplication: centralize skill command dedupe by canonical `skillName` in `listSkillCommandsForAgents` so duplicate suffixed variants (for example `_2`) are no longer surfaced across interfaces outside Discord. (#27521) thanks @shivama205.
|
- Skills/native command deduplication: centralize skill command dedupe by canonical `skillName` in `listSkillCommandsForAgents` so duplicate suffixed variants (for example `_2`) are no longer surfaced across interfaces outside Discord. (#27521) thanks @shivama205.
|
||||||
|
|||||||
@@ -430,6 +430,40 @@ describe("subagent announce formatting", () => {
|
|||||||
expect(msg).not.toContain("Convert the result above into your normal assistant voice");
|
expect(msg).not.toContain("Convert the result above into your normal assistant voice");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("strips reply tags from cron completion direct-send messages", async () => {
|
||||||
|
sessionStore = {
|
||||||
|
"agent:main:subagent:test": {
|
||||||
|
sessionId: "child-session-cron-direct",
|
||||||
|
},
|
||||||
|
"agent:main:main": {
|
||||||
|
sessionId: "requester-session-cron-direct",
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
const didAnnounce = await runSubagentAnnounceFlow({
|
||||||
|
childSessionKey: "agent:main:subagent:test",
|
||||||
|
childRunId: "run-cron-reply-tag-strip",
|
||||||
|
requesterSessionKey: "agent:main:main",
|
||||||
|
requesterDisplayKey: "main",
|
||||||
|
requesterOrigin: { channel: "imessage", to: "imessage:+15550001111" },
|
||||||
|
...defaultOutcomeAnnounce,
|
||||||
|
announceType: "cron job",
|
||||||
|
expectsCompletionMessage: true,
|
||||||
|
roundOneReply:
|
||||||
|
"[[reply_to:6100]] this is a hype post + a gentle callout for the NYC meet. In short:",
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(didAnnounce).toBe(true);
|
||||||
|
expect(sendSpy).toHaveBeenCalledTimes(1);
|
||||||
|
expect(agentSpy).not.toHaveBeenCalled();
|
||||||
|
const call = sendSpy.mock.calls[0]?.[0] as { params?: Record<string, unknown> };
|
||||||
|
const rawMessage = call?.params?.message;
|
||||||
|
const msg = typeof rawMessage === "string" ? rawMessage : "";
|
||||||
|
expect(call?.params?.channel).toBe("imessage");
|
||||||
|
expect(msg).toBe("this is a hype post + a gentle callout for the NYC meet. In short:");
|
||||||
|
expect(msg).not.toContain("[[reply_to:");
|
||||||
|
});
|
||||||
|
|
||||||
it("keeps direct completion send when only the announcing run itself is pending", async () => {
|
it("keeps direct completion send when only the announcing run itself is pending", async () => {
|
||||||
sessionStore = {
|
sessionStore = {
|
||||||
"agent:main:subagent:test": {
|
"agent:main:subagent:test": {
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import {
|
|||||||
mergeDeliveryContext,
|
mergeDeliveryContext,
|
||||||
normalizeDeliveryContext,
|
normalizeDeliveryContext,
|
||||||
} from "../utils/delivery-context.js";
|
} from "../utils/delivery-context.js";
|
||||||
|
import { parseInlineDirectives } from "../utils/directive-tags.js";
|
||||||
import { isDeliverableMessageChannel, isInternalMessageChannel } from "../utils/message-channel.js";
|
import { isDeliverableMessageChannel, isInternalMessageChannel } from "../utils/message-channel.js";
|
||||||
import {
|
import {
|
||||||
buildAnnounceIdFromChildRun,
|
buildAnnounceIdFromChildRun,
|
||||||
@@ -82,7 +83,10 @@ function buildCompletionDeliveryMessage(params: {
|
|||||||
outcome?: SubagentRunOutcome;
|
outcome?: SubagentRunOutcome;
|
||||||
announceType?: SubagentAnnounceType;
|
announceType?: SubagentAnnounceType;
|
||||||
}): string {
|
}): string {
|
||||||
const findingsText = params.findings.trim();
|
const findingsText = parseInlineDirectives(params.findings, {
|
||||||
|
stripAudioTag: false,
|
||||||
|
stripReplyTags: true,
|
||||||
|
}).text;
|
||||||
if (isAnnounceSkip(findingsText)) {
|
if (isAnnounceSkip(findingsText)) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user