Commit Graph

4 Commits

Author SHA1 Message Date
Christian Gick
f4bdae7a1e perf(MAT): cut bot reply latency — stream, skip redundant rewrite, non-blocking persist
Some checks failed
Build & Deploy / test (push) Failing after 1m10s
Build & Deploy / build-and-deploy (push) Has been skipped
Tests / test (push) Failing after 9s
Latency was dominated by the LLM call chain, not the 10-message context window.
Three fixes land together in the chat pipeline in bot.py:

1. Stream the main LLM call (new _stream_chat_completion helper) and
   progressively edit the Matrix message via m.replace. Suppress visible
   streaming during tool-calling iterations so the user never sees rolled-back
   text. Final send is an authoritative edit that guarantees the full reply.

2. Gate _rewrite_query behind a pronoun/deictic heuristic (EN/DE/FR). When a
   message has no references needing resolution we skip the extra Haiku
   round-trip entirely and feed the original message to RAG directly.

3. Fire-and-forget the post-reply memory + chunk persistence with asyncio
   background tasks so a slow extraction no longer blocks the next inbound
   message. 20s timeout preserved inside the bg task; exceptions logged.

Added unit test for the pronoun heuristic (EN/DE/FR positive + negative cases,
short/empty messages).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-15 18:48:48 +03:00
Christian Gick
7b5c157b12 fix(MAT-258): blacklist unverified E2EE devices + add CI tests
Some checks failed
Build & Deploy / test (push) Failing after 1m9s
Build & Deploy / build-and-deploy (push) Has been skipped
Tests / test (push) Failing after 8s
Unverified devices (lacking cross-signing) caused OlmUnverifiedDeviceError
in _send_text(), silently breaking all message delivery. Now on_sync()
blacklists non-cross-signed devices instead of skipping them, and
_send_text() catches E2EE errors gracefully.

Adds 12 unit tests for device trust policy and send error handling.
CI test job now gates deployment in deploy.yml.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-29 08:32:48 +03:00
Christian Gick
19b72dfe07 feat(MAT-174): LLM-based result filtering for cron search jobs
Brave Search results are passed through LiteLLM (claude-haiku) when
job config includes a `criteria` field. LLM returns indices of matching
results, filtering out noise before posting to Matrix.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 10:14:01 +02:00
Christian Gick
4d8ea44b3d feat(MAT-174): Add cron job scheduler and executors
Cron package that syncs jobs from matrixhost portal API, schedules execution
with timezone-aware timing, and posts results to Matrix rooms. Includes
Brave Search, reminder, and browser scrape (placeholder) executors with
formatter. 31 pytest tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-16 09:31:19 +02:00