Repository navigation
fix(retrieval): sanitize raw exception leakage in traverse_knowledge_graph_tool - #15647
gewenbo888 wants to merge 2 commits into
Conversation
Git-on-my-level
left a comment
There was a problem hiding this comment.
Thanks for this — the fix itself is correct and well-targeted. Verified each changed file:
backend/utils/retrieval/tools/graph_tools.py— dropping{exc}from the returned string is the right seam: raw Neo4j/driver exceptions (connection URIs, internal hostnames, credential-bearing strings) no longer flow into LLM tool-result context, whilelogger.exceptionkeeps the full server-side traceback. I also confirmed via repo code search that nothing consumes the oldError traversing knowledge graph: {exc}wording.backend/tests/unit/test_graph_tools_sanitization.py— genuinely hermetic (sanctionedtesting/import_isolation.pyprimitives, langchain stubbed). I ran it in a network-isolated stdlib-only sandbox: 2/2 pass, assertingsecret_password/Neo4j/bolt://stay out of the returned string..github/checks-manifest.yaml—graph-tools-sanitization-testsentry is additive, both lanes, triggers correct; follows the documented check-registration process.
One blocking item, and it's a PR-body edit rather than a code change:
Missing Failure-Class: declaration. The commit subject starts with fix:, and the failure-class-protocol check (runs on every PR, with the PR body) requires exactly one declaration line in the PR body. Running the repo's validator against this PR today reports missing_declaration:
python3 scripts/failure-class validate --base origin/main --head <head> --pr-body-file <body>
Your local --lane local run was green because that lane skips PR-body checks — this only surfaces in CI. Accepted forms (pick one, as a single line, no |):
Failure-Class: FC-<lower-kebab-slug>
Failure-Class: new
Failure-Class: none
Failure-Class: new also adds one .github/failure-classes/FC-<slug>.json definition (empty evidence_prs is fine — this PR is the evidence). bash scripts/pr-preflight --suggest prints paste-ready guidance.
Optional follow-up (separate PR, not here): search_memories_tool in backend/utils/retrieval/tools/memory_tools.py (~line 521) still returns Error performing memory search: {str(e)} — same leak class if you want to repeat the pattern there.
🤖 Automated review on behalf of the maintainers.
by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.
|
Added |
|
Knowledge-graph traversal on main still returns — Astar, on behalf of @aryanorastar |
|
Keeping this open. Not approving — Astar, on behalf of @aryanorastar |
62f4cbb to
bc01fdf
Compare
|
Updated on head
Ready for CI checks and re-review. Thanks! |
|
@Git-on-my-level: The Failure-Class declaration ( |
|
Follow-up review on the rebased head (bc01fdf): the earlier blocking item — the missing Re-verified each changed file on this head:
One merge-blocking item remains, and it's mechanical: the PR is currently reporting merge conflicts — Optional follow-up (separate PR, not here): 🤖 Automated review on behalf of the maintainers. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
Dismissing as resolved: the blocking item in this review (missing Failure-Class: declaration in the PR body) is fixed on the current head — the PR body now ends with 'Failure-Class: none'. The code fix and tests were re-verified on bc01fdf.
|
Closing. This is already on main via #19790. Not merged. |
|
Hey @gewenbo888 👋 Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request. After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:
Before your next PR, please skim:
If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing. Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out. Thank you for being part of the Omi community! |
Summary
This PR sanitizes the error return in
backend/utils/retrieval/tools/graph_tools.py(traverse_knowledge_graph_tool):Error traversing knowledge graphinstead of appending raw{exc}to the error string.logger.exceptionfor server-side diagnosis while protecting the LLM context from raw connection details, database errors, or stack traces.Testing
backend/tests/unit/test_graph_tools_sanitization.pyverifying exception sanitization and normal success flow.check_module_stub_pollution.py).python3 .github/scripts/run_checks.py --lane local --base origin/main.Failure-Class: none