fix(retrieval): fail open on registry resolution errors

This commit is contained in:
2026-04-24 11:32:46 -04:00
parent ce6ffdbb63
commit 05c11fd4fb
7 changed files with 121 additions and 6 deletions

View File

@@ -42,7 +42,12 @@ def ingest_file(file_path: Path, project_id: str = "") -> dict:
from atocore.projects.registry import derive_project_id_for_path
project_id = derive_project_id_for_path(file_path)
except Exception:
except Exception as exc:
log.warning(
"project_id_derivation_failed",
file_path=str(file_path),
error=str(exc),
)
project_id = ""
if not file_path.exists():

View File

@@ -84,7 +84,15 @@ def retrieve(
"""Retrieve the most relevant chunks for a query."""
top_k = top_k or _config.settings.context_top_k
start = time.time()
scoped_project = get_registered_project(project_hint) if project_hint else None
try:
scoped_project = get_registered_project(project_hint) if project_hint else None
except Exception as exc:
log.warning(
"project_scope_resolution_failed",
project_hint=project_hint,
error=str(exc),
)
scoped_project = None
scope_filter_enabled = bool(scoped_project and _config.settings.rank_project_scope_filter)
registered_projects = None
query_top_k = top_k
@@ -292,7 +300,15 @@ def _project_match_boost(project_hint: str, metadata: dict) -> float:
if not hint_lower:
return 1.0
project = get_registered_project(project_hint)
try:
project = get_registered_project(project_hint)
except Exception as exc:
log.warning(
"project_match_boost_resolution_failed",
project_hint=project_hint,
error=str(exc),
)
project = None
candidate_names = _project_scope_terms(project) if project is not None else {hint_lower}
for candidate in candidate_names:
if _metadata_has_term(metadata, candidate):