-
Notifications
You must be signed in to change notification settings - Fork 2.4k
fix(pipeline): classify telemetry observations and extract semantic fields for non-tool events #1308
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?
fix(pipeline): classify telemetry observations and extract semantic fields for non-tool events #1308
Changes from all commits
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 |
|---|---|---|
|
|
@@ -50,6 +50,30 @@ function getChunkConcurrency(): number { | |
| return Number.isFinite(n) && n > 0 ? n : CHUNK_CONCURRENCY_DEFAULT; | ||
| } | ||
|
|
||
| export function filterObservationsForSummary( | ||
| observations: CompressedObservation[], | ||
| ): CompressedObservation[] { | ||
| const out: CompressedObservation[] = []; | ||
| for (const o of observations) { | ||
| if (o.isTelemetry === true) continue; | ||
| const anyO = o as unknown as Record<string, unknown>; | ||
| const hasTitle = typeof o.title === "string" && o.title.trim().length > 0; | ||
| const hasNarrative = typeof o.narrative === "string" && o.narrative.trim().length > 0; | ||
| const hasFacts = Array.isArray(o.facts) && o.facts.length > 0; | ||
| const hasFiles = Array.isArray(o.files) && o.files.length > 0; | ||
| const hasToolInput = anyO["toolInput"] !== undefined && anyO["toolInput"] !== null && String(anyO["toolInput"]).trim().length > 0; | ||
| const hasToolOutput = anyO["toolOutput"] !== undefined && anyO["toolOutput"] !== null && String(anyO["toolOutput"]).trim().length > 0; | ||
| const hasUserPrompt = typeof anyO["userPrompt"] === "string" && (anyO["userPrompt"] as string).trim().length > 0; | ||
| const hasContent = typeof anyO["content"] === "string" && (anyO["content"] as string).trim().length > 0; | ||
| const hasSubtitle = typeof anyO["subtitle"] === "string" && (anyO["subtitle"] as string).trim().length > 0; | ||
|
Comment on lines
+62
to
+68
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 Align summary eligibility with rendered content. A valid subtitle-only observation passes the filter but renders as an empty header because
📍 Affects 2 files
🤖 Prompt for AI Agents |
||
| if (!hasTitle && !hasNarrative && !hasFacts && !hasFiles && !hasToolInput && !hasToolOutput && !hasUserPrompt && !hasContent && !hasSubtitle) { | ||
| continue; | ||
| } | ||
| out.push(o); | ||
| } | ||
| return out; | ||
| } | ||
|
|
||
| // One chunk call with retry-once. Returns null when both attempts fail — | ||
| // whether by parse failure, provider 4xx (content rejected by upstream | ||
| // filters), or transient network/5xx errors that didn't recover on retry. | ||
|
|
@@ -251,7 +275,7 @@ export function registerSummarizeFunction( | |
| const observations = await kv.list<CompressedObservation>( | ||
| KV.observations(sessionId), | ||
| ); | ||
| const compressed = observations.filter((o) => o.title); | ||
| const compressed = filterObservationsForSummary(observations); | ||
|
|
||
| if (compressed.length === 0) { | ||
| logger.info("No observations to summarize", { | ||
|
|
||
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 | 🟡 Minor | ⚡ Quick win
Use the normalized command arguments.
Line 611 computes bounded serialized arguments, but Line 614 sends the original value. If
props.argumentsis an object,src/functions/observe.tsstoresString(args)as"[object Object]". This loses the command input before synthetic compression builds its narrative.Proposed fix
Also applies to: 614-614
🤖 Prompt for AI Agents