-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Problem
buildStableKey() and parseContent() in lib/external-paper-search.ts split content on the first period (.) to separate title from description:
function buildStableKey(fromContent: string, toContent: string): string {
const fromTitle = fromContent.split(".")[0].trim();
const toTitle = toContent.split(".")[0].trim();
return `${fromTitle} → ${toTitle}`.trim();
}Card titles containing periods (e.g., "Dr. Smith's Intervention", "e.g. community health programs", "U.S. education policy") are truncated incorrectly:
- "Dr. Smith's Intervention" →
"Dr" - "e.g. community health" →
"e"
This affects:
- Cache keys: Truncated keys may collide or miss, though worst case is a cache miss (not incorrect results)
- LLM query extraction input:
parseContent()feeds truncated titles to Gemini 2.5 Flash, potentially degrading search query quality
Proposed Solution
- Use a more robust separator (e.g., the first sentence-ending period followed by a space and uppercase letter)
- Or pass title and description as separate fields from the caller instead of concatenating with period separator
- Or hash the full content for cache keys
Relevant Files
lib/external-paper-search.ts:60-75—buildStableKey()andparseContent()mastra/workflows/logic-model-with-evidence.ts:326-331— Caller that concatenatestitle. description
Context
Identified during review of PR #194.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request