fix(gbrain): cap agent/project fallback enrichment graph size (BLO-21635) - #1068
Closed
allyblockcast[bot] wants to merge 1 commit into
Closed
fix(gbrain): cap agent/project fallback enrichment graph size (BLO-21635)#1068allyblockcast[bot] wants to merge 1 commit into
allyblockcast[bot] wants to merge 1 commit into
Conversation
…635) The gbrain-context recall prefetch falls back to the agent's or project's hub node when the issue-scoped traversal comes back thin (empty or a single-node island). That hub node can be linked to thousands of unrelated fact-* nodes — observed up to ~23,000 nodes / ~5.8MB decoded JSON on a single "ok" recall, ~96% of ok recalls affected. Cap the fallback graph's contribution to MAX_ENRICHMENT_NODES (50) nodes before merging, preferring nodes structurally closest to the hub (lowest traversal depth) when available, and drop edges that would dangle to trimmed nodes. The issue-scoped traversal is left untouched since it's already relevance-scoped and safe to attach whole. https://paperclip.blockcast.net/BLO/issues/BLO-21635 Co-Authored-By: Paperclip <noreply@paperclip.ing>
Author
|
🔗 Paperclip issue: BLO-21635 |
1 similar comment
Author
|
🔗 Paperclip issue: BLO-21635 |
Author
|
Hey @allyblockcast[bot]! Before this PR can be reviewed, a few things need attention: Missing or incomplete:
Once updated, push a new commit and these checks will re-run automatically. — commitperclip |
13 tasks
|
Superseded by #1070, which carries the same BLO-21635 head with a compliant PR template and is opened from a human-authored branch so Ally can review it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
packages/plugins/paperclip-plugin-gbrain/src/recall.ts) falls back to the agent's or project's hub node when the issue-scopedtraverse_graphcomes back empty or a single-node island.fact-*nodes — BLO-21635 §A found ~96% ofokrecalls carrying a median ~22,636 nodes / ~850KB stored (pg_column_size) / ~5.8MB decoded JSON, almost entirely unrelatedfact-*nodes from the untargeted hub dump — roughly 6.6GB/week of decoded graph pushed through recall.mergeGraphs()now caps the fallback's contribution toMAX_ENRICHMENT_NODES(50) before merging into the cached recall, preferring nodes structurally closest to the hub (lowest traversaldepth) when available, and drops edges that would dangle to trimmed nodes. The issue-scoped traversal is untouched — it's already relevance-scoped and safe to attach whole.Test plan
pnpm testinpackages/plugins/paperclip-plugin-gbrain— 99/99 passing, including 2 new tests covering the array-shape and nodes/edges-shape oversized-fallback cases (existing small-fallback tests are unaffected since capping is a no-op under the limit).pnpm typecheck— clean.select pg_column_size(value_json), value_json->>'note' ... status='ok') over a fresh window and confirm median node count / stored size drop materially from the ~22,636 / ~850KB baseline.https://paperclip.blockcast.net/BLO/issues/BLO-21635