Repository navigation
按媒体时长给 ASR SDK 传 idle_timeout,修超长音频上传卡 300 秒 (#181) - #184
Closed
zj1123581321 wants to merge 3 commits into
Closed
zj1123581321 wants to merge 3 commits into
zj1123581321 wants to merge 3 commits into
Conversation
added 3 commits
October 6, 2026 12:36
Agent-Executor: ocgo-bunny-pi Agent-Model: space-bunny-free Agent-Effort: high Dispatch-Id: dlg-20261006-042548-e5b3ba Task-Id: VideoTranscriptAPI-20261006-03
Agent-Executor: ocgo-bunny-pi Agent-Model: space-bunny-free Agent-Effort: high Dispatch-Id: dlg-20261006-042548-e5b3ba Task-Id: VideoTranscriptAPI-20261006-03
Agent-Executor: ocgo-bunny-pi Agent-Model: space-bunny-free Agent-Effort: high Dispatch-Id: dlg-20261006-042548-e5b3ba Task-Id: VideoTranscriptAPI-20261006-03
Required Gate v2 — 状态面板当前状态:skipped · 无需动作(主审未跑,绿≠过审)
当前裁决:
Gate 历史(v1;来源为持久化
|
| Run | Attempt | Head | 状态 | 收件人动作 |
|---|---|---|---|---|
| 37415956130 | 1 | 6bfae34 |
skipped |
无需动作(主审未跑,绿≠过审) |
历史行按 run_id + run_attempt 去重并只增不删;删除本评论后可由 gate_terminal 制品重建。
Collaborator
Author
|
暂不合并:根因确认为服务端 14400s 上限,已转 zlxlabs/CapsWriter-ASR-Server#92;本 PR 的 idle_timeout 放宽缺复现证据,等 #92 结论再定去留(详见 #181 最新评论)。 |
Collaborator
Author
Collaborator
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
生产上一个 17502 秒 / 494 MB 的直播录制在 ASR 上传阶段两次同因失败:
对到
capswriter_asr/client.py:367-372,失败点是单次ws.send的等待,不是deadline_total的总预算超时。idle_timeout默认 300.0 秒,是一个与媒体长度无关的常数。
诊断
完整过程见
docs/sessions/261006-issue-triage/181-diagnosis.md。要点:里,本地管线一次都没停顿超过 8.67 秒,17502 秒那次最大单帧等待 3.82 秒。
本地侧不是原因,300 秒级停顿只可能发生在 socket 上。
ws.send等的是服务端读 socket;服务端要读完的字节数就是剩余音频,所以单次停顿的上界与媒体长度成正比(17502 秒按实测 3.29 倍实时算约 5320 秒)。任何固定值都必然
在够长的媒体上失效。
都失败——阈值是被输入规模顶破的,不是某一帧偶发卡住。
改动
src/video_transcript_api/transcriber/capswriter_client.pyIDLE_REALTIME_FACTOR = 3.0/IDLE_OVERHEAD_SECONDS = 300.0与_asr_idle_timeout(),拿得到时长时给 SDK 显式传idle_timeout = duration/3 + 300;17502 秒 → 6134 秒。取值是「服务端读完剩余积压所需时间」这一可证上界,常数出自 2026-10-03 那次生产实测(93.08898 秒音频耗时
306.3 秒,3.29 倍实时、约 278 秒固定开销)。
可 grep 的
asr_idle_timeout duration=unknown fallback=sdk_default_300。_transcription_deadline同一层集中计算(LLMConfig 的 dataclass 默认值与 config.example.jsonc 大面积漂移(6 个字段,配置缺键时静默换语义) #147)。PR fix: 时长探测在 generic/recorder 路径失效——复用准入探测结果供转录预算使用 #173(generic/recorder:// 下载路径不写 last_media_duration,时长预算机制对该来源恒失效(静默) #170)之后 generic / recorder 路径同样能拿到 ffprobe 时长。
deadline_total不动,总预算仍在兜底,服务端真挂死照样失败——不是用加大超时掩盖。测试
tests/unit/test_capswriter_idle_timeout.py(21 个用例,已在tests/README.md登记)全部断言真正传给
transcribe_file_sync的实参:有时长时键存在且取值正确、与deadline_total互不覆盖;无时长(None / 负数 / NaN / ±Inf)时不传该键;降级日志可grep;上传超时的
code=timeout与原因仍随通知文案出去(#171 不回归)。红验(把
sdk_kwargs["idle_timeout"]那一行改成and False):端到端
code=audio_too_long——服务端解码累计到 14400 秒(4 小时)硬上限就中断读取,报上来的样本数 230412800 刚好越过
14400×16000 = 230400000。该尺寸在本服务端上无论怎么调客户端超时都转不了,详见诊断文档第 4.1 / 第 6 节(需主脑决策)。
capswriter_done ... processed=13971.4s percent=99.8%,最大单帧等待 4.49 秒。验证
make test(pytest -q tests):exit 0PYTHONPATH=src uv run --frozen pytest tests -q -k "capswriter or deadline":exit 0python -m compileall:通过(本仓无 mypy/ruff 配置,CI 用外部 gate workflow)Fixes #181
Refs #170