Skip to content

Integrate #923 + #924 + #925: embeddings layer, Hive Mode, Agent OS Shell - #932

Merged
AmitoVrito merged 21 commits into
mainfrom
integration/v2.1-embeddings-hive-shell
Aug 12, 2026
Merged

AmitoVrito merged 21 commits into
mainfrom
integration/v2.1-embeddings-hive-shell

Conversation

@AmitoVrito

Copy link
Copy Markdown
Collaborator

Batches three completed, independently-reviewed feature PRs into main. They touch the same shared files (CHANGELOG.md, live/instrument.py), so they're integrated here with conflicts resolved once, rather than merged serially.

Included

Each carries commits co-authored by @DhruvGarg111.

Also included in this batch (found & fixed during review)

Verification

  • ruff check src/ tests/ + ruff format --check clean; check_async_blocking.py clean.
  • Affected suites green locally (embeddings/hive/shell/live/rerankers: 131 passed).
  • All three source PRs were individually green before integration.

Merging this closes #923, #924, #925 (their commits land in main).

DhruvGarg111 and others added 21 commits August 9, 2026 19:10
Introduce a uniform async embeddings contract (BaseEmbeddings) with
embed/embed_one/embed_batch, static per-provider dimensions, and
L2-normalized output, plus 9 hosted providers: OpenAI, Cohere
(input-type aware), Voyage, Jina (task LoRA), Gemini, Mistral, Nomic,
mixedbread, and Hugging Face (Inference API / TEI). OpenAI-compatible
providers share an HTTPEmbeddings transport. SynapsekitEmbeddings now
subclasses BaseEmbeddings with no behavior change.
Introduce a shared Reranker abstract base (async retrieve /
retrieve_with_scores over a wrapped Retriever) and three hosted
rerankers: Voyage rerank-2, Jina reranker-v2, and mixedbread
mxbai-rerank. CohereReranker and CrossEncoderReranker now subclass
Reranker with unchanged constructors and behavior.
Register all 9 hosted embeddings providers in the top-level lazy import
map and the embeddings/retrieval __init__ exports; eager-export the new
rerankers. Add voyage/jina/nomic/mixedbread extras, extend gemini and
huggingface extras for the embeddings SDKs, add httpx to the all extra,
and cover the new modules in mypy overrides and deptry ignores.
Add a generic contract suite (dimensions, lazy import errors, missing
key ValueErrors) and per-provider respx HTTP-contract tests for
OpenAI, Cohere, Voyage, Jina, Gemini, Mistral, Nomic, mixedbread, and
Hugging Face, plus request/reorder/empty/missing-key tests for the
Voyage/Jina/mixedbread rerankers and the Reranker ABC. No live keys or
network access.
…rface)

`client.models.embed_content` is synchronous in google-genai; awaiting it
raises TypeError against the real API. Use `client.aio.models.embed_content`,
matching the async surface used everywhere else in the repo. The provider
test previously made the sync method awaitable with AsyncMock, hiding the
bug; replace it with a hand-written async fake (no mock) that asserts the
`.aio` surface and the coroutine contract.

Fixes #926

Co-authored-by: Dhruv Garg <[email protected]>
Two correctness fixes in the Hive aggregator:

- SQLiteHiveStore shares one connection across the worker threads that
  asyncio.to_thread dispatches store calls onto. sqlite3 is not thread-safe
  for concurrent use of a single connection, so guard every access with a
  threading.RLock (fixes a data race under concurrent submit/suggestions).
- suggestions() computed contributor_count as len(values), counting
  observations rather than distinct contributors; a single contributor can
  submit multiple envelopes per day, inflating the count and the derived
  confidence. Track distinct contributor_ids per pattern key instead.

Adds regression tests for both (concurrent to_thread writes; one contributor
submitting the same pattern twice).

Fixes #927
Fixes #928

Co-authored-by: Dhruv Garg <[email protected]>
Two correctness fixes in the Agent OS Shell:

