Repository navigation
SCA-261: tighten knowledge graph read budget - #10902
Merged
Git-on-my-level merged 3 commits intoJul 30, 2026
Merged
Conversation
Reduce the deterministic knowledge-graph snapshot to 500 nodes, 1000 edges, and 500 canonical assertions after the previous higher caps continued to hit the 30-second GET ceiling. Expose returned counts and lock the behavior with empty, small, and 20k-document route fixtures. Failure-Class: new Co-authored-by: multica-agent <[email protected]>
Record the aggregate request-budget contract and its large-fixture prevention artifact for the recurring Firestore list-read timeout class. Co-authored-by: multica-agent <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 92222dc2b3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Preview deployment for your docs. Learn more about Mintlify Previews.
💡 Tip: Enable Workflows to automatically generate PRs for you. |
Use the ID returned by node upserts when wiring extraction edges so a legacy node outside the bounded snapshot cannot leave a dangling provisional reference. Add a regression for the capped lookup path. Failure-Class: none Co-authored-by: multica-agent <[email protected]>
This was referenced Aug 9, 2026
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
Tighten
GET /v1/knowledge-graphto a deterministic snapshot of at most 500 nodes, 1,000 edges, and 500 canonical assertions, and expose additive returned-count metadata.Multica: SCA-261
Root cause
TimeoutMiddlewareappliesHTTP_GET_TIMEOUTand returns a bare 504 when the request exceeds the production 30-second GET budget. The deployed commit already contains #10750's original 2,000-node / 5,000-edge caps, but production heavy-tail requests still pin that ceiling. Including the canonical assertion and privacy-fence reads, that path could consume roughly 11,500 Firestore documents before serialization.The prior cap was therefore bounded in name but still too large for the request budget. Raising
HTTP_GET_TIMEOUTwould retain the excessive read and worker cost, so this PR does not change any timeout.Fix
nodesandedgesarrays and existing truncation/limit fields.node_countandedge_countfields describing the records returned in the bounded snapshot.Product invariants affected
Failure-Class
Failure-Class: new
Guard artifact: the 20,000-node / 20,000-edge behavioral fixture fails if the production loader omits its Firestore cap or deterministic ordering, while the HTTP-level regression verifies the additive response and unchanged Firebase dependency.
Verification
backend/.venv/bin/python -m pytest -q backend/tests/unit/test_bounded_firestore_list_reads.py backend/tests/unit/test_memory_graph_assertion_read.py backend/tests/unit/test_knowledge_graph_canonical_mutation_routes.py backend/tests/unit/test_timeout_middleware.py backend/tests/unit/test_http_timeout_defaults.py— 47 passed.backend/.venv/bin/pyright --pythonpath backend/.venv/bin/python backend/database/knowledge_graph.py backend/routers/knowledge_graph.py— 0 errors.OMI_PR_BODY_FILE=pr-body.md make preflight— 27 checks passed.The repository
backend/test.shwrapper executed all focused assertions successfully, but its Mac CPU-time ratchet rejected an unchanged 5,000-item action-items fixture at 0.17–0.19s (limit 0.12s). The same files pass under focused pytest; this PR does not alter action-items policy.Operational notes