Skip to content

fix(crawler): warn when COSIFT_CRAWL_EMBED_CONCURRENCY can starve /search#34

Open
TeoSlayer wants to merge 2 commits into
mainfrom
fix/warn-high-crawl-embed-concurrency
Open

fix(crawler): warn when COSIFT_CRAWL_EMBED_CONCURRENCY can starve /search#34
TeoSlayer wants to merge 2 commits into
mainfrom
fix/warn-high-crawl-embed-concurrency

Conversation

@TeoSlayer

Copy link
Copy Markdown
Contributor

The crawler embedder is throttled (default cap 8) so bulk-crawl embeds can't starve interactive /search. The COSIFT_CRAWL_EMBED_CONCURRENCY override accepted any positive value with no guard, so setting it well above the safe range silently defeats that protection.

In production this bit us: the var had drifted to 256 (a backfill leftover), which dropped /search from ~2s to >60s — the crawler's concurrent embed→insert load starved search traversal on the HNSW graph. It was a deep debug precisely because nothing flagged the misconfiguration.

This adds a single startup WARNING when the cap exceeds a safe ceiling (OLLAMA_NUM_PARALLEL when set, else 4× the default). It does not clamp — an operator on a large box may legitimately want more; they just get told.

No behavior change, no docs.

🤖 Generated with Claude Code

…arch

The crawler embedder is throttled (default cap 8) so bulk-crawl embeds can't starve interactive /search. The COSIFT_CRAWL_EMBED_CONCURRENCY override accepted any value with no guard, so setting it far above the safe range silently defeats that protection — in prod a stale value of 256 dropped /search from ~2s to >60s. Emit a loud startup WARNING when the cap exceeds a safe ceiling (OLLAMA_NUM_PARALLEL when set, else 4x the default). No clamp: the operator keeps control.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@codecov

codecov Bot commented Jul 22, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 44.44444% with 20 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
internal/index/hnsw_writer.go 57.14% 8 Missing and 4 partials ⚠️
cmd/cosift/serve_setup.go 0.00% 8 Missing ⚠️

📢 Thoughts on this report? Let us know!

…md units (#36)

internal/index/hnsw_writer.go implements PassageWriter against a Pebble
store + in-memory HNSW graph, with periodic checkpointing and a manual
Flush for shutdown. Covered by hnsw_writer_test.go (bridges passages into
the graph, and verifies the auto-flush-at-threshold contract). Not yet
wired into cmd_crawl/cmd_serve — those already use their own
hnswPassageWriter in cmd/cosift; this is an alternate, independently
tested implementation living in internal/index for review.

Also adds the systemd unit/timer files used to run cosift-crawl,
cosift-serve, cosift-snapshot, and the ollama service(s) in production.
No secrets included — cosift-snapshot.service loads its admin token via
EnvironmentFile from /etc/cosift/snapshot.env, not inline.

Co-authored-by: Teodor Calin <teodor@vulturelabs.io>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
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.

2 participants