- DirectShellExecutor used Process.communicate(), which buffers the child's
  entire stdout/stderr into memory before max_output_bytes is applied, so an
  unbounded producer (cat /dev/zero, yes) could exhaust RAM, and a pipeline
  (yes | head -1) would hang because the producer never receives SIGPIPE.
  Replace it with a streaming _drain() that reads under a hard byte cap and
  kills the child at the cap; a capped producer still feeds the next stage.
- The lexer's _looks_like_natural_language treated any quoted span beginning
  with a cue word (find/run/search/...) as natural language regardless of
  position, so `git commit -m "find and fix the bug"` and
  `grep "search term" file` silently dropped the quoted argument. Gate the
  cue-word and bare-phrase heuristics on the quote opening a command; keep
  only the explicit nl:/ask: sentinels unconditional.

Adds regression tests for both (bounded output + non-hanging pipeline;
cue-word quoted args staying shell tokens).

Fixes #929
Fixes #930

Co-authored-by: Dhruv Garg <[email protected]>
… Live

The new embeddings/reranker provider layer (#886) published nothing to the
Live EventBus, so embedding and rerank activity was invisible in the glass-box
dashboard. Auto-instrument the layer the same way every other subsystem is
wired: patch BaseEmbeddings.embed (covering all 9 providers and future
subclasses) to publish `embeddings.embed`, and the Reranker hierarchy's
retrieve/retrieve_with_scores to publish `rerank`, with provider/count attrs.
Async contract preserved; no-op when Live is off. Adds a no-mock test with a
real BaseEmbeddings subclass and a real Reranker over an in-memory retriever,
covering the coroutine contract and the error path. Also records the layer and
the Gemini async fix in the changelog.

Co-authored-by: Dhruv Garg <[email protected]>
Hive Mode (#748) published nothing to the Live EventBus, leaving pooled-memory
activity invisible in the glass-box dashboard. Auto-instrument HiveClient the
same way every other subsystem is wired: contribute/withdraw/suggestions_for
publish hive.contribute / hive.withdraw / hive.suggestions events (with scope).
Async contract preserved; no-op when Live is off. Adds a no-mock test driving a
real HiveClient over a real in-process aggregator + SQLite store. Records the
feature and both Hive bug fixes in the changelog.

Co-authored-by: Dhruv Garg <[email protected]>
The Agent OS Shell (#750) published nothing to the Live EventBus, so shell
plans and executions were invisible in the glass-box dashboard. Auto-instrument
ShellSession the same way every other subsystem is wired: plan and run publish
shell.plan / shell.run events (with the input). Async contract preserved; no-op
when Live is off. Adds a no-mock test running a real ShellSession over a real
subprocess. Records the feature and both shell bug fixes in the changelog.

Co-authored-by: Dhruv Garg <[email protected]>
Adds the HTTP-boundary coverage the transport layer was missing (no mocks):
- create_hive_app via Starlette TestClient — routes, bearer auth (401/403),
  query params, and JSON round-trips against a real aggregator.
- HttpHiveTransport (stdlib urllib, so respx can't intercept it) driven against
  a real localhost http.server on an ephemeral port — real submit/suggestions/
  withdraw/transparency round-trip over TCP, asserting the bearer header and
  the _quote'd query string cross the socket.

The round-trip test surfaced a real bug: SQLiteHiveStore.revoke() updates the
`revoked` column, but list() rebuilt envelopes from the stored JSON blob (still
`revoked: false`) and ignored the column, so transparency() reported
withdrawn=false even after a withdrawal. list() now overlays the column onto
the reconstructed envelope.

Fixes #931

Co-authored-by: Dhruv Garg <[email protected]>
# Conflicts:
#	CHANGELOG.md
# Conflicts:
#	CHANGELOG.md
#	src/synapsekit/live/instrument.py
@AmitoVrito
AmitoVrito merged commit e72cf2a into main Aug 12, 2026
23 checks passed
@AmitoVrito
AmitoVrito deleted the integration/v2.1-embeddings-hive-shell branch August 12, 2026 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(embeddings): GeminiEmbeddings awaits a synchronous google-genai call (TypeError at runtime)

2 participants