-
Notifications
You must be signed in to change notification settings - Fork 2k
fix(context,compress-synthetic): conversation observations render with full content #974
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
f8a7138
6179573
5167e1e
877cc51
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -174,16 +174,67 @@ export function registerContextFunction( | |||||||||||||||||||||||||
| for (let j = 0; j < sessionsNeedingObs.length; j++) { | ||||||||||||||||||||||||||
| const i = sessionsNeedingObs[j]; | ||||||||||||||||||||||||||
| const observations = obsResults[j]; | ||||||||||||||||||||||||||
| // Tighten the filter: drop observations with empty narrative so | ||||||||||||||||||||||||||
| // they never reach the renderer and produce dangling-colon lines | ||||||||||||||||||||||||||
| // like `- [other] conversation: `. | ||||||||||||||||||||||||||
| const important = observations.filter( | ||||||||||||||||||||||||||
| (o) => o.title && o.importance >= 5, | ||||||||||||||||||||||||||
| (o) => | ||||||||||||||||||||||||||
| o.title && | ||||||||||||||||||||||||||
| o.importance >= 5 && | ||||||||||||||||||||||||||
| (o.narrative || "").trim().length > 0, | ||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||
|
Comment on lines
180
to
185
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win Fallback path is unreachable for title-less observations. Line 182 requires Proposed fix const important = observations.filter(
(o) =>
- o.title &&
o.importance >= 5 &&
(o.narrative || "").trim().length > 0,
);📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| if (important.length > 0) { | ||||||||||||||||||||||||||
| const top = important | ||||||||||||||||||||||||||
| .sort((a, b) => b.importance - a.importance) | ||||||||||||||||||||||||||
| .slice(0, 5); | ||||||||||||||||||||||||||
| // Defensive renderer: when the stored title is empty, equals the | ||||||||||||||||||||||||||
| // type, or is a generic tool name like "conversation", fall back | ||||||||||||||||||||||||||
| // to the subtitle (user message) as the title and use the | ||||||||||||||||||||||||||
| // narrative as the body. This handles observations stored before | ||||||||||||||||||||||||||
| // the inferType fix landed, where the synthetic compressor | ||||||||||||||||||||||||||
| // used the raw tool name as the title. Without this fallback | ||||||||||||||||||||||||||
| // those observations render as `- [other] conversation: ` with | ||||||||||||||||||||||||||
| // a dangling colon and no content. | ||||||||||||||||||||||||||
| const GENERIC_TITLES = new Set([ | ||||||||||||||||||||||||||
| "conversation", | ||||||||||||||||||||||||||
| "other", | ||||||||||||||||||||||||||
| "observation", | ||||||||||||||||||||||||||
| "tool", | ||||||||||||||||||||||||||
| ]); | ||||||||||||||||||||||||||
| const items = top | ||||||||||||||||||||||||||
| .map((o) => `- [${o.type}] ${o.title}: ${o.narrative}`) | ||||||||||||||||||||||||||
| .map((o) => { | ||||||||||||||||||||||||||
| const titleIsGeneric = | ||||||||||||||||||||||||||
| !o.title || | ||||||||||||||||||||||||||
| o.title === o.type || | ||||||||||||||||||||||||||
| GENERIC_TITLES.has(o.title); | ||||||||||||||||||||||||||
|
Comment on lines
+207
to
+210
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win Generic-title detection should normalize before set lookup.
Proposed fix-const titleIsGeneric =
- !o.title ||
- o.title === o.type ||
- GENERIC_TITLES.has(o.title);
+const normalizedTitle = (o.title || "").trim().toLowerCase();
+const titleIsGeneric =
+ !normalizedTitle ||
+ normalizedTitle === o.type ||
+ GENERIC_TITLES.has(normalizedTitle);📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
| const title = titleIsGeneric | ||||||||||||||||||||||||||
| ? o.subtitle | ||||||||||||||||||||||||||
| ? o.subtitle.slice(0, 80) | ||||||||||||||||||||||||||
| : o.narrative | ||||||||||||||||||||||||||
| ? o.narrative | ||||||||||||||||||||||||||
| .slice(0, 80) | ||||||||||||||||||||||||||
| .replace(/\|/g, " ") | ||||||||||||||||||||||||||
| .trim() | ||||||||||||||||||||||||||
| : o.type | ||||||||||||||||||||||||||
| : o.title; | ||||||||||||||||||||||||||
| // Avoid title/content duplication when the title was | ||||||||||||||||||||||||||
| // derived from the start of the narrative. | ||||||||||||||||||||||||||
| let narrative = o.narrative || o.subtitle || ""; | ||||||||||||||||||||||||||
| if ( | ||||||||||||||||||||||||||
| title && | ||||||||||||||||||||||||||
| narrative | ||||||||||||||||||||||||||
| .toLowerCase() | ||||||||||||||||||||||||||
| .startsWith(title.toLowerCase().slice(0, 40)) | ||||||||||||||||||||||||||
| ) { | ||||||||||||||||||||||||||
| narrative = narrative | ||||||||||||||||||||||||||
| .slice(title.length) | ||||||||||||||||||||||||||
| .replace(/^[\s|:,\-]+/, "") | ||||||||||||||||||||||||||
| .trim(); | ||||||||||||||||||||||||||
| if (!narrative) narrative = o.narrative || ""; | ||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||
| return `- [${o.type}] ${title}: ${narrative}`; | ||||||||||||||||||||||||||
| }) | ||||||||||||||||||||||||||
| .join("\n"); | ||||||||||||||||||||||||||
| const content = `## Session ${sessions[i].id.slice(0, 8)} (${sessions[i].startedAt})\n${items}`; | ||||||||||||||||||||||||||
| blocks.push({ | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major
🧩 Analysis chain
🏁 Script executed:
Repository: rohitg00/agentmemory
Length of output: 425
Hardcoded
iii-sdkversion in CLI overrides declared dependency.package.jsondeclaresiii-sdkas0.19.0, butsrc/cli.ts:2312-2322explicitly runsinstall iii-sdk@0.11.2. This forces a downgrade or conflict in runtime dependencies.Update the hardcoded version in
src/cli.tsto match the0.19.0specified inpackage.json.🤖 Prompt for AI Agents