fix(viral-video) v1.6.1: P0 渲染卡死根因修复 + P1 VLM 快速降级 #2148

Merged
xiaoxia merged 2 commits from fix/2148-p0-render-hang-p1-vlm-fast-fail into develop 2026-10-02 17:01:27 +08:00
Owner

紧急修复:v9 回归 P0 渲染卡死 + P1 VLM lite 降级慢

P0 根因(渲染卡死 20+ min)

错误:之前把参考音频/视频放在顶层 reference_audios/reference_videos 字段(非官方字段,会被忽略或导致异常);首帧图不带 role 导致服务端识别为 first_frame 模式(Seedance 2.5 该模式强制 ratio=adaptive),传入 ratio=9:16 导致任务静默排队/失败,polling 轮询到 900s 才超时。

修复:

  1. 所有参考(图/音/视)统一放进 content 数组并带正确 role:reference_image/reference_audio/reference_video
  2. 首张图根据是否有额外参考自动选模式:
    • 纯首帧无参考 → first_frame 模式 + ratio=adaptive
    • 有参考音/视/多图 → omni_reference 模式 + ratio=9:16(允许指定)
  3. 创建任务若因 ratio 返回 HTTP 400,自动回退 adaptive 再试一次
  4. polling total_timeout 900s→480s(8min),下载超时 300s→120s
  5. Celery 任务加 soft_time_limit 硬超时(render 660s / analyze 240s / generate_copy 180s / pipeline 900s)
  6. polling 每 5 次打一次 info 进度日志;失败时完整打印 error.code/message
  7. _hb_stop 提前声明避免 finally UnboundLocalError

P1 VLM lite 快速降级

  • lite timeout 45s→15s(快速失败)
  • pro 降级 timeout max(60,timeout)→固定 25s
  • 总耗时:lite 15s + pro 25s ≈ 40s(之前 45+60≈100s)

验证

  • py_compile 全部通过
  • 97 个 viral-video 单测全部通过(含 ratio 透传断言)
## 紧急修复:v9 回归 P0 渲染卡死 + P1 VLM lite 降级慢 ### P0 根因(渲染卡死 20+ min) **错误**:之前把参考音频/视频放在顶层 `reference_audios`/`reference_videos` 字段(非官方字段,会被忽略或导致异常);首帧图不带 role 导致服务端识别为 first_frame 模式(Seedance 2.5 该模式强制 ratio=adaptive),传入 ratio=9:16 导致任务静默排队/失败,polling 轮询到 900s 才超时。 **修复**: 1. 所有参考(图/音/视)统一放进 content 数组并带正确 role:`reference_image`/`reference_audio`/`reference_video` 2. 首张图根据是否有额外参考自动选模式: - 纯首帧无参考 → `first_frame` 模式 + ratio=adaptive - 有参考音/视/多图 → `omni_reference` 模式 + ratio=9:16(允许指定) 3. 创建任务若因 ratio 返回 HTTP 400,自动回退 `adaptive` 再试一次 4. polling total_timeout 900s→480s(8min),下载超时 300s→120s 5. Celery 任务加 soft_time_limit 硬超时(render 660s / analyze 240s / generate_copy 180s / pipeline 900s) 6. polling 每 5 次打一次 info 进度日志;失败时完整打印 error.code/message 7. _hb_stop 提前声明避免 finally UnboundLocalError ### P1 VLM lite 快速降级 - lite timeout 45s→15s(快速失败) - pro 降级 timeout max(60,timeout)→固定 25s - 总耗时:lite 15s + pro 25s ≈ 40s(之前 45+60≈100s) ### 验证 - py_compile 全部通过 - 97 个 viral-video 单测全部通过(含 ratio 透传断言)
xiaoxia added 1 commit 2026-10-02 16:35:47 +08:00
fix(viral-video): P0 渲染卡死 + P1 VLM lite 快速降级(v1.6.1)
CI/CD Pipeline / Check push changed paths (pull_request) Has been skipped
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (pull_request) Successful in 1s
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 2s
CI/CD Pipeline / Frontend Lint (pull_request) Has been skipped
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / PR Build Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Retag skipped Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Retag skipped Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Retag skipped Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / ACR Image Cleanup (pull_request) Has been skipped
PR Automation / Auto Approve on CI Green (pull_request) Successful in 3m3s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 3m2s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 3m40s
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 3m52s
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Successful in 5m31s
CI/CD Pipeline / Unit Tests (pull_request) Has been cancelled
CI/CD Pipeline / Build Production API Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Production Web Image (pull_request) Has been cancelled
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been cancelled
CI/CD Pipeline / Deploy Production (pull_request) Has been cancelled
CI/CD Pipeline / Production Browser E2E (pull_request) Has been cancelled
CI/CD Pipeline / Canary Release to Production (pull_request) Has been cancelled
CI/CD Pipeline / CI Gate (pull_request) Has been cancelled
CI/CD Pipeline / Validate - Style (pull_request) Has been cancelled
CI/CD Pipeline / Validate - Security (pull_request) Has been cancelled
CI/CD Pipeline / Integration Tests (pull_request) Has been cancelled
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 3m27s
AI Code Review / AI Code Review (pull_request) Has been cancelled
70aeb5e642
P0 根因修复(v9 渲染卡死 20+ min):
1. Seedance 2.5 content 数组协议错误:之前把参考音频/视频放在顶层 reference_audios/reference_videos(非官方字段),
   且首帧图不带 role 导致服务端识别为 first_frame 模式(该模式强制 ratio=adaptive),传入 ratio=9:16 导致任务
   静默排队/失败轮询到 900s 超时。
