fix(#2180 P0): VLM/LLM timeout 调大,适配方舟视觉API 24-38s响应 #2180

Merged
xiaoxia merged 2 commits from fix/vlm-timeout-tune into develop 2026-10-04 18:36:02 +08:00
Owner

背景

P0:staging VLM/文案全链路耗时超标,VLM预期15s实际129s,intent预期6s实际75s,script预期20s实际78s。

根因

运维从 staging 服务器直连 curl 方舟 VLM 视觉 API 实测:HTTP 200 但耗时 24.2s(x-envoy-upstream-service-time: 23357ms),文本API 3~6s正常。

代码中 timeout 设置:

  • VLM lite vision_timeout=15s → 每次15s被截断→3次重试全超时(46.6s)→ lite降级pro又3次超时(76.7s)→ 总计123s
  • VLM pro fallback timeout=25s,同因3次重试全超时
  • 文案fast-first/fast-retry/pro-fallback timeout=25/25/40s,同样被截断→三级重试叠加351s

决定性证据:每次retry elapsed时间精确等于timeout值(15.1s/25.1s/40.1s),典型客户端read timeout先于服务端返回。

修改

调用 原timeout 新timeout 依据
VLM lite 15s 45s 方舟VLM实测24-38s,45s给一次重试余量
VLM pro fallback 25s 60s pro实测25-38s,60s余量
意图解析(chat) 25s 45s 文本API高峰期6-8s,45s余量
文案fast-first/fast-retry 25s 45s 同上
文案pro-fallback 40s 60s pro模型max_tokens=3500输出较长,60s余量
文案审核 20s 30s 对齐文本API
doubao_timeout默认 30s 45s 基础兜底

验证

部署后新job应看到:

  • VLM单次调用24-45s返回(非15s截断)
  • tokens_out有正常输出(不再None)
  • portrait_prompt返回人物描述而非"无人像"
  • t2i信任链预热触发
## 背景 P0:staging VLM/文案全链路耗时超标,VLM预期15s实际129s,intent预期6s实际75s,script预期20s实际78s。 ## 根因 运维从 staging 服务器直连 curl 方舟 VLM 视觉 API 实测:HTTP 200 但耗时 **24.2s**(`x-envoy-upstream-service-time: 23357ms`),文本API 3~6s正常。 代码中 timeout 设置: - VLM lite `vision_timeout=15s` → 每次15s被截断→3次重试全超时(46.6s)→ lite降级pro又3次超时(76.7s)→ 总计123s - VLM pro fallback timeout=25s,同因3次重试全超时 - 文案fast-first/fast-retry/pro-fallback timeout=25/25/40s,同样被截断→三级重试叠加351s 决定性证据:每次retry elapsed时间**精确等于timeout值**(15.1s/25.1s/40.1s),典型客户端read timeout先于服务端返回。 ## 修改 | 调用 | 原timeout | 新timeout | 依据 | |---|---|---|---| | VLM lite | 15s | **45s** | 方舟VLM实测24-38s,45s给一次重试余量 | | VLM pro fallback | 25s | **60s** | pro实测25-38s,60s余量 | | 意图解析(chat) | 25s | **45s** | 文本API高峰期6-8s,45s余量 | | 文案fast-first/fast-retry | 25s | **45s** | 同上 | | 文案pro-fallback | 40s | **60s** | pro模型max_tokens=3500输出较长,60s余量 | | 文案审核 | 20s | **30s** | 对齐文本API | | doubao_timeout默认 | 30s | **45s** | 基础兜底 | ## 验证 部署后新job应看到: - VLM单次调用24-45s返回(非15s截断) - tokens_out有正常输出(不再None) - portrait_prompt返回人物描述而非"无人像" - t2i信任链预热触发
xiaoxia added 1 commit 2026-10-04 18:26:33 +08:00
fix(#2180 P0): VLM/LLM timeout 调大,适配方舟视觉API 24-38s 响应
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 2s
CI/CD Pipeline / Check if frontend-only change (pull_request) Successful in 6s
CI/CD Pipeline / Build Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Worker Image (pull_request) Has been skipped
Preview Deploy / Deploy Preview Environment (pull_request) Successful in 1m39s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 2m52s
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 25s
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
CI/CD Pipeline / Validate - Style (pull_request) Successful in 4m53s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 3m31s
CI/CD Pipeline / Unit Tests (pull_request) Failing after 3m33s
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Successful in 4m28s
AI Code Review / AI Code Review (pull_request) Successful in 6m33s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 4m12s
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 - Security (pull_request) Has been cancelled
PR Automation / Auto Merge on CI Green + Approved (pull_request) Has been cancelled
c7aed2c152
- VLM lite timeout: 15s → 45s(方舟VLM实测服务端处理24-38s,原15s必超时3次重试全挂)
- VLM pro fallback timeout: 25s → 60s
- 意图解析 chat timeout: 25s → 45s
- 文案fast-first/fast-retry timeout: 25s → 45s
- 文案pro-fallback timeout: 40s → 60s
- 文案审核timeout: 20s → 30s
- doubao_timeout默认: 30s → 45s

根因:方舟VLM视觉API从staging服务器实测响应24-38s(x-envoy-upstream-service-time:23357ms),
原timeout=15s每次都被截断,3次重试全超时→lite降级pro又3次超时→总123s。
文案三级重试同理叠加到351s。调大timeout后单次调用应能在45s内返回。

🚀 预览环境已部署

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

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

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

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

🚀 **预览环境已部署** | 项目 | 详情 | |------|------| | PR号 | #2180 | | 预览链接 | [https://pr-2180.preview.xiaoxiajianji.com](https://pr-2180.preview.xiaoxiajianji.com) | | API环境 | staging | > 💡 预览环境使用 staging API 数据,请勿在预览环境中操作重要数据。 > > 🔄 每次提交新代码后预览环境会自动更新。 > > 🗑️ PR 关闭或合并后,预览环境会自动清理。
xiaoxia added 1 commit 2026-10-04 18:34:14 +08:00
fix(#2180): 全局 max_retries 2→1,避免重试叠加到351s
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 / Build Staging API Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Web Image (pull_request) Has been skipped
CI/CD Pipeline / Build Staging Worker 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 / 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 2m2s
Preview Cleanup / Cleanup Preview Environment (pull_request) Successful in 54s
ACR Cleanup / ACR Image Cleanup (pull_request_target) Successful in 1m6s
CI/CD Pipeline / PR Build API Image (pull_request) Successful in 4m14s
CI/CD Pipeline / PR Build Worker Image (pull_request) Successful in 4m19s
CI/CD Pipeline / Unit Tests (pull_request) Failing after 4m43s
AI Code Review / AI Code Review (pull_request) Successful in 5m5s
CI/CD Pipeline / Integration Tests (pull_request) Successful in 5m10s
CI/CD Pipeline / Validate - Style (pull_request) Successful in 5m48s
PR Automation / Auto Approve on CI Green (pull_request) Successful in 8m22s
CI/CD Pipeline / Validate - Python (mypy + alembic) (pull_request) Successful in 8m23s
PR Automation / Auto Merge on CI Green + Approved (pull_request) Successful in 1m48s
CI/CD Pipeline / Validate - Security (pull_request) Successful in 11m52s
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 / CI Gate (pull_request) Failing after 2s
CI/CD Pipeline / Production Browser E2E (pull_request) Has been skipped
42dd5fabc6
原配置max_retries=2(即3次尝试),lite失败→3次超时→pro降级→3次超时,
VLM最坏46.6+76.7=123s,文案三级重试最坏351s。
timeout调大到45/60s后,方舟API正常情况下1次调用就能在24-38s内返回,
max_retries=1(即2次尝试)足够防偶发网络抖动。
最坏情况VLM总耗时:45+45+60+60=210s,比351s改善40%。
xiaoxia merged commit 0f592add29 into develop 2026-10-04 18:36:02 +08:00

🗑️ 预览环境已清理

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

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

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