Skip to content

fix(gbrain): cap agent/project fallback enrichment graph size (BLO-21635) - #1068

Closed
allyblockcast[bot] wants to merge 1 commit into
masterfrom
sre/blo-21635-gbrain-enrichment-cap
Closed

fix(gbrain): cap agent/project fallback enrichment graph size (BLO-21635)#1068
allyblockcast[bot] wants to merge 1 commit into
masterfrom
sre/blo-21635-gbrain-enrichment-cap

Conversation

@allyblockcast

@allyblockcast allyblockcast Bot commented Aug 6, 2026

Copy link
Copy Markdown

Summary

  • The gbrain-context recall prefetch (packages/plugins/paperclip-plugin-gbrain/src/recall.ts) falls back to the agent's or project's hub node when the issue-scoped traverse_graph comes back empty or a single-node island.
  • That hub node can be linked to thousands of unrelated fact-* nodes — BLO-21635 §A found ~96% of ok recalls carrying a median ~22,636 nodes / ~850KB stored (pg_column_size) / ~5.8MB decoded JSON, almost entirely unrelated fact-* nodes from the untargeted hub dump — roughly 6.6GB/week of decoded graph pushed through recall.
  • mergeGraphs() now caps the fallback's contribution to MAX_ENRICHMENT_NODES (50) before merging into the cached recall, preferring nodes structurally closest to the hub (lowest traversal depth) 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 test in packages/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.
  • Post-merge: re-run BLO-21635's §A verifying-signal query (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

…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>
@allyblockcast

allyblockcast Bot commented Aug 6, 2026

Copy link
Copy Markdown
Author

🔗 Paperclip issue: BLO-21635

1 similar comment
@allyblockcast

allyblockcast Bot commented Aug 6, 2026

Copy link
Copy Markdown
Author

🔗 Paperclip issue: BLO-21635

@allyblockcast

allyblockcast Bot commented Aug 6, 2026

Copy link
Copy Markdown
Author

Hey @allyblockcast[bot]! Before this PR can be reviewed, a few things need attention:

Missing or incomplete:

  • Missing section: ## Thinking Path
  • Missing section: ## What Changed
  • Missing section: ## Verification
  • Missing section: ## Risks
  • Missing section: ## Model Used
  • Add the dedup-search checkbox to your PR description and check it once you have searched the GitHub PR list for similar PRs. See the PR template at .github/PULL_REQUEST_TEMPLATE.md and CONTRIBUTING.md → "Before You Start: Search First".

Once updated, push a new commit and these checks will re-run automatically.

— commitperclip

@kkroo

kkroo commented Aug 6, 2026

Copy link
Copy Markdown

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.

@kkroo kkroo closed this Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant