Skip to content

fix(runtime): report the Host clock from every ScheduledTask result - #5679

Merged
me2seeks merged 1 commit into
apache:mainfrom
me2seeks:fix/scheduled-task-clock-all-modes
Sep 24, 2026
Merged

me2seeks merged 1 commit into
apache:mainfrom
me2seeks:fix/scheduled-task-clock-all-modes

Conversation

@me2seeks

Copy link
Copy Markdown
Contributor

Summary

#5667 made ScheduledTask report the Host clock, and its description now promises that "Every result reports the current Host time and time zone." That promise holds for list and create only: pause, resume, delete, and the missing-id guard return without the clock, so 2 of the 5 modes match the description.

This appends the clock line to those 7 return paths, which makes the stated invariant true instead of narrowing the wording to the subset that currently complies. The alternative — rewriting the sentence to name list and create — was rejected because it turns the contract into a mode-dependent rule a model has to track, while extending coverage costs about 70 characters on three rarely used modes.

Refs #5667

Verification

  • node --test packages/runtime/dist/__tests__/scheduled-task-tools.test.js — 5 pass, 0 fail.
  • With the scheduled-task-tools.ts change reverted and the package rebuilt, the two new tests fail (2 of 5) and pass with it, so they cover the change rather than restating it.
  • node --test over the four @maka/runtime suites that reference ScheduledTask — 226 pass, 0 fail.
  • tsc -p packages/runtime/tsconfig.json with the build cache removed — 0 errors.
  • biome check on the two changed files — clean.
  • node scripts/asf-license-headers.mjs check — passes.

Not run: the full monorepo suite, and an end-to-end Desktop session. The tool output format changes by appending lines, and no test or consumer in the repository parses these strings; I checked that directly rather than inferring it.

Review focus

The one judgement call is extend-coverage versus narrow-wording, described under Summary. Three return paths that already carried the clock before #5667 — non-empty list, and create's missing-arguments and error branches — still have no exact assertion; covering them is a separate coverage gap, not part of this change.

AI use

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: Claude Code wrote the change and the tests. I reviewed the diff, ran the verification above, and removed a first-draft test that duplicated existing coverage. The commit carries a Generated-by: Claude Code trailer.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

@github-actions github-actions Bot added the effort/S Under 100 readable lines label Sep 24, 2026

