Commit Graph

1 Commits (main)

Author SHA1 Message Date
vicfei c9d5987a5d fix(initialization): stamp the KB's tenant onto created models
processInitializationModels inserted models built by toModel(), which
carries no TenantID, so every model the initialization endpoint had to
create landed in the models table with tenant_id = 0. The read path
filters on (tenant_id = ? OR is_builtin = true), which means no tenant —
not even the one that just configured the KB — could ever resolve those
models; the KB stayed bound to unreadable model IDs and document
processing stalled forever (issue #3333).

Set the tenant from the KB that is already in scope before CreateModel.
The reuse path (updating an already-stored model) keeps its stored
tenant. Tests pin both paths.

Closes #3333
2026-09-17 13:09:34 +08:00