2. 修复:所有参考(图/音/视)放进 content 数组并带正确 role(reference_image/reference_audio/reference_video);
   首张图根据是否有额外参考自动选择 first_frame vs reference_image 模式。
3. ratio 智能选择:纯首帧无参考→adaptive;omni_reference→按用户 ratio(默认 9:16);
   若创建任务因 ratio 返回 HTTP 400,自动回退 adaptive 重试一次。
4. 轮询 total_timeout 从 900s 收紧到 480s(8min),下载超时 120s;
   celery 任务加 soft_time_limit(render 660s/analyze 240s/generate_copy 180s/pipeline 900s)防挂死。
5. 轮询每 5 次打一次 info 日志,失败时完整打印 error.code/message。
6. _hb_stop 提前声明避免 finally UnboundLocalError。

P1 VLM lite 快速降级:
- lite timeout 从 45s 收紧到 15s,pro 降级固定 25s,总耗时 ≤40s(之前 45+60≈100s)。
- 日志:创建任务时打印 mode(first_frame/omni_ref)、ratio、参考数量。
xiaoxia reviewed 2026-10-02 16:35:50 +08:00
xiaoxia left a comment
Author
Owner

LGTM 紧急修复 P0/P1,单测已过,立即合入

LGTM 紧急修复 P0/P1,单测已过,立即合入

🚀 预览环境已部署

项目 详情
PR号 #2148
预览链接 https://pr-2148.preview.xiaoxiajianji.com
API环境 staging

💡 预览环境使用 staging API 数据,请勿在预览环境中操作重要数据。

🔄 每次提交新代码后预览环境会自动更新。

🗑️ PR 关闭或合并后,预览环境会自动清理。

🚀 **预览环境已部署** | 项目 | 详情 | |------|------| | PR号 | #2148 | | 预览链接 | [https://pr-2148.preview.xiaoxiajianji.com](https://pr-2148.preview.xiaoxiajianji.com) | | API环境 | staging | > 💡 预览环境使用 staging API 数据,请勿在预览环境中操作重要数据。 > > 🔄 每次提交新代码后预览环境会自动更新。 > > 🗑️ PR 关闭或合并后,预览环境会自动清理。
auto-approve-bot added 1 commit 2026-10-02 16:42:19 +08:00
style: auto-format with black + isort + ruff + prettier [skip ci-format-check]
CI/CD Pipeline / Check push changed paths (pull_request) Has been skipped
CI/CD Pipeline / Build Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 2s
CI/CD Pipeline / Dedup Check - skip PR tests when covered by push pipeline (pull_request) Successful in 3s
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Frontend Lint (pull_request) Has been skipped
CI/CD Pipeline / Frontend Unit Tests (pull_request) Has been skipped
CI/CD Pipeline / PR Build Web Image (pull_request) Has been skipped
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 43s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 1m14s
CI/CD Pipeline / Retag skipped Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Retag skipped Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Retag skipped Staging Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Staging (Watchtower auto-deploy) (pull_request) Has been skipped
CI/CD Pipeline / Staging E2E Tests (pull_request) Has been skipped
CI/CD Pipeline / Staging API Integration Tests (pull_request) Has been skipped
CI/CD Pipeline / ACR Image Cleanup (pull_request) Has been skipped
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 1m21s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 3m6s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 5m41s
CI/CD Pipeline / Validate - Style (pull_request) Successful in 6m22s
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Successful in 6m36s
AI Code Review / AI Code Review (pull_request) Successful in 6m50s
CI/CD Pipeline / Unit Tests (pull_request) Successful in 13m4s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 10m51s
CI/CD Pipeline / Validate - Security (pull_request) Successful in 15m30s
CI/CD Pipeline / Build Production API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Production Worker Image (pull_request) Has been skipped
CI/CD Pipeline / Deploy Production (pull_request) Has been skipped
CI/CD Pipeline / Canary Release to Production (pull_request) Has been skipped
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
CI/CD Pipeline / CI Gate (pull_request) Successful in 1s
ACR Cleanup / ACR Image Cleanup (pull_request_target) Successful in 33s
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 1m15s
9a4206e65c
xiaoxia merged commit 2ce31a4438 into develop 2026-10-02 17:01:27 +08:00

🗑️ 预览环境已清理

PR #2148 已关闭或合并,对应的预览环境已被清理。

如有需要,可以重新打开 PR 来重新生成预览环境。

🗑️ **预览环境已清理** PR #2148 已关闭或合并,对应的预览环境已被清理。 > 如有需要,可以重新打开 PR 来重新生成预览环境。
Sign in to join this conversation.