A recording that ends at its maxDurationSec cap never gets a durationSec

未关闭 适合新手
#344 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
82/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript
领域
backend, cli

调研方向

阅读 src/utils/recorder.ts 中 attachExitHandler 附近的代码,追踪结束的录制如何获得其时长;比较分段录制路径与普通文件路径。检查 src/tools/stopRecording.ts 和 src/cli.ts 如何使用 durationSec,然后运行 npm test。完成标准:达到上限的录制会通过 stop_recording 和 get_session 报告其时长,并且 CLI --last 会将 GIF 限制在请求的时间窗口内。

由索引模型根据 Issue 内容生成。

描述

bug effort: small priority: medium

Summary

When capture exits on its own (cap reached, window closed), attachExitHandler writes the end status but probes the file only for segmented recordings or ones with a webcam. An ordinary recording keeps durationSec undefined, so stop_recording returns durationSec: null and the CLI's --last window is lost.

Where

  • src/utils/recorder.ts:129-140 (attachExitHandler)
  • src/tools/stopRecording.ts:115 (durationSec: record.durationSec ?? null)
  • src/cli.ts:296-297, 512, 547, 642-656 (tailWindow(null, lastSec) returns {})

Impact

  • Agents calling stop_recording after the cap get a null duration, and get_session never shows one, although the tool promises "returns the path and duration".
  • screencast-mcp record -- <cmd> in the case it warns about (the run outlived the cap) makes the evidence GIF and the OCR error scan cover the whole recording (up to the cap) instead of the last --last seconds.

Steps to reproduce

  1. start_recording {"target":"region:0,0,64,64","maxDurationSec":2}, then wait 5 s.
  2. stop_recording returns {status:"stopped", endReason:"max_duration", durationSec:null}.

Suggested fix

On every unrequested exit that leaves a file, probe record.outputPath and patch durationSec (a small async finalizeEnded() that either joins segments or just probes). Alternatively, have stop_recording's not-active branch probe the file when durationSec is missing.

Acceptance criteria

  • A capped recording reports its duration from stop_recording and get_session.
  • CLI --last limits the GIF on a capped run.

Getting started

  • Relevant files: src/utils/recorder.ts, src/tools/stopRecording.ts, src/cli.ts
  • How to run tests: npm test

Filed by repo-audit/full-audit at b9b94fa. Severity: medium. Effort: S. audit-key: bug|src/utils/recorder.ts|attachExitHandler

主要语言
TypeScript
星标
1
派生
4
平均合并
14 小时 8 分钟
30 天内合并 PR
48

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

TMHSDigital/screencast-mcp 的其他 Issue

查看 TMHSDigital/screencast-mcp 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。