SMB connector: fix stuck 'Initial Indexing', configurable name prefix + timeout
Four items from client feedback:
1. Stuck 'Initial Indexing' status. Root cause (by design in Onyx):
docprocessing/utils.py never runs a classic index attempt for INGESTION_API
connectors — documents are pushed via the API, not polled — so
last_finished_status stays null and the badge is stuck even though the docs
are indexed and searchable (also why it's safe: no risk of re-index deleting
the pushed docs). Two-part fix:
- Connector now sets each cc_pair ACTIVE after provisioning (set_cc_pair_active),
which fixes the connector detail page + 'Active Connectors' count.
- Frontend overlay (branding/smb/smb-ui.patch): the Ingestion table shows the
real cc_pair_status for ingestion_api connectors instead of forcing
'Initial Indexing'. Verified live: new cc_pair comes up ACTIVE.
2. Connector name now configurable: ONYX_CONNECTOR_NAME_PREFIX (default 'AIDO SMB').
3. HTTP timeout now configurable: ONYX_HTTP_TIMEOUT (default 60), for large embeds.
4. (Phase 2 already delivered in ab64692 — the preview/path overlay.)
Verified live against running Onyx: provisioning sets ACTIVE, custom prefix
'Livtec Docs - Sales' applied, timeout honoured, ä-filename still indexed. Full
overlay apply green, no conflict markers, connector modules parse.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
parent
ee281da0e5
commit
f3ab7f4cee
6 changed files with 53 additions and 2 deletions
|
|
@ -1,3 +1,22 @@
|
||||||
|
diff --git a/web/src/app/admin/indexing/status/CCPairIndexingStatusTable.tsx b/web/src/app/admin/indexing/status/CCPairIndexingStatusTable.tsx
|
||||||
|
index 39061740..04cf8794 100644
|
||||||
|
--- a/web/src/app/admin/indexing/status/CCPairIndexingStatusTable.tsx
|
||||||
|
+++ b/web/src/app/admin/indexing/status/CCPairIndexingStatusTable.tsx
|
||||||
|
@@ -175,7 +175,13 @@ function ConnectorRow({
|
||||||
|
<TableCell>
|
||||||
|
<CCPairStatus
|
||||||
|
ccPairStatus={
|
||||||
|
- ccPairsIndexingStatus.last_finished_status !== null
|
||||||
|
+ // AIDO: ingestion-API connectors (e.g. the SMB sync) are never run
|
||||||
|
+ // through Onyx's classic indexer — documents are pushed via the API —
|
||||||
|
+ // so last_finished_status stays null and the badge would otherwise be
|
||||||
|
+ // stuck on "Initial Indexing" even though the docs are indexed. Show
|
||||||
|
+ // the real connector status for them instead.
|
||||||
|
+ ccPairsIndexingStatus.last_finished_status !== null ||
|
||||||
|
+ ccPairsIndexingStatus.source === ValidSources.IngestionApi
|
||||||
|
? ccPairsIndexingStatus.cc_pair_status
|
||||||
|
: ccPairsIndexingStatus.last_status == "not_started"
|
||||||
|
? ConnectorCredentialPairStatus.SCHEDULED
|
||||||
diff --git a/web/src/lib/search/utils.ts b/web/src/lib/search/utils.ts
|
diff --git a/web/src/lib/search/utils.ts b/web/src/lib/search/utils.ts
|
||||||
index bdb98931..14aa85eb 100644
|
index bdb98931..14aa85eb 100644
|
||||||
--- a/web/src/lib/search/utils.ts
|
--- a/web/src/lib/search/utils.ts
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,11 @@ ONYX_API_KEY=
|
||||||
# How often to reconcile each share (seconds).
|
# How often to reconcile each share (seconds).
|
||||||
INGESTION_INTERVAL_SECONDS=300
|
INGESTION_INTERVAL_SECONDS=300
|
||||||
|
|
||||||
|
# Prefix for the auto-created Onyx connector names ("<prefix> - <source name>").
|
||||||
|
ONYX_CONNECTOR_NAME_PREFIX=AIDO SMB
|
||||||
|
# HTTP timeout (s) for Onyx API calls — raise it for large files / slow embeddings.
|
||||||
|
ONYX_HTTP_TIMEOUT=60
|
||||||
|
|
||||||
# File selection.
|
# File selection.
|
||||||
INCLUDE_EXTENSIONS=pdf,docx,txt,md,csv,xlsx,html,htm
|
INCLUDE_EXTENSIONS=pdf,docx,txt,md,csv,xlsx,html,htm
|
||||||
MAX_FILE_MB=50
|
MAX_FILE_MB=50
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,8 @@ class Config:
|
||||||
max_file_mb: int
|
max_file_mb: int
|
||||||
log_level: str
|
log_level: str
|
||||||
filename_encoding: str = "cp1252"
|
filename_encoding: str = "cp1252"
|
||||||
|
connector_name_prefix: str = "AIDO SMB"
|
||||||
|
http_timeout: int = 60
|
||||||
sources: list[SourceConfig] = field(default_factory=list)
|
sources: list[SourceConfig] = field(default_factory=list)
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -143,6 +145,10 @@ def load_config() -> Config:
|
||||||
# Codepage used to recover filenames whose bytes aren't valid UTF-8 (common
|
# Codepage used to recover filenames whose bytes aren't valid UTF-8 (common
|
||||||
# on Windows/Latin-1 shares, e.g. 0xE4 = ä). cp1252 covers Western European.
|
# on Windows/Latin-1 shares, e.g. 0xE4 = ä). cp1252 covers Western European.
|
||||||
filename_encoding=os.environ.get("SMB_FILENAME_ENCODING", "cp1252"),
|
filename_encoding=os.environ.get("SMB_FILENAME_ENCODING", "cp1252"),
|
||||||
|
# Prefix for the auto-created Onyx connector names ("<prefix> - <source>").
|
||||||
|
connector_name_prefix=os.environ.get("ONYX_CONNECTOR_NAME_PREFIX", "AIDO SMB"),
|
||||||
|
# HTTP timeout for Onyx API calls; raise it for large embeddings/ingests.
|
||||||
|
http_timeout=int(os.environ.get("ONYX_HTTP_TIMEOUT", "60")),
|
||||||
sources=_load_sources(),
|
sources=_load_sources(),
|
||||||
)
|
)
|
||||||
if not cfg.sources:
|
if not cfg.sources:
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ def main() -> int:
|
||||||
signal.signal(signal.SIGINT, _handle_signal)
|
signal.signal(signal.SIGINT, _handle_signal)
|
||||||
|
|
||||||
state = State.load(cfg.state_path)
|
state = State.load(cfg.state_path)
|
||||||
client = OnyxClient(cfg.api_url, cfg.api_key)
|
client = OnyxClient(cfg.api_url, cfg.api_key, timeout=cfg.http_timeout)
|
||||||
client.set_admin_credentials(cfg.admin_email, cfg.admin_password)
|
client.set_admin_credentials(cfg.admin_email, cfg.admin_password)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
|
|
@ -157,6 +157,7 @@ class OnyxClient:
|
||||||
existing = self.find_cc_pair_id_by_name(name)
|
existing = self.find_cc_pair_id_by_name(name)
|
||||||
if existing:
|
if existing:
|
||||||
logger.info("Reusing existing connector '%s' (cc_pair_id=%s)", name, existing)
|
logger.info("Reusing existing connector '%s' (cc_pair_id=%s)", name, existing)
|
||||||
|
self.set_cc_pair_active(existing)
|
||||||
return existing
|
return existing
|
||||||
|
|
||||||
connector = {
|
connector = {
|
||||||
|
|
@ -188,8 +189,28 @@ class OnyxClient:
|
||||||
if not cc:
|
if not cc:
|
||||||
raise OnyxError(f"could not determine cc_pair_id after provisioning: {body}")
|
raise OnyxError(f"could not determine cc_pair_id after provisioning: {body}")
|
||||||
logger.info("Provisioned connector '%s' → cc_pair_id=%s", name, cc)
|
logger.info("Provisioned connector '%s' → cc_pair_id=%s", name, cc)
|
||||||
|
self.set_cc_pair_active(int(cc))
|
||||||
return int(cc)
|
return int(cc)
|
||||||
|
|
||||||
|
def set_cc_pair_active(self, cc_pair_id: int) -> None:
|
||||||
|
"""Mark the cc_pair ACTIVE. Onyx never runs a classic index attempt for
|
||||||
|
ingestion-API connectors (docs are pushed via the API, not polled), so
|
||||||
|
without this they sit in SCHEDULED/INITIAL_INDEXING forever. Best-effort."""
|
||||||
|
try:
|
||||||
|
resp = self._request(
|
||||||
|
"PUT",
|
||||||
|
f"/manage/admin/cc-pair/{cc_pair_id}/status",
|
||||||
|
json={"status": "ACTIVE"},
|
||||||
|
auth=self._admin_auth,
|
||||||
|
)
|
||||||
|
if resp.status_code >= 400:
|
||||||
|
logger.warning(
|
||||||
|
"Could not set cc_pair %s ACTIVE [%s]: %s",
|
||||||
|
cc_pair_id, resp.status_code, resp.text[:200],
|
||||||
|
)
|
||||||
|
except OnyxError as exc:
|
||||||
|
logger.warning("Could not set cc_pair %s ACTIVE: %s", cc_pair_id, exc)
|
||||||
|
|
||||||
# -- helpers -------------------------------------------------------------
|
# -- helpers -------------------------------------------------------------
|
||||||
_admin_email: str | None = None
|
_admin_email: str | None = None
|
||||||
_admin_password: str | None = None
|
_admin_password: str | None = None
|
||||||
|
|
|
||||||
|
|
@ -116,7 +116,7 @@ def sync_source(client: OnyxClient, cfg: Config, source: SourceConfig, state: St
|
||||||
ss = state.source(source.name)
|
ss = state.source(source.name)
|
||||||
cc_pair_id = source.cc_pair_id or ss.cc_pair_id
|
cc_pair_id = source.cc_pair_id or ss.cc_pair_id
|
||||||
if not cc_pair_id:
|
if not cc_pair_id:
|
||||||
cc_pair_id = client.provision_cc_pair(f"AIDO SMB - {source.name}")
|
cc_pair_id = client.provision_cc_pair(f"{cfg.connector_name_prefix} - {source.name}")
|
||||||
ss.cc_pair_id = cc_pair_id
|
ss.cc_pair_id = cc_pair_id
|
||||||
state.save()
|
state.save()
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue