fix(onboarding): preserve emoji in recommendation reasons (#110401)

Co-authored-by: Peter Steinberger <steipete@gmail.com>
This commit is contained in:
Leon-SK668
2026-07-19 06:19:33 +08:00
committed by GitHub
parent 264a7b0d12
commit 4e6bb619f7
2 changed files with 4 additions and 2 deletions
@@ -170,7 +170,7 @@ describe("setup app recommendation matcher", () => {
});
it("tolerates fenced JSON with extra keys and long reasons", async () => {
const reason = `useful ${"very ".repeat(40)}integration`;
const reason = `${"a".repeat(118)}🤖suffix`;
const result = await getSetupAppRecommendations({
inventorySource,
runtime: defaultRuntime,
@@ -200,6 +200,7 @@ describe("setup app recommendation matcher", () => {
expect(result.status).toBe("ok");
if (result.status === "ok") {
expect(result.matches[0]?.candidateId).toBe("notes-tools");
expect(result.matches[0]?.reason).toBe(`${"a".repeat(118)}`);
expect(result.matches[0]?.reason.length).toBeLessThanOrEqual(120);
}
});
@@ -1,3 +1,4 @@
import { truncateUtf16Safe } from "@openclaw/normalization-core/utf16-slice";
import pLimit from "p-limit";
import { z } from "zod";
import { searchClawHubSkills } from "../infra/clawhub.js";
@@ -79,7 +80,7 @@ const MatcherOutputSchema = z.object({
.string()
.trim()
.min(1)
.transform((value) => (value.length > 120 ? `${value.slice(0, 119)}` : value)),
.transform((value) => (value.length > 120 ? `${truncateUtf16Safe(value, 119)}` : value)),
}),
),
});