@jackwener jackwener left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seat: kabi-opus-review-orchestrator. Review of exact head 5632b66008798e86be8f5c383448ecd052edfea7, based on 4d1e35898 (the #5667 merge), behind main by 0. COMMENT only.

This closes the P3 I raised on #5667. No P0–P2. 1×P3, which is a direct consequence of the fix and costs one sentence.

The invariant now actually holds

I counted the same way I did on #5667: 12 returns in impl, and now 12 carry clockLine() — previously 5. The seven that were missing (the missing-id guard, and both the failure and success returns of pause, resume and remove) all have it. The description's "Every result" is now true rather than aspirational.

I verified your mutation claim rather than taking it

You wrote that reverting scheduled-task-tools.ts makes two of five tests fail. I reproduced it: restored the file from origin/main, rebuilt @maka/runtime, re-ran.

  • On the PR: 5 pass, 0 fail.
  • Source reverted: 3 pass, 2 fail — exactly pause, resume, and delete report the Host clock on success and on failure and the missing-id guard also reports the Host clock.

So the two new tests fail for the right reason and pin this change rather than restating existing behaviour. The three that keep passing are the ones covering behaviour #5667 already shipped, which is what should happen.

I also checked the "no consumer parses these strings" claim independently. Grepping Paused , Resumed , Deleted scheduled task and No scheduled tasks across the repo outside this tool returns only unrelated identifiers (launchBarrierPaused, discoveryPaused), the CLI's unrelated Resumed session "..." for session resume, and this PR's own test file. Nothing parses the tool's output.

On extend-coverage versus narrow-wording

You flagged this as the judgement call. I'd have accepted either, and I think you picked the better one. Narrowing the sentence would have made the contract mode-dependent — a model would have to remember which of five modes carries the clock, and getting that wrong is silent. Making the invariant unconditional costs a handful of characters on three rarely used paths and removes the thing that has to be remembered. The reasoning you gave in the description is the reasoning I'd want to see.

P3 — the fix makes half the description obsolete

The description still ends:

Every result reports the current Host time and time zone; call mode=list first when you need it to compute runAt or startAt.

That second clause was written as a mitigation for exactly the gap this PR closes. Now that every mode reports the clock, it advises an extra tool round trip that buys nothing — a model following it will call list before a create it could have issued directly. Same class of defect as the original finding, just pointing the other way: the prose no longer matches the code. Deleting the clause looks sufficient.

未验证

CI is not terminal on this head — label is green but test had not concluded when I checked, so nothing here rests on hosted CI. I ran only the scheduled-task-tools suite plus the mutation; I did not run the four ScheduledTask-referencing suites or the full monorepo, both of which your description reports passing. No Electron, no end-to-end Desktop session.

Your own note that three pre-existing paths — non-empty list, and create's missing-arguments and error branches — still lack exact assertions is accurate; the list test asserts only the empty case. Agreed that it is a separate gap and not this PR's job.

简体中文

评审绑定 exact head 5632b66008798e86be8f5c383448ecd052edfea7,基于 4d1e35898(#5667 的合并提交),落后 main 0。仅 COMMENT。

这条关掉了我在 #5667 上提的那个 P3。无 P0–P2,1×P3 —— 而且那条 P3 正是本修复的直接副产物,改一句话即可。

不变量现在真的成立了。 我用和 #5667 上同样的方法数:impl 里 12 条 return,现在 12 条都带 clockLine()(之前是 5 条)。缺的那 7 条(缺 id 的守卫,以及 pause/resume/remove 各自的失败与成功)都补上了。描述里的「Every result」从愿望变成了事实。

你那条突变验证,我没有采信,而是自己复现了一遍。 你说把 scheduled-task-tools.ts 还原会让 5 条测试里挂 2 条。我从 origin/main 还原该文件、重建 @maka/runtime、重跑:PR 原样 5 通过 0 失败;还原后 3 通过 2 失败,挂的正是 pause, resume, and delete report the Host clock on success and on failure 与 the missing-id guard also reports the Host clock。所以那两条新测试是因为对的原因失败的,钉的是本次改动而不是复述既有行为;仍然通过的 3 条覆盖的是 #5667 已经交付的行为,本该如此。

「没有消费方解析这些字符串」这条我也独立查了:在本工具之外全仓 grep Paused 、Resumed 、Deleted scheduled task、No scheduled tasks,只命中无关标识符(launchBarrierPaused、discoveryPaused)、CLI 里与此无关的会话恢复文案 Resumed session "...",以及本 PR 自己的测试文件。没有任何消费方解析该工具输出。

关于「扩大覆盖」与「收窄文案」的取舍:你把它标成了唯一的判断题。两种我都能接受,而且我认为你选的这个更好。 收窄文案会把契约变成依赖 mode 的规则 —— 模型得记住五个 mode 里哪些带时钟,而记错是静默的。把不变量做成无条件的,代价只是三个低频分支上的几十个字符,却消掉了那件需要记住的事。你在描述里给的理由,正是我希望看到的那种理由。

P3 —— 这个修复让描述的后半句过时了。 描述结尾仍是:「…… call mode=list first when you need it to compute runAt or startAt.」那半句当初正是为了缓解本 PR 现在已经消除的那个缺口而写的。 既然每个 mode 都报时钟,它就在建议一次白跑的工具往返 —— 模型照做会在本可以直接 create 之前先调一次 list。和原来那条是同一类缺陷,只是方向反过来:文案和代码又不一致了。 删掉那半句应该就够。

未验证:该 head 上 CI 未终态 —— label 绿,但我查的时候 test 还没出结论,所以本评审不依赖 hosted CI。我只跑了 scheduled-task-tools 套件加那次突变;你描述里提到的四个引用 ScheduledTask 的套件与全仓套件我都没跑。无 Electron、无端到端 Desktop 会话。

你自己记下的那条「三个既有路径(非空 list、create 的缺参与错误分支)仍无精确断言」属实 —— list 那条测试只断言了空列表的情况。同意它是另一个覆盖缺口,不属于本 PR 的职责。


Automated review notice: This comment was posted by an automated review agent operated by jackwener. It is not an independent human review and does not replace one.

@jackwener jackwener left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seat: kabi-opus-review-orchestrator — approving at 5632b66008798e86be8f5c383448ecd052edfea7, at the author's request, on no P0–P2 and terminal green CI (test and label both SUCCESS/COMPLETED at this exact head, re-checked immediately before approving; test had still been running when I posted my review).

The substance is in my review above. Briefly: all 12 returns in impl now carry clockLine(), up from 5, so the description's "Every result" is true rather than aspirational; I reproduced the author's mutation check independently (reverting the source makes exactly 2 of 5 tests fail, and they are the two new ones); and nothing in the repository parses these output strings.

The approval does not close the P3. The description still ends with "call mode=list first when you need it to compute runAt or startAt" — advice written to mitigate the very gap this PR removes, which now costs a wasted round trip. Deleting that clause looks sufficient. It is non-blocking, and it is still open.

What this approval is bound to: the SHA above and nothing else. If the head moves, this approval does not describe the new code and should not be treated as covering it.

简体中文

批准绑定 5632b66008798e86be8f5c383448ecd052edfea7,依作者请求,依据是无 P0–P2 且该 exact head 上 CI 终态全绿(test 与 label 均 SUCCESS/COMPLETED,批准前重新核过 —— 我发评审时 test 还在跑)。

实质内容见上面那份评审:impl 里 12 条 return 现在全部带 clockLine()(原为 5 条),描述里的「Every result」从愿望变成事实;作者的突变验证我独立复现过(还原源码后恰好 5 条里挂 2 条,且正是那两条新测试);全仓没有任何消费方解析这些输出字符串。

批准不关闭那条 P3。 描述结尾仍是「call mode=list first when you need it to compute runAt or startAt」—— 这句当初是为了缓解本 PR 已经消除的那个缺口而写的,现在只会换来一次白跑的往返。删掉那半句应该就够。不阻塞,但仍然开着。

这条批准绑的是上面那个 SHA,仅此而已。 head 一旦移动,它就不描述新代码,也不应被当作覆盖了新代码。


Automated review notice: This comment was posted by an automated review agent operated by jackwener. It is not an independent human review and does not replace one.

apache#5667's description promises "Every result reports the current Host time
and time zone", but only `list` and `create` carry the clock line;
`pause`, `resume`, `delete`, and the missing-id guard do not. The three
modes that skip it have no use for a clock: none accepts a time input
and none leads to computing runAt or startAt, so the next line of the
same description already points every path that needs the clock at
mode=list.

Narrow the sentence to what the implementation actually does instead of
adding output no path consumes: "Only the list and create results
report the current Host time and time zone."

Generated-by: Claude Code
@me2seeks
me2seeks force-pushed the fix/scheduled-task-clock-all-modes branch from 5632b66 to 098dd89 Compare September 24, 2026 07:45
@jackwener

Copy link
Copy Markdown
Member

stale-approval-notice approved=5632b66008798e86be8f5c383448ecd052edfea7 head=098dd89c5a2570492e3dcbd755b4dd75582e220e seat=kabi-opus

My approval no longer covers this pull request, and this is a stronger case than ordinary head drift: the change was reversed, not amended.

I approved 5632b66008798e86be8f5c383448ecd052edfea7. The head is now 098dd89c5a2570492e3dcbd755b4dd75582e220e. GitHub still shows this pull request as APPROVED, and that green state is currently attached to an implementation that no longer exists.

What changed between those two commits:

  • 098dd89c reverts the clock from all seven paths it had added — the missing-id guard and both branches of pause, resume and remove. clockLine() coverage goes from 12 of 12 returns back to 5 of 12.
  • The description flips from "Every result reports the current Host time and time zone" to "Only the list and create results report the current Host time and time zone".

That is the narrow-wording option instead of the extend-coverage one. I said in my review that I would have accepted either, and I still would — the new wording is accurate, and the trailing "call mode=list first" clause becomes correct again rather than obsolete, which also resolves the P3 I raised. So I have no objection to the direction.

But nothing I verified still applies. My approval rested on three checks, and the reversal invalidates all three:

  1. "12 of 12 returns carry the clock" — now 5 of 12 again, by design.
  2. The mutation check I reproduced (reverting the source made exactly 2 of 5 tests fail, and they were the two new ones) — the test file has since shrunk by roughly 60 lines, so those assertions appear to be gone. I have not re-run anything against this head.
  3. Terminal green CI — test is pending again on the new commit.

Two things for whoever merges this. First, this approval should not be counted toward the merge gate; it describes the opposite change. Second, the pull request body still argues for extend-coverage and states that narrow-wording "was rejected because it turns the contract into a mode-dependent rule a model has to track" — the description now argues against the code it accompanies, and that reasoning was the main thing a reviewer was asked to weigh.

I am not dismissing my own approval, since revoking one moves a merge gate and that is a human's call. Re-reviewing the new head on request.

简体中文

我的批准已不覆盖本 PR,而且这比普通的 head 漂移更严重:这次是改动被反转了,不是被修补。

我批的是 5632b66008798e86be8f5c383448ecd052edfea7,当前 head 是 098dd89c5a2570492e3dcbd755b4dd75582e220e。GitHub 仍然把本 PR 显示为 APPROVED,而那个绿色状态现在挂在一份已经不存在的实现上。

两个提交之间发生了什么:098dd89c 把此前补上的七条路径的时钟又全部撤掉了(缺 id 的守卫,以及 pause/resume/remove 各自的两个分支),clockLine() 覆盖从 12/12 退回 5/12;描述也从「Every result reports the current Host time and time zone」改成了「Only the list and create results report the current Host time and time zone」。

这就是「收窄文案」而不是「扩大覆盖」那个选项。我在评审里说过两种我都能接受,现在依然如此 —— 新文案是准确的,而且结尾那句「call mode=list first」也随之重新成立,不再过时,我提的那条 P3 因此也解决了。所以我对方向没有异议。

但我验过的东西没有一条还成立。 我的批准建立在三项检查上,反转让三项全部失效:①「12 条 return 全部带时钟」—— 现在按设计退回 5/12;②我复现过的突变验证(还原源码后 5 条挂 2 条,且正是那两条新测试)—— 测试文件此后少了约 60 行,那些断言看来已被移除,我没有对新 head 重跑任何东西;③CI 终态绿 —— 新提交上 test 又在跑了。

给合并者两点:第一,这条批准不应计入合并门禁,它描述的是相反的改动。第二,PR 正文仍在论证「扩大覆盖」,并写明「收窄文案」被否决,理由是「它会把契约变成模型必须记住的、依赖 mode 的规则」—— 现在正文是在反对它自己所附带的代码,而那段论证恰恰是当初请评审者权衡的核心。

我不会自行撤销批准 —— 撤销会移动合并门禁,那是人类的决定。需要的话我重审新 head。


Automated review notice: This comment was posted by an automated review agent operated by jackwener. It is not an independent human review and does not replace one.

@me2seeks
me2seeks merged commit 276faf1 into apache:main Sep 24, 2026
1 check passed
@jackwener

Copy link
Copy Markdown
Member

Seat: kabi-opus-review-orchestrator — post-merge close-out.

Merged at 098dd89c5a2570492e3dcbd755b4dd75582e220e. My approval was bound to 5632b66008798e86be8f5c383448ecd052edfea7, so this merged with the only approval on it not covering the merged code — and that approval described the opposite implementation. I flagged it two minutes before the merge; recording the outcome rather than leaving the flag as the last word.

The merged result is correct, and I checked it rather than assuming. On origin/main: 12 returns in impl, 5 carry clockLine() — exactly list (both cases) and create (all three), which is precisely what the new sentence claims. The description and the code now agree, and the trailing "call mode=list first" advice is accurate again. The P3 I raised on #5667 is closed, by narrowing rather than extending.

The final rationale is better than the one I reviewed. The squash commit says the three skipped modes "have no use for a clock: none accepts a time input and none leads to computing runAt or startAt." That is a stronger argument for narrowing than the PR body's original case for extending, and it is not the argument I was weighing when I approved. Git history reads correctly.

One leftover, cosmetic: the pull request body still argues for extend-coverage and states narrow-wording "was rejected." That now contradicts both the merged code and the commit message. It does not affect main — the commit message is the one that matters and it is right — but anyone reading this page later will find the description arguing against the change it accompanies.

Why I am spelling out the approval mismatch on a PR that turned out fine: earlier today I reported that a substantial share of recently merged pull requests here carry approvals that do not cover the merged SHA, and asked someone with admin to check whether stale approvals are dismissed on push. This is that pattern, start to finish, with my own approval as the instance — approved 07:17, head reversed 07:53, merged 07:57. The outcome was good; the gate still did not do what its green state implied.

简体中文

合并在 098dd89c5a2570492e3dcbd755b4dd75582e220e。我的批准绑的是 5632b66008798e86be8f5c383448ecd052edfea7 —— 所以本单合并时,唯一的那条批准并不覆盖被合并的代码,而且它描述的是相反的实现。我在合并前两分钟贴了标注;这里记录结果,不让那条标注停在最后。

合并结果是对的,这点我核过而不是假设:origin/main 上 impl 共 12 条 return,5 条带 clockLine(),正好是 list(两种情况)与 create(三条分支)—— 与新那句话的声明完全一致。描述与代码现在吻合,结尾「call mode=list first」也重新准确。我在 #5667 上提的那条 P3 就此关闭,方式是收窄而非扩大。

最终的理由比我评审时看到的那个更好。 squash 提交里写:被跳过的那三个 mode「没有用时钟的场景:它们都不接受时间输入,也都不会导向计算 runAt 或 startAt」。这比 PR 正文当初支持「扩大覆盖」的论证更有力,而且不是我批准时权衡的那个论证。git 历史读起来是对的。

一处遗留,属于记录层面:PR 正文至今仍在论证 extend-coverage 并写明 narrow-wording「被否决」。它现在同时与合并的代码和提交信息矛盾。不影响 main(起作用的是提交信息,而它是对的),但将来翻到这个页面的人,会看到描述在反对它所附带的改动。

为什么一单结果没问题我还要把批准错配讲清楚:今天早些时候我报过,本仓库近期合并的 PR 中有相当比例,其批准并不覆盖被合并的 SHA,并请有 admin 的人确认「push 后是否作废旧批准」。这一单就是那个模式的完整一例,而且样本是我自己的批准 —— 07:17 批准,07:53 改动反转,07:57 合并。结果是好的;但门禁并没有做到它那个绿色状态所暗示的事。


Automated review notice: This comment was posted by an automated review agent operated by jackwener. It is not an independent human review and does not replace one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

effort/S Under 100 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants