feat: kg#780
Conversation
| verify_ssl=self.connection.verify_ssl, | ||
| timeout=self.connection.timeout, | ||
| ) | ||
| return Neo4jGraphStore(connection=self.connection, client=client, database=self.database) |
There was a problem hiding this comment.
Bypasses ConnectionManager for graph client
Medium Severity
KnowledgeGraph builds its graph store with self.connection.connect() instead of the shared client from ConnectionManager via ConnectionNode. That skips pooling/reuse, can open extra Neo4j drivers for the same connection, and never gets ensure_client() reconnection during run().
Triggered by project rule: Bugbot Rules for Dynamiq
Reviewed by Cursor Bugbot for commit 83dea14. Configure here.
| raise NotImplementedError( | ||
| f"{type(self).__name__}: write is not supported for backend " | ||
| f"{type(self._graph_store).__name__}. Only Neo4j currently implements write_graph." | ||
| ) |
There was a problem hiding this comment.
Uninitialized store misreported as unsupported
Medium Severity
When _graph_store is still None (e.g. init_components was not run), execute raises NotImplementedError naming NoneType as an unsupported backend instead of indicating the graph store was never initialized.
Reviewed by Cursor Bugbot for commit 83dea14. Configure here.
| "keys": [], | ||
| } | ||
|
|
||
| result = self._graph_store.write_graph(nodes=nodes, relationships=relationships, database=self.database) |
There was a problem hiding this comment.
Neo4j writer missing store guard
Medium Severity
Neo4jGraphWriter.execute calls self._graph_store.write_graph without verifying _graph_store was created in init_components, so a direct or misconfigured run can raise AttributeError instead of a controlled error.
Reviewed by Cursor Bugbot for commit 83dea14. Configure here.
| continue | ||
| existing = self._existing_nodes(label) | ||
| if any(ex_id == new_id for ex_id, _ in existing): | ||
| continue # same id already in graph -> write_graph MERGE handles it |
There was a problem hiding this comment.
Graph id type mismatch skips dedup
Medium Severity
Duplicate resolution compares existing graph id values to extracted string ids with == without normalizing types, so the same logical id can fail the “already in graph” check and trigger redundant trigram linking or duplicate nodes.
Reviewed by Cursor Bugbot for commit 83dea14. Configure here.
| relationship_types: list[str] | None = None | ||
| ontology: Ontology | None = None | ||
| response_format: dict[str, Any] | None = None | ||
| input_schema: ClassVar[type[EntityExtractorInputSchema]] = EntityExtractorInputSchema |
There was a problem hiding this comment.
Missing YAML roundtrip tests
Medium Severity
New nodes EntityExtractor, KnowledgeGraph, and Neo4jGraphWriter (nested llm and connection serialization) ship without workflow YAML serialize/deserialize roundtrip coverage required for this project.
Additional Locations (2)
Triggered by project rule: Bugbot Rules for Dynamiq
Reviewed by Cursor Bugbot for commit 83dea14. Configure here.
Coverage Report •
|
|||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 6 total unresolved issues (including 5 from previous reviews).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 3148884. Configure here.
| if rel["start_identity"] in id_remap: | ||
| rel["start_identity"] = id_remap[rel["start_identity"]] | ||
| if rel["end_identity"] in id_remap: | ||
| rel["end_identity"] = id_remap[rel["end_identity"]] |
There was a problem hiding this comment.
Attribute IDs not remapped
Medium Severity
When resolve_duplicates remaps an extracted entity id onto an existing graph node, only exact id matches in id_remap are updated. AttributeValue node ids and relationship identities use the {entity_id}::{attr_key} form, so they keep the old entity prefix while HAS_ATTRIBUTE starts point at the canonical id, leaving mismatched attribute nodes and duplicate attribute values on re-ingestion.
Reviewed by Cursor Bugbot for commit 3148884. Configure here.


Note
Medium Risk
New ingestion path writes to Neo4j with LLM output and heuristic entity linking; edge-only ACL metadata and ontology filtering reduce leak risk but wrong merges or bad extractions could still pollute the graph.
Overview
Adds LLM-driven knowledge graph ingestion to Dynamiq: documents can be turned into Neo4j-ready node/relationship payloads and upserted in workflows alongside vector stores.
EntityExtractorruns extraction per document and emits shapes compatible withNeo4jGraphStore.write_graph. OptionalOntology/Tripleschemas constrain the LLM in the prompt and hard-filter results; ontology attributes becomeHAS_ATTRIBUTE→AttributeValueedges instead of node properties. Document metadata and provenance are applied only on relationship properties (entities stay identity-only).KnowledgeGraphWritersubclasses the extractor to add optional trigram-based entity resolution against the live graph, thenwrite_graph(Neo4j today; other backends error until implemented).Neo4jGraphWriteris a separate thin writer for pre-built payloads.New GraphRAG examples (
kg_ingestion.py,kg_question_answering.py) wire parallel Qdrant + Neo4j ingestion and an agent with vector search +CypherExecutor. Unit tests cover sanitization, JSON parsing, and stub-LLM execution paths.Reviewed by Cursor Bugbot for commit 3148884. Bugbot is set up for automated code reviews on this repo. Configure here.