Skip to content

fix(gbrain): cap fallback enrichment graph size (BLO-21635) - #1251

Closed
kkroo wants to merge 1 commit into
masterfrom
codex/blo-21635-gbrain-enrichment-cap-successor
Closed

fix(gbrain): cap fallback enrichment graph size (BLO-21635)#1251
kkroo wants to merge 1 commit into
masterfrom
codex/blo-21635-gbrain-enrichment-cap-successor

Conversation

@kkroo

@kkroo kkroo commented Aug 10, 2026

Copy link
Copy Markdown

Supersedes #1070, whose mixed history is rejected by the App-attributed-commit policy.

Reapplies the same final two-file gbrain fallback cap onto current master as one kkroo-authored commit. pnpm-lock.yaml is unchanged.

Validation:

The full local gbrain suite had one pre-existing recall-pack decompression test timeout; the changed recall.test.ts suite passed. GitHub CI remains the merge signal.

@allyblockcast

allyblockcast Bot commented Aug 10, 2026

Copy link
Copy Markdown

🔗 Paperclip issue: BLO-21635

1 similar comment
@allyblockcast

allyblockcast Bot commented Aug 10, 2026

Copy link
Copy Markdown

🔗 Paperclip issue: BLO-21635

@allyblockcast

allyblockcast Bot commented Aug 10, 2026

Copy link
Copy Markdown

Hey @kkroo! 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

Co-Authored-By: Paperclip <noreply@paperclip.ing>
@kkroo
kkroo force-pushed the codex/blo-21635-gbrain-enrichment-cap-successor branch from 2c3dc28 to cf739a2 Compare August 10, 2026 11:29
@allyblockcast

allyblockcast Bot commented Aug 10, 2026

Copy link
Copy Markdown

Hey @kkroo! 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 Sep 2, 2026

Copy link
Copy Markdown
Author

Closing as superseded: this exact change is already on master.

Commit a73d8500fix(gbrain): cap agent/project fallback enrichment graph size (BLO-21635), landed 2026-08-06, i.e. four days before this PR was opened — carries the identical cap in packages/plugins/paperclip-plugin-gbrain/src/recall.ts:

// BLO-21635: the fallback candidates are agent/project hub nodes, which can be
// linked to thousands of unrelated fact-* nodes (observed up to ~23k, ~5.8MB
// decoded JSON, on a single "ok" recall). The issue traversal is scoped and
// safe to attach whole; the hub fallback is not, so cap only the fallback's
// contribution before merging rather than letting it dominate the cached
// graph. This bounds payload size regardless of how big the server-side hub
// neighborhood is.
export const MAX_ENRICHMENT_NODES = 50;
export const MAX_ENRICHMENT_EDGES = 100;
export const MAX_ENRICHMENT_SERIALIZED_BYTES = 64 * 1024;

function mergeGraphs(primary: unknown | null, fallback: unknown): unknown {
  const cappedFallback = capEnrichmentGraph(fallback);
  ...

…along with capEnrichmentGraph, capNodesArray, nodeRank, nodeSlug, edgeWithinSlugs, capArrayBySerializedBytes, capGraphRecord, and serializedBytes — and all four cap tests in src/__tests__/recall.test.ts (caps an oversized agent-hub fallback (array shape)…, …(nodes/edges shape)…, normalizes and caps an oversized edges-only fallback graph, drops auxiliary fallback collections and caps dense kept-node edges).

Verification against origin/master @ 3c59d88d:

$ git diff origin/master codex/blo-21635-gbrain-enrichment-cap-successor \
    -- packages/plugins/paperclip-plugin-gbrain/src/__tests__/recall.test.ts
(no output — test file is byte-identical)

$ git diff origin/master codex/blo-21635-gbrain-enrichment-cap-successor \
    -- packages/plugins/paperclip-plugin-gbrain/src/recall.ts | grep '^+' | grep -v '^+++'
+    return { ok: false, issuePageSlug: slug, graph: null, reason: `traverse_graph failed: ${msg}` };
+    const status = input.result.issuePageSlug ? "error" : "skipped";

The only two lines this branch would contribute are the pre-BLO-23403 forms of those statements — i.e. master is strictly ahead here, having since added the no-oauth-client reason-kind handling on top of the cap. This branch has nothing left to add.

Note: this closes the PR only. It was not verified whether BLO-21635 is fully resolved in production — only that the code and tests this branch proposed are already merged.

@kkroo kkroo closed this Sep 2, 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