Skip to content

Personal AI, On Personal Devices

Python

fix: add bot message filtering to Slack connector, add live smoke test

krypticmouse20d132ff4ab5
diff --git a/src/openjarvis/connectors/slack_connector.py b/src/openjarvis/connectors/slack_connector.py
index 68a2103b..7a318665 100644
--- a/src/openjarvis/connectors/slack_connector.py
+++ b/src/openjarvis/connectors/slack_connector.py
@@ -285,6 +285,16 @@ class SlackConnector(BaseConnector):
)
for msg in messages:
+ # Skip bot messages and non-content subtypes
+ if msg.get("bot_id") or msg.get("subtype") in (
+ "message_changed",
+ "message_deleted",
+ "bot_message",
+ "channel_join",
+ "channel_leave",
+ ):
+ continue
+
ts: str = msg.get("ts", "")
user_id: str = msg.get("user", "")
text: str = msg.get("text", "")
diff --git a/tests/connectors/test_live_smoke.py b/tests/connectors/test_live_smoke.py
new file mode 100644
index 00000000..a627bac4
--- /dev/null
+++ b/tests/connectors/test_live_smoke.py
@@ -0,0 +1,87 @@
+"""Live smoke test — full pipeline with real markdown files.
+
+NOT mocked. Uses the actual OpenJarvis docs/ directory as an Obsidian-like vault.
+Exercises: ObsidianConnector → SyncEngine → KnowledgeStore → knowledge_search tool.
+"""
+
+from __future__ import annotations
+
+import tempfile
+from pathlib import Path
+
+from openjarvis.connectors.obsidian import ObsidianConnector
+from openjarvis.connectors.pipeline import IngestionPipeline
+from openjarvis.connectors.store import KnowledgeStore
+from openjarvis.connectors.sync_engine import SyncEngine
+from openjarvis.tools.knowledge_search import KnowledgeSearchTool
+
+# Use the real OpenJarvis docs directory
+DOCS_DIR = Path(__file__).resolve().parents[2] / "docs"
+
+
+def test_live_obsidian_full_pipeline() -> None:
+ """Smoke test: index real .md files, then search them."""
+ assert DOCS_DIR.is_dir(), f"Docs dir not found: {DOCS_DIR}"
+
+ with tempfile.TemporaryDirectory() as tmp:
+ tmp_path = Path(tmp)
+
+ # 1. Set up the full pipeline
+ store = KnowledgeStore(db_path=str(tmp_path / "live.db"))
+ pipeline = IngestionPipeline(store=store, max_tokens=256)
+ engine = SyncEngine(
+ pipeline=pipeline,
+ state_db=str(tmp_path / "state.db"),
+ )
+ connector = ObsidianConnector(vault_path=str(DOCS_DIR))
+
+ # 2. Verify connection
+ assert connector.is_connected(), "Connector should see docs dir"
+
+ # 3. Sync — this reads real files
+ items = engine.sync(connector)
+ print(f"\n Synced {items} chunks from {DOCS_DIR}")
+ assert items > 0, "Should have indexed some chunks"
+
+ # 4. Verify checkpoint
+ cp = engine.get_checkpoint("obsidian")
+ assert cp is not None
+ assert cp["items_synced"] > 0
+ print(f" Checkpoint: {cp['items_synced']} items synced")
+
+ # 5. Search via knowledge_search tool
+ tool = KnowledgeSearchTool(store=store)
+
+ # Search for architecture concepts (should be in docs/)
+ result = tool.execute(query="agent")
+ assert result.success, f"Search failed: {result.content}"
+ assert result.metadata["num_results"] > 0
+ print(f" 'agent' query: {result.metadata['num_results']} results")
+
+ # Search for engine/inference
+ result = tool.execute(query="inference engine")
+ assert result.success
+ print(
+ f" 'inference engine' query: "
+ f"{result.metadata['num_results']} results"
+ )
+
+ # Search with source filter
+ result = tool.execute(query="agent", source="obsidian")
+ assert result.success
+ assert result.metadata["num_results"] > 0
+
+ # Search for nonexistent content
+ result = tool.execute(query="xyzzy999nonexistent")
+ assert result.success
+ assert "No relevant results" in result.content
+
+ # 6. Verify result quality — check that results have metadata
+ result = tool.execute(query="registry pattern")
+ if result.metadata["num_results"] > 0:
+ # Results should have source attribution
+ assert "[obsidian]" in result.content
+ print(f" 'registry pattern': found with attribution")
+
+ print(f"\n SMOKE TEST PASSED — {items} chunks indexed, "
+ f"search working end-to-end")