feat(todos): per-todo validation timeout overrides the 20s default - #3210
Merged
huangruiteng merged 1 commit intoAug 15, 2026
Merged
Conversation
The completion-validation gate ran every declared validation_command with a fixed 20s module constant. Add an optional per-todo --validation-timeout-seconds (set on todo add next to --validation-command, 1-29 so a timed-out validation still produces a typed receipt inside the 30s outer subprocess budget; the writer side rejects out-of-range values and timeouts declared without a command). The declared value flows through the todo metadata block into run_completion_validation_gate and replaces the constant in both the runner call and the timeout receipt summary. Todos without the field keep the 20s default and the no-command fast path unchanged.
huangruiteng
approved these changes
Aug 15, 2026
huangruiteng
left a comment
Owner
There was a problem hiding this comment.
评审结论:通过(Approve)
实现干净、边界合理:#3142 review 标记的第二个 P2 完成——todo add 新增 --validation-timeout-seconds(1–29,writer 侧强校验,声明 timeout 必须同时声明 validation_command),值持久化到 todo metadata 并流经 run_completion_validation_gate,替换 20s 模块常量;超时 receipt 的 summary 现在报告实际使用的声明值。无字段时保持 20s 默认,fast path 与隐私边界不变。
验证(exact head 3a0d1a870,独立 worktree,PR 实际 diff 7 文件 +130/−22):
pytest tests/control_plane/test_todo_completion_validation.py tests/canary/:30 passed(含 3 个新用例:1s 超时覆盖、30 越界拒绝、无 command 拒绝)git diff --check:无输出- 新参数导入与上限常量验证正常
- GitHub Actions:build / dependency-review 通过;pytest 正在运行(评审时 pending)
无阻塞问题。CI pytest 转绿后即可合并。
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.
Summary
Lands the second P2 flagged in the #3142 review: the completion-validation gate ran every declared
validation_commandwith a fixed 20s module constant, so tests could only exercise the timeout path by monkeypatching the constant.todo addaccepts an optional--validation-timeout-secondsalongside--validation-command. Range-checked to 1–29 at the writer side: a timed-out validation must still produce a typed receipt before the outer CLI/MCP subprocess budget (30s) kills the call. Declaring a timeout without a command is rejected._read_declared_validationintorun_completion_validation_gate, replacing the constant in both the runner call and the timeout receipt summary ("timed out after Ns"now reports the declared value).Verification
pytest tests/control_plane/test_todo_completion_validation.py— 10 passed (3 new: declared 1s timeout cuts off a sleeping command and reportsafter 1s; out-of-range 30 rejected; timeout-without-command rejected). The override test needs no monkeypatch — the declared value itself drives the timeout.pytest tests/canary/(incl. maintainability ratchet) — 20 passed;loopx/todos.pybaseline bumped 2165 → 2190 (honest bump for the new flag plumbing)mypy— the 4 pre-existingloopx/todos.pyerrors are identical to main; the new plumbing adds noneRefs #3142 (second P2 follow-up; the first, the module extraction, landed in #3209).