Fix: load operation validator extension in worker process (#280)
The worker was not loading the OperationValidatorExtension, so operation validation was silently skipped for all async operations (e.g. refresh_mental_model triggered after consolidation). The API server already loaded this extension but the worker entry point was missing it.
This commit is contained in:
parent
382550690a
commit
96f0e54efa
1 changed files with 8 additions and 1 deletions
|
|
@ -176,7 +176,7 @@ def main():
|
|||
nonlocal memory, poller
|
||||
import uvicorn
|
||||
|
||||
from ..extensions import TenantExtension, load_extension
|
||||
from ..extensions import OperationValidatorExtension, TenantExtension, load_extension
|
||||
|
||||
# Load tenant extension BEFORE creating MemoryEngine so it can
|
||||
# set correct schema context during task execution. Without this,
|
||||
|
|
@ -184,6 +184,12 @@ def main():
|
|||
# causing worker writes to land in the wrong schema.
|
||||
tenant_extension = load_extension("TENANT", TenantExtension)
|
||||
|
||||
# Load operation validator so workers can record usage metering
|
||||
# for async operations (e.g. refresh_mental_model after consolidation)
|
||||
operation_validator = load_extension("OPERATION_VALIDATOR", OperationValidatorExtension)
|
||||
if operation_validator:
|
||||
logger.info(f"Loaded operation validator: {operation_validator.__class__.__name__}")
|
||||
|
||||
# Initialize MemoryEngine
|
||||
# Workers use SyncTaskBackend because they execute tasks directly,
|
||||
# they don't need to store tasks (they poll from DB)
|
||||
|
|
@ -191,6 +197,7 @@ def main():
|
|||
run_migrations=False, # Workers don't run migrations
|
||||
task_backend=SyncTaskBackend(),
|
||||
tenant_extension=tenant_extension,
|
||||
operation_validator=operation_validator,
|
||||
)
|
||||
|
||||
await memory.initialize()
|
||||
|
|
|
|||
Loading…
Reference in a new issue