Summary
After the #589 Redis auth migration, 20 unit test failures remain across 7 test files. These fall into two categories: (a) missing/renamed code in the main codebase that tests reference, and (b) unit tests that don't inherit the main conftest's REDIS_URL credential patch.
Context
Discovered during post-#589 test suite run on 2026-05-05. The 1,766 crash-loop errors from #589 are cleared. These are pre-existing or recent regressions unrelated to the Redis migration itself.
Failures by Group
Group A — Missing/renamed code (9 failures, 5 errors)
test_agent_readiness_probe.py (5 errors — collection failure)
ImportError: cannot import name 'get_agent_default_resources' from 'services.settings_service'
services/agent_service/lifecycle.py:26 imports this function but it doesn't exist in settings_service.py
test_telegram_webhook_backfill.py (4 failures)
ImportError: cannot import name 'AgentDefaultResourcesUpdate' from 'models'
routers/settings.py:18 imports this model but it's been removed/renamed from models.py
test_fleet_sync_audit.py (2 failures)
sqlite3.IntegrityError: UNIQUE constraint failed: agent_git_config.github_repo, agent_git_config.working_branch
- Test seeds duplicate
(github_repo, working_branch) rows to test detection logic, but the schema UNIQUE constraint blocks this. Constraint likely needs to be partial (only for source_mode=0).
test_git_status_dual_ahead_behind.py (2 failures)
compute_ahead_behind() returns (0, 0) when (0, 1) / (1, 0) expected
- Ahead/behind calculation for the working branch is broken
test_schedule_status_observability.py (1 failure)
- Expected
#378 residual-race log message not emitted — log statement missing or changed
Group B — REDIS_URL not patched in unit test isolation (10 failures)
test_file_upload.py (6), test_voice_auth.py (3), test_chat_sync_backlog.py (1) all fail with:
RuntimeError: REDIS_URL must include credentials
- These tests import modules whose import chain reaches
config.py before the main conftest's setdefault patch applies
- Fix: Add
tests/unit/conftest.py that sets os.environ.setdefault("REDIS_URL", "redis://test:test@redis:6379") before any imports
Group C — Collection errors (2 files excluded entirely)
unit/test_skill_service_user_agent.py
ModuleNotFoundError: No module named 'utils.url_validation'
skill_service.py imports validate_skills_library_url from a module not yet created
unit/test_voice_tools.py
ImportError: cannot import name 'GeminiVoiceService' from 'services.gemini_voice'
- Class renamed or not yet added
Group D — Contract mismatch (1 failure)
test_subscription_auto_switch.py::test_get_auto_switch_default_on
assert False is True — auto-switch setting defaults to False but test expects True
Acceptance Criteria
Technical Notes
Quickest wins in order:
tests/unit/conftest.py with REDIS_URL patch → fixes 10 failures instantly
AgentDefaultResourcesUpdate restore → fixes 4 failures + unblocks settings.py
get_agent_default_resources in settings_service.py → fixes 5 collection errors
Summary
After the #589 Redis auth migration, 20 unit test failures remain across 7 test files. These fall into two categories: (a) missing/renamed code in the main codebase that tests reference, and (b) unit tests that don't inherit the main conftest's REDIS_URL credential patch.
Context
Discovered during post-#589 test suite run on 2026-05-05. The 1,766 crash-loop errors from #589 are cleared. These are pre-existing or recent regressions unrelated to the Redis migration itself.
Failures by Group
Group A — Missing/renamed code (9 failures, 5 errors)
test_agent_readiness_probe.py(5 errors — collection failure)ImportError: cannot import name 'get_agent_default_resources' from 'services.settings_service'services/agent_service/lifecycle.py:26imports this function but it doesn't exist insettings_service.pytest_telegram_webhook_backfill.py(4 failures)ImportError: cannot import name 'AgentDefaultResourcesUpdate' from 'models'routers/settings.py:18imports this model but it's been removed/renamed frommodels.pytest_fleet_sync_audit.py(2 failures)sqlite3.IntegrityError: UNIQUE constraint failed: agent_git_config.github_repo, agent_git_config.working_branch(github_repo, working_branch)rows to test detection logic, but the schema UNIQUE constraint blocks this. Constraint likely needs to be partial (only forsource_mode=0).test_git_status_dual_ahead_behind.py(2 failures)compute_ahead_behind()returns(0, 0)when(0, 1)/(1, 0)expectedtest_schedule_status_observability.py(1 failure)#378 residual-race logmessage not emitted — log statement missing or changedGroup B — REDIS_URL not patched in unit test isolation (10 failures)
test_file_upload.py(6),test_voice_auth.py(3),test_chat_sync_backlog.py(1) all fail with:RuntimeError: REDIS_URL must include credentialsconfig.pybefore the main conftest'ssetdefaultpatch appliestests/unit/conftest.pythat setsos.environ.setdefault("REDIS_URL", "redis://test:test@redis:6379")before any importsGroup C — Collection errors (2 files excluded entirely)
unit/test_skill_service_user_agent.pyModuleNotFoundError: No module named 'utils.url_validation'skill_service.pyimportsvalidate_skills_library_urlfrom a module not yet createdunit/test_voice_tools.pyImportError: cannot import name 'GeminiVoiceService' from 'services.gemini_voice'Group D — Contract mismatch (1 failure)
test_subscription_auto_switch.py::test_get_auto_switch_default_onassert False is True— auto-switch setting defaults toFalsebut test expectsTrueAcceptance Criteria
get_agent_default_resourcesadded toservices/settings_service.pyor import inlifecycle.pyupdatedAgentDefaultResourcesUpdatemodel restored inmodels.pyorrouters/settings.pyimport updatedtest_fleet_sync_audit.pyfixtures updated to work with UNIQUE constraint (or constraint made partial)compute_ahead_behind()correctly returns ahead/behind counts for working branchtests/unit/conftest.pycreated withREDIS_URLcredential patch (fixes 10 failures in one shot)#378 residual-racelog re-added totask_execution_service.pyutils/url_validation.pycreated withvalidate_skills_library_urlGeminiVoiceServiceadded/corrected inservices/gemini_voice.pyTechnical Notes
Quickest wins in order:
tests/unit/conftest.pywith REDIS_URL patch → fixes 10 failures instantlyAgentDefaultResourcesUpdaterestore → fixes 4 failures + unblockssettings.pyget_agent_default_resourcesinsettings_service.py→ fixes 5 collection errors