RunDownloadJob's onComplete handler was unconditionally firing EmbedFileJob.dispatch after every ZIM download, gated only by "is Ollama installed?". The rag.defaultIngestPolicy KV setting was never consulted, so users who explicitly set Auto-index to Manual still got every newly-downloaded ZIM auto-embedded. RagService.scanAndSync already handles Manual correctly by recording pending_decision rows instead of dispatching (rag_service.ts:1587-1638 via decideScanAction). The post-download path skipped that gate. Mirror the same check at the dispatch site: read the policy KV; if Manual, firstOrCreate a pending_decision row in kb_ingest_state so the per-file Index affordance from PR #909 surfaces the file the same way scan-time-discovered Manual files do. firstOrCreate (not create) so a re-download doesn't demote an existing indexed/failed row — the user can explicitly re-index from the KB panel if they want fresh content. Verified on NOMAD3: with rag.defaultIngestPolicy='Manual', every ZIM downloaded today via Content Explorer (agriculture-essential + computing-essential, ~62 MB across 7 files) wrote kb_ingest_state rows with state='indexed' instead of pending_decision. Real bug, not a hot-patch artifact. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| controllers | ||
| exceptions | ||
| jobs | ||
| middleware | ||
| models | ||
| services | ||
| utils | ||
| validators | ||