mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 06:00:43 +00:00
fix: Found one low-severity route-question recall regression in the co (#74582)
Co-authored-by: openclaw-clawsweeper[bot] <280122609+openclaw-clawsweeper[bot]@users.noreply.github.com>
This commit is contained in:
@@ -314,6 +314,56 @@ describe("searchMemoryWiki", () => {
|
||||
expect(evidenceResults.map((result) => result.path)).toContain("sources/maintainers.md");
|
||||
});
|
||||
|
||||
it("keeps route-question relationship matches in compiled digest prefilter", async () => {
|
||||
const { rootDir, config } = await createQueryVault({
|
||||
initialize: true,
|
||||
});
|
||||
await fs.writeFile(
|
||||
path.join(rootDir, "entities", "brad.md"),
|
||||
renderWikiMarkdown({
|
||||
frontmatter: {
|
||||
pageType: "entity",
|
||||
entityType: "person",
|
||||
id: "entity.brad",
|
||||
title: "Brad Groux",
|
||||
relationships: [
|
||||
{
|
||||
targetId: "entity.alice",
|
||||
targetTitle: "Alice",
|
||||
kind: "collaborates-with",
|
||||
note: "Azure escalation buddy",
|
||||
},
|
||||
],
|
||||
},
|
||||
body: "# Brad Groux\n\nAgent card summary.\n",
|
||||
}),
|
||||
"utf8",
|
||||
);
|
||||
await fs.writeFile(
|
||||
path.join(rootDir, "entities", "fallback.md"),
|
||||
renderWikiMarkdown({
|
||||
frontmatter: {
|
||||
pageType: "entity",
|
||||
id: "entity.fallback",
|
||||
title: "Fallback Router",
|
||||
bestUsedFor: ["Azure escalation buddy"],
|
||||
},
|
||||
body: "# Fallback Router\n\nGeneric routing note.\n",
|
||||
}),
|
||||
"utf8",
|
||||
);
|
||||
await compileMemoryWikiVault(config);
|
||||
|
||||
const routeResults = await searchMemoryWiki({
|
||||
config,
|
||||
query: "who should I ask about Azure escalation buddy?",
|
||||
mode: "route-question",
|
||||
maxResults: 1,
|
||||
});
|
||||
|
||||
expect(routeResults[0]?.path).toBe("entities/brad.md");
|
||||
});
|
||||
|
||||
it("uses body text instead of frontmatter for fallback snippets", async () => {
|
||||
const { rootDir, config } = await createQueryVault({
|
||||
initialize: true,
|
||||
|
||||
@@ -12,6 +12,7 @@ import {
|
||||
toWikiPageSummary,
|
||||
type WikiClaim,
|
||||
type WikiPageSummary,
|
||||
type WikiRelationship,
|
||||
} from "./markdown.js";
|
||||
import { initializeMemoryWikiVault } from "./vault.js";
|
||||
|
||||
@@ -98,6 +99,7 @@ type QueryDigestPage = {
|
||||
bestUsedFor?: string[];
|
||||
notEnoughFor?: string[];
|
||||
relationshipCount?: number;
|
||||
topRelationships?: WikiRelationship[];
|
||||
};
|
||||
|
||||
type QueryDigestClaim = {
|
||||
@@ -396,6 +398,16 @@ function buildDigestPageSearchText(page: QueryDigestPage, claims: QueryDigestCla
|
||||
page.personCard?.avoidAskingFor.join(" ") ?? "",
|
||||
page.personCard?.bestUsedFor.join(" ") ?? "",
|
||||
page.personCard?.notEnoughFor.join(" ") ?? "",
|
||||
page.topRelationships
|
||||
?.flatMap((relationship) => [
|
||||
relationship.targetId ?? "",
|
||||
relationship.targetPath ?? "",
|
||||
relationship.targetTitle ?? "",
|
||||
relationship.kind ?? "",
|
||||
relationship.evidenceKind ?? "",
|
||||
relationship.note ?? "",
|
||||
])
|
||||
.join(" ") ?? "",
|
||||
claims.map((claim) => claim.text).join(" "),
|
||||
claims.map((claim) => claim.id ?? "").join(" "),
|
||||
claims.map((claim) => claim.evidenceKinds?.join(" ") ?? "").join(" "),
|
||||
@@ -550,6 +562,11 @@ function buildDigestRouteQuestionFields(page: QueryDigestPage): string[] {
|
||||
...(page.notEnoughFor ?? []),
|
||||
...(page.personCard?.bestUsedFor ?? []),
|
||||
...(page.personCard?.notEnoughFor ?? []),
|
||||
...(page.topRelationships?.flatMap((relationship) => [
|
||||
relationship.kind,
|
||||
relationship.targetTitle,
|
||||
relationship.note,
|
||||
]) ?? []),
|
||||
].filter((value): value is string => Boolean(value));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user