Skip to content

fix(backend): remove erroneous await on sync get_redis_client() (#2628)#2633

Open
mrveiss wants to merge 1 commit intoDev_new_guifrom
fix/await-get-redis-client
Open

fix(backend): remove erroneous await on sync get_redis_client() (#2628)#2633
mrveiss wants to merge 1 commit intoDev_new_guifrom
fix/await-get-redis-client

Conversation

@mrveiss
Copy link
Copy Markdown
Owner

@mrveiss mrveiss commented Mar 27, 2026

Summary

get_redis_client() in autobot_shared/redis_client.py:183 is a synchronous function that returns a Redis client object. However, 50 call sites across 38 files incorrectly used await get_redis_client(...), which raises TypeError at runtime when the code path is hit.

  • Root cause: The function returns an async Redis client when async_client=True, but the function itself is def not async def — callers assumed it was awaitable
  • Fix: Remove await from all 50 occurrences
  • Skipped: 1 occurrence in redis_optimizer.py:861 (inside a string literal suggestion, not actual code)

Affected areas

Services: rag_service, audit_logger, analytics_service, llm_cost_tracker, feature_flags, security_workflow_manager, and 32 more
Critical paths: dependency_container.py, knowledge/base.py, security/service_auth.py

Test plan

  • Pre-commit hooks pass on all 38 files (black, flake8, bandit, etc.)
  • Verified only 1 occurrence remains (string literal in redis_optimizer.py)
  • Tested on 3 sample files before bulk application
  • Full test suite on CI

Closes #2628
Discovered during code review of #2597 (AutoResearch M1)

get_redis_client() is a synchronous function that returns a Redis client
(sync or async depending on the async_client flag). Calling it with await
raises TypeError at runtime. Fixed 50 occurrences across 38 files.

Skipped 1 occurrence in redis_optimizer.py (inside a suggestion string literal).
@github-actions
Copy link
Copy Markdown

⚠️ SSOT Configuration Compliance: Violations Found

Metric Count
Total Violations 2
SSOT Violations (high priority) 1
Other Violations 1

⚠️ 1 values have SSOT config equivalents!

These should be replaced with SSOT config imports:

Python:

from src.config.ssot_config import config
# Use: config.vm.main, config.port.backend, config.backend_url

TypeScript:

import config from '@/config/ssot-config'
// Use: config.vm.main, config.port.backend, config.backendUrl

📖 See SSOT_CONFIG_GUIDE.md for documentation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant