fix: cache_enabled never reaches the launcher Migrator gate#3
Merged
Conversation
Two stacked issues left `Migrator().run()` permanently skipped on every service: 1. SelfSustainingMeta.__getattr__ only fires on attribute miss, so a class-body default (`cache_enabled: bool = False`) shadows the singleton — `Configs.cache_enabled` in the launcher lifespan always read the stale class default, never the instance value. 2. `_setup_redis` read `RedisHandler.enabled` (same class-default shadow, and one line before RedisHandler was even constructed), so the instance value was False as well. Drop the class default (annotation-only delegates through the metaclass), initialise it in __init__, and read `enabled` off the constructed handler instance. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2727d70 to
71476f3
Compare
aradng
added a commit
that referenced
this pull request
Jun 7, 2026
HostTenantMapping defines its own Meta (model_key_prefix override), so it never chains to BaseCache.Meta.database and its db() resolves to aredis_om's import-time default (localhost:6379, unauthenticated). On deployments where redis requires AUTH this crashes the boot-time Migrator with AuthenticationError as soon as the cache_enabled gate (fixed in #3) lets it run. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
aradng
added a commit
that referenced
this pull request
Jun 7, 2026
HostTenantMapping defines its own Meta (model_key_prefix override), so it never chains to BaseCache.Meta.database and its db() resolves to aredis_om's import-time default (localhost:6379, unauthenticated). On deployments where redis requires AUTH this crashes the boot-time Migrator with AuthenticationError as soon as the cache_enabled gate (fixed in #3) lets it run. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Bug
Migrator().run()in the launcher lifespan is gated onConfigs.cache_enabled(launcher/main.py:40) — and that gate has been permanentlyFalseon every service, so redis-om RediSearch indexes are never created at boot. Symptom downstream:redis.exceptions.ResponseError: No such index cache:...on anyBaseCache.find().Two stacked causes:
SelfSustainingMeta.__getattr__only fires on attribute miss. A class-body default likecache_enabled: bool = Falselives inConfigs.__dict__, so class access (Configs.cache_enabled) resolves to the stale default and never delegates to the singleton instance._setup_redisreadRedisHandler.enabled(class access) — the same shadow (enabled: bool = False), and one line beforeRedisHandler(...)was even constructed — so even the instance-sideself.cache_enabledended upFalse.Minimal repro of the metaclass semantics:
Fix (+5/−3, one file)
cache_enabled: boolannotation-only, initialised toFalsein__init__— class access now delegates through the metaclass._setup_redisconstructsRedisHandlerfirst and readsenabledoff the instance.RedisHandler.enabled's own class default is left untouched:tenant/depends.py:64reads it at class level on non-redis services where the handler is never constructed, and removing the default would turn that into anAttributeError.Verification
Dropped the FT indexes in redis, restarted a fastloom service (assistant) with this patch — boot-time Migrator recreated them with no manual intervention:
🤖 Generated with Claude Code