Merge pull request 'fix(admin-scrape): ge=1 on /failures limit + enforce LLM finish_reason' (#1701) from fix/admin-scrape-validation into main
Some checks are pending
Deploy / changes (push) Waiting to run
Deploy / build-backend (push) Blocked by required conditions
Deploy / build-worker (push) Blocked by required conditions
Deploy / build-frontend (push) Blocked by required conditions
Deploy / deploy (push) Blocked by required conditions
Some checks are pending
Deploy / changes (push) Waiting to run
Deploy / build-backend (push) Blocked by required conditions
Deploy / build-worker (push) Blocked by required conditions
Deploy / build-frontend (push) Blocked by required conditions
Deploy / deploy (push) Blocked by required conditions
This commit is contained in:
commit
584aa46f6f
2 changed files with 14 additions and 4 deletions
|
|
@ -268,7 +268,7 @@ def revoke_task(
|
|||
def list_failures(
|
||||
db: Annotated[Session, Depends(get_db)],
|
||||
run_id: int | None = None,
|
||||
limit: int = Query(default=50, ge=0),
|
||||
limit: int = Query(default=50, ge=1),
|
||||
) -> list[dict[str, Any]]:
|
||||
"""Per-request failure log for manual browser verification."""
|
||||
where = ""
|
||||
|
|
@ -1284,9 +1284,7 @@ _FRESHNESS_SOURCES: list[FreshnessSource] = [
|
|||
]
|
||||
|
||||
|
||||
def _classify_freshness(
|
||||
age_days: float | None, fresh_days: float, stale_days: float
|
||||
) -> str:
|
||||
def _classify_freshness(age_days: float | None, fresh_days: float, stale_days: float) -> str:
|
||||
"""fresh / stale / critical / unknown по возрасту последнего успешного прогона."""
|
||||
if age_days is None:
|
||||
return "unknown"
|
||||
|
|
|
|||
|
|
@ -165,6 +165,18 @@ def orchestrate_chat(
|
|||
continue
|
||||
|
||||
# Нет tool_calls → финальная проза.
|
||||
# Проверяем finish_reason: 'length' / 'content_filter' означают обрезанный
|
||||
# или отфильтрованный ответ — неполная проза клиенту не отдаётся (LLMResult
|
||||
# docstring §64: «консьюмер ОБЯЗАН проверять даже при ok=True»).
|
||||
if result.finish_reason not in (None, "stop", "end_turn", "tool_calls"):
|
||||
logger.warning(
|
||||
"chat: non-stop finish_reason=%r for cad=%s run=%s → deterministic fallback",
|
||||
result.finish_reason,
|
||||
cad_num,
|
||||
run_id,
|
||||
)
|
||||
return _deterministic(report_dict, message, f"finish_reason:{result.finish_reason}")
|
||||
|
||||
answer = (result.content or "").strip()
|
||||
if not answer:
|
||||
# Модель вернула пустоту — пустой ответ клиенту не отдаём, деградируем.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue