fix(lipsync, P0): Worker运行时ModuleNotFoundError导致任务卡在tts_processing #1854

Merged
auto-approve-bot merged 1 commits from fix/lipsync-worker-module-not-found into develop 2026-09-11 09:52:06 +08:00

1 Commits

Author SHA1 Message Date
xiaoxia-agent c015769a25 fix(lipsync, P0): Worker运行时ModuleNotFoundError导致任务卡在tts_processing
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (pull_request) Successful in 2s
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 2s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 29s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 29s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 1m1s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 1m9s
CI/CD Pipeline / Unit Tests (pull_request) Successful in 1m23s
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Successful in 1m33s
CI/CD Pipeline / Validate - Style (pull_request) Successful in 1m48s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 2m49s
CI/CD Pipeline / Validate - Security (pull_request) Successful in 4m51s
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
CI/CD Pipeline / CI Gate (pull_request) Successful in 1s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 2m40s
AI Code Review / AI Code Review (pull_request) Successful in 6m21s
ACR Cleanup / ACR Image Cleanup (pull_request_target) Successful in 54s
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 1m5s
CI/CD Pipeline / Deploy Production (pull_request) Failing after 125h32m22s
CI/CD Pipeline / Staging E2E Tests (pull_request) Failing after 125h37m6s
CI/CD Pipeline / Retag skipped Staging API Image (pull_request) Failing after 125h37m12s
CI/CD Pipeline / Build Staging API Image (pull_request) Failing after 125h37m16s
CI/CD Pipeline / Build Staging Worker Image (pull_request) Failing after 125h37m1s
CI/CD Pipeline / Build Staging Web Image (pull_request) Failing after 125h37m1s
CI/CD Pipeline / ACR Image Cleanup (pull_request) Failing after 125h36m51s
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Failing after 125h36m55s
CI/CD Pipeline / PR Build Web Image (pull_request) Failing after 125h37m0s
CI/CD Pipeline / Build Production Worker Image (pull_request) Failing after 125h32m10s
CI/CD Pipeline / Staging API Integration Tests (pull_request) Failing after 125h36m52s
CI/CD Pipeline / Canary Release to Production (pull_request) Failing after 125h32m9s
CI/CD Pipeline / Build Production Web Image (pull_request) Failing after 125h32m10s
CI/CD Pipeline / Retag skipped Staging Worker Image (pull_request) Failing after 125h36m58s
CI/CD Pipeline / Retag skipped Staging Web Image (pull_request) Failing after 125h36m59s
CI/CD Pipeline / Frontend Unit Tests (pull_request) Failing after 125h37m1s
CI/CD Pipeline / Check push changed paths (pull_request) Failing after 125h37m4s
CI/CD Pipeline / Build Production API Image (pull_request) Failing after 126h7m16s
CI/CD Pipeline / Frontend Lint (pull_request) Failing after 126h12m7s
根因(经staging运行时日志确认):
1. lipsync_tts.py 中 SessionLocal 导入路径错误:
   从 packages.adapters.sqlalchemy_impl.database 导入,但该模块不存在,
   实际 SessionLocal 在 worker_app.db / app.db 模块级通过 build_session_factory 创建。
   修复:改为懒探测,Worker环境优先worker_app.db,回退到app.db。
2. packages/ 和 packages/adapters/ 缺少 __init__.py,在某些运行时环境下
   可能影响子包导入稳定性(显式包声明优于隐式命名空间包)。
3. lipsync_service.py apply_async 异常被 try/except 吞掉只打 warning,
   前端永远看不到失败原因,job 一直卡在 tts_processing。
   修复:投递失败立即标failed,写error_message+error_code=AsyncDispatchFailed。

本地验证:
- Worker PYTHONPATH 下 import app.tasks.lipsync_tts → Task正确绑定 xiaoxia-saas-worker
- API PYTHONPATH 下 import app.tasks.lipsync_tts → Task正确绑定 xiaoxia-saas-api
- 61/61 单元测试通过
2026-09-11 09:44:39 +08:00