DeepTutor icon indicating copy to clipboard operation
DeepTutor copied to clipboard

[Bug] 书籍动画修复在持续输出时触发 180 秒整体超时,单章重试沿用上一次整书计时

Open mocias opened this issue 2 weeks ago • 1 comments

This was generated by AI during triage.

问题描述

书籍中的动画内容块进入代码修复阶段后,即使模型仍在持续输出推理,也会在固定 180 秒后被取消:

animation generation failed: Code repair attempt #1 timed out after 180s.

这个独立的整体修复时限没有接入运行时设置,也没有在动画设置中明确呈现。用户无法通过产品配置调整它。这里不是声称已有同名设置失效;max_tokens 是输出预算,不能当作超时秒数,也不会改变该限制。

已确认的代码路径

基于 v1.7.3 / 4c1e000d8563c5ac3b231baaaf149dc4dc4d2406:

  • retry_manager.py 默认 repair_timeout_seconds=180.0,通过 asyncio.wait_for 限制整个修复调用。
  • pipeline.py 创建 CodeRetryManager 时未从配置传入这个值。
  • 这是整体截止时间,不是“连续 180 秒未收到数据”的空闲超时。

实际复现

  1. 在 Windows 桌面版中生成带 animation 内容块的书籍,使用长推理模型。
  2. 生成的动画被渲染前布局检查拦下,进入代码修复。
  3. 模型持续返回推理,但在 180 秒内尚未给出最终代码。
  4. 修复调用被本地时限取消,动画块失败。

一次使用相同动画输入、写入独立诊断目录的复现记录:

  • 布局检查发现 4 处线条穿过文字,触发 repair attempt #1。
  • 修复开始时间为诊断运行的 747.83 秒,失败时间为 927.83 秒,间隔恰好 180 秒。
  • 截止时已收到约 39,112 个流式字符,仍在推理段,最终代码正文为 0 字符。
  • 修复与主代码生成共用 Qoder auto;没有独立的任务模型生效,输出预算为 65,536 token。
  • 安装动画依赖后已通过中文、公式及 MP4 渲染自检,因此该次失败不是缺少 Manim/LaTeX/FFmpeg。
  • 后续桌面日志在北京时间 2026-11-18 00:08:34 和 00:10:33 再次记录相同的 180 秒错误。

诊断没有写回书籍,前后比较确认原书 65 个内容块未变化。以上流式统计不包含在此公开原始推理内容。

预期行为 / 最小修复方向

  • 为动画代码修复暴露明确的“整体超时(秒)”设置,并将其贯通到 CodeRetryManager。
  • 新修复调用读取生效配置;已经运行中的调用保持其启动时的设置。
  • 在超时错误中说明失败阶段、实际生效秒数,以及这是本地整体时限。
  • 保留有界执行;无需自动增加时限、无限重试或静默切换模型。
  • 用可控的模拟修复协程验证:非默认时限确实传入并生效,取消仍正常工作。

增加时间只能解决限制不可配置的问题,不保证有布局错误的代码最终修复成功。

环境与相关报告

  • Open DeepTutor v1.7.3,Windows 桌面版。
  • Qoder CN auto,通过本地新增提供方适配器接入;动画修复时限的生产实现未修改。
  • 模块:Book / Math Animator / Runtime Settings。
  • 尚未在本地修复本 issue。
  • #1547(已关闭):推理耗尽 token 预算;本报告是本地整体时间限制,不能通过增加 token 预算解决。
  • #1545(已关闭):代码生成解析错误的诊断信息不足;本报告聚焦修复时限的配置接线。

单章重试沿用上一次整书编写的计时

同一章重试时还观察到一个独立的界面问题。顶部已经显示正在编写的章节名称,但旁边的已用时间仍从上一次整书编写开始计算。观察计时只需启动一次单章重试,无需等待动画修复超时。

复现步骤

  1. 在 Windows 桌面版 1.7.3 开始或恢复整书编写,记下开始时间。等这轮结束,并保留一个可以重新生成的章节。本例中该章已有 9/10 个内容块就绪。
  2. 隔一段明显可辨的时间,打开这本书,只对该章点击“强制重新生成”,记下本次操作时间。
  3. 在该章生成期间观察顶部章节名称和计时。刷新页面后,可再次核对计时是否仍对应同一次章节重试。

实际现象。 本次记录使用北京时间。整书上一次恢复编写是在 2026-11-17 23:58:25,单章重试开始于 2026-11-18 23:45:12。重试约一分钟时,顶部已经显示正确的章节名,计时却是 23:46:47,与上一次整书编写以来的经过时间吻合。

预期行为。 单章重试从该次重试开始计时,刷新或重新打开页面后仍使用相同的开始时间。整书编写继续使用整书任务的开始时间。

原版代码位置(4c1e000)

本地验证。 给单页编译记录开始时间,并通过开始事件和持久化页面数据提供给前端后,单章重试和刷新页面都能使用本轮时间。相关的 #2762 记录了同一次整书生成在切换页面后计时归零的情形,此处的复现涉及先后两轮不同的任务。

mocias avatar Nov 17 '26 16:11 mocias

I'd like to take this one. Confirmed on dev@4c1e000d8: CodeRetryManager already accepts repair_timeout_seconds (default 180.0), but MathAnimatorPipeline.run_render builds it without passing a configured value (pipeline.py:239), so the deadline is unreachable from settings. All three callers are affected — the math_animator capability, the visualize Manim route, and the book AnimationGenerator.

Narrow plan (backend only):

  • Lift the repair deadline into a runtime knob (capabilities.math_animator.repair_timeout in main.yaml), read through capabilities_settings.py via a getter — same precedent as research.researching.tool_timeout and get_visualize_params (#1546).
  • Read it once in run_render and pass it to CodeRetryManager, so every caller (including books) honors it and an in-flight render keeps its startup value.
  • Clarify the repair-timeout error to name the stage, the effective seconds, and that it is a local overall deadline rather than a provider connection failure.
  • Keep execution bounded: no auto-extension, infinite retries, or silent model switching.

Tests: a controlled mock repair coroutine asserting a non-default timeout is passed through and enforced (cancellation still works), plus the settings round-trip/clamp. I'll leave the failure-stage diagnostics and artifact retention to the companion #2768, and the Settings-form field (frontend) to a follow-up.

Does this direction look right? Happy to move the knob under visualize instead if you prefer.

ZQR1101 avatar Nov 18 '26 16:11 ZQR1101