* fix(tenant): stop wiki tasks of soft-deleted tenants from issuing model requests
Tenant deletion only soft-deletes the tenant and its memberships; its
knowledge bases, model configs, and durable task_pending_ops rows survive.
Wiki ingest/finalize tasks restored from those ops only checked KB state,
so a deleted tenant kept accruing new LLM requests (observed as ~11h of
continued synthesis calls in #3593).
Gate every task entry point on tenant liveness:
- EnqueueIfKnowledgeBaseActive now also requires tenants.deleted_at IS NULL
inside the same transaction (fail closed).
- Startup recovery purges pending rows whose tenant is soft-deleted (the
predicate is wrapped in parentheses: NOT EXISTS(...) AND EXISTS(...) would
parse as (NOT EXISTS(...)) AND EXISTS(...) and silently match nothing).
- Wiki ingest and finalize handlers check tenant liveness from the payload
before any model call and drop the KB's queue when the tenant is gone.
Liveness lookup errors fail open; the guarded enqueue and recovery paths
enforce the same invariant on their own DB access.
Adds TaskPendingOpsTenantLiveness as an optional extension interface,
regression tests for the enqueue guard, startup recovery, and the task
entry guards.
Fixes#3593
* style(container): wrap long log line over 120 chars for golangci-lint (lll)
---------
Co-authored-by: LuckVd <LuckVd@users.noreply.github.com>