From e1e2364ac5a57dde91c4f439ca406787f18bba7b Mon Sep 17 00:00:00 2001 From: livdebus Date: Mon, 16 Nov 2026 15:21:07 +0100 Subject: [PATCH] Fix disappearing SMB documents: disable pruning with prune_freq=0 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Root cause (verified on a live Onyx 5.0.3 instance): pruning a File connector whose connector_specific_config.file_locations is empty deletes every document the connector holds — the prune reconciles the index against the connector's "source" (no files) and removes everything, including the documents we push via the ingestion API. We created the connector with prune_freq=None to keep pruning off, but Onyx's update_connector() rewrites a None prune_freq to DEFAULT_PRUNING_FREQ (7 days). So any later update to the connector silently enabled weekly pruning, which wiped the SMB documents after ~1-2 weeks ("disappearing after ~14 days"). Send prune_freq=0 instead: pruning is skipped while prune_freq is falsy, and 0 (unlike None) survives update_connector() — it is never replaced by the 7-day default. Verified live: a prune deletes the docs (1->0) while a re-index does not; prune_freq=0 is stored as 0 and keeps pruning off. --- app/onyx_client.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/app/onyx_client.py b/app/onyx_client.py index 356d7ed..9d15854 100644 --- a/app/onyx_client.py +++ b/app/onyx_client.py @@ -185,7 +185,16 @@ class OnyxClient: "file_locations": [] }, "refresh_freq": None, - "prune_freq": None, + # prune_freq MUST be 0, not None. Pruning a File connector whose + # file_locations is empty removes every document the connector holds + # (its "source" has no files) — including the ones we push via the + # ingestion API, which is why SMB documents vanished after ~1-2 weeks. + # Onyx skips pruning only when prune_freq is falsy; 0 satisfies that. + # None is NOT safe: update_connector() rewrites a None prune_freq to + # DEFAULT_PRUNING_FREQ (7 days), so any later connector update would + # silently re-enable weekly pruning. 0 survives updates (0 is not + # None) and keeps pruning off for good. + "prune_freq": 0, "indexing_start": None, "access_type": "private" if groups else "public", "groups": groups,