AI

工单写每天上午 9 点对账,代理写的 cron 在下午 5 点跑了(中英切换)

This post is currently available in Chinese only. The original text follows.Open the Chinese page →

三人、七台电脑。1 到 3 号机跑编码代理,4、5 号机审查,6 号机做 Windows 验证,7 号机负责合入。工单写得很具体:每天上午 9 点,Asia/Shanghai,跑日切对账。对账范围和鉴权不要动。时间按上海本地墙上时钟,不是 UTC。

这篇要核对的,不是任务还在不在。超时修复把夜间任务一起删掉了写的是任务本身从工作流里消失。今天这份对账任务还在 YAML 里,问题是它什么时候跑。4 号机如果只看见注释里的「每天上午 9 点」,和工单上同一个「9」,很容易放行。GitHub Actions 的 schedule 在省略 timezone 时仍默认 UTC,09:00 UTC 在上海是下午 5 点。

4、5 号机平时看 diff 的时间很短。YAML 里最抢眼的是那个 9,注释又把「每天上午 9 点」写在同一行,工单原文几乎被复述了一遍。审查如果只问「这是不是每天 9 点」,答案看起来是肯定的。真正要问的是:这个 9 在哪个时钟上。GitHub 的默认回答是 UTC。在上海,这不是晚几分钟的问题,是错到了下午。对账任务如果在 17:00 跑,日切窗口已经过了,报出来的数字会对不上早班同事心里的「上午账」。更麻烦的是,任务本身会成功:工作流是绿的,日志里可以写 reconcile would run,没有人会被一个失败的检查叫醒。错的是时刻,不是退出码。

实验是我按常见的代理写法准备的夹具提交,并没有再开一个编码模型来生成这些 diff。所谓代理动作,就是把工单里的小时 9 抄进 cron: '0 9 * * *',再在同一行写上注释「每天上午 9 点跑对账」。machine-2-agent 是夹具身份,不是真人。实验室仓库是公开的 iotxing-lab-cron-timezone-20261126,一开始就建成公开库,是为了让规则集真正生效。种子提交 36ba251,naive 夹具 5ef7c39。本地运行环境是 git 2.47.3、Python 3.13.5;Actions 上的 Python 是 3.13.18,git 是 2.56.1。Windows 没有参与。没有使用 --admin。也没有等待真实的 schedule 触发:下面给出的下次运行时间,都是用 Python 标准库 zoneinfo,从冻结时钟 2026-11-26 08:00:00+08:00(即 2026-11-26 00:00:00Z)算出来的,不要把它读成「GitHub 已经在 17:00 上海跑过一次」。

工单要上海上午 9 点对账,抄进 Actions 的 cron 会在下午 5 点跑

种子提交里还没有对账工作流,只有闸门任务 cron-timezone-gate。工单写在 TICKET.md。夹具提交只加了 .github/workflows/reconcile.yml,12 行。cron 是 '0 9 * * *',注释是「每天上午 9 点跑对账」,没有 timezone 字段。

我先跑了一组浅层测试:YAML 里有 schedule 和 cron,cron 是 5 段,注释里含有「9 点」。3 个测试全部通过。这就是会放行的那条路,也是这次失败的做法。数字 9 在工单、cron 和注释里对得上,测试也就绿了。它没有问这个 9 是哪个时区的 9 点。这和验签测试写进了 PR,CI 的 pytest -q 只显示 3 passed里那种「测试看起来全绿」相近,但不是同一层:那里是收集阶段跳过了用例、退出码仍是 0;这里的测试真的跑完了,只是检查的是注释里的数字,不是调度真正的时刻。

用同一份冻结时钟算下次运行。naive 的 cron 按 UTC 解释,下一次是 2026-11-26 09:00:00Z,也就是上海 17:00、America/Fortaleza 06:00。工单要的 09:00 Asia/Shanghai,下一次应是 2026-11-26 01:00:00Z,上海 09:00;在 Fortaleza 则已经是前一个日历日的 2026-11-25 22:00。官方修法是保留 cron: '0 9 * * *',同时写上 timezone: Asia/Shanghai,算出来的三次运行与工单一致。Asia/Shanghai 全年 UTC+8,没有夏令时;America/Fortaleza 全年 UTC-3,巴西已经取消夏令时,不要把它写成会调钟的时区。这些换算都用 zoneinfo 核对过,不是按口算时差写上去的。

实验室同时列出 America/Fortaleza,不是为了把一张表做长。同一瞬间,工单要的上海 09:00 在 Fortaleza 已经是前一天晚上 22:00。一个团队如果有人在巴西、有人在上海,都看着「明天 9 点」说话,指的根本不是同一个日历日。naive cron 则把这次运行放到 Fortaleza 的当天 06:00。两种错法都不会在 YAML 里用红字标出来,只能靠把下次运行打印成带时区的时间戳,审查才能看见。

如果 4 号机「知道 cron 默认是 UTC」,把表达式改成 '0 1 * * *',不写 timezone,也不留注释,在这个冻结时钟上,下一次运行恰好等于工单要的 09:00 上海。看起来审查已经做对了。问题是这种换算只写在小时字段里,没有把时区钉住。我写了一个确定性脚本 tools/hour_copy.py,不是语言模型:它从工单里读出第一个「N 点」,把工作流里 cron 的小时改成 N,并不写 timezone。在审查提交 aaa024c 上跑完,脚本报告「ticket clock is 09:00」「patched 1 cron line」,cron 从 '0 1 * * *' 变回 '0 9 * * *',新提交是 bcb06c0。下次运行又回到上海 17:00。所以「审查时换算成 UTC」可以解这一次,挡不住下一次仍按工单抄小时的代理。

有人会说:那把换算写进审查清单,禁止再改小时。这在只有人类提交的仓库里或许能撑一段时间。今天的前提是 1 到 3 号机高频跑编码代理,工单仍写「每天上午 9 点」,下一次补丁仍可能从工单抄小时。hour_copy.py 只是把这种抄法收成确定性脚本,用来证明它不需要「模型又聪明了一点」才会发生。要让换算留下,就得把时区写成字段。如果这个任务确实要按 UTC 跑,正确的写法也不是省略字段,而是明确写 timezone: UTC。闸门接受任何合法 IANA 名,包括 UTC;它拒绝的是缺省。2026 年 3 月以后,审查如果还停留在「把本地小时换算成 UTC 就结束了」,会漏掉官方已经提供的字段。那个字段的意义,正是让工单里的本地小时可以安全地抄进 cron,而不必把换算结果藏进第二个字段。

闸门 tools/cron_timezone_gate.py 用标准库解析 on.schedule,失败则关闭。规则是:每条 schedule 必须带合法的 IANA timezone(zoneinfo 能接受);打印接下来 3 次运行,同时给出 UTC、上海和 Fortaleza;如果邻近注释里同时出现了钟点和时区,再核对下次运行是否一致;只写「9 点」、不写时区的注释不参与这项核对,避免一条普通注释就误报。没有 schedule 的工作流直接放行,退出码 0。

这套闸门不适合当唯一的调度真相来源。它不向 GitHub 查询「上次 schedule 有没有跑过」,也不保证 Actions 在整点后几分钟内一定启动。它只回答一个更窄的问题:这份 YAML 有没有把时区写清楚,以及按文档和 zoneinfo 的规则,下一次时刻会落在哪里。没有 schedule 的工作流被忽略,是为了不把普通的 pull_request 工作流误杀。可选的注释核对只在「钟点 + 时区」同时出现时才出手,是为了不要让一句「9 点跑对账」变成脆弱的失败。代价也很清楚:如果有人写了互相矛盾的注释和字段,闸门会红;如果有人只写注释、不写字段,本来就会因为缺 timezone 被拒绝,不必再靠注释救命。7 号机的职责如果只是「必检全绿才能合」,那必检就要把「17:00 上海」这种结果打到检查日志里,而不能只让一个绿勾代表「YAML 能解析」。

本地结果对得上设计。naive 被拒绝,并打印出 17:00 上海。官方修法被允许,打印 09:00 上海。未注释的 '0 1 * * *' 同样被拒绝——这正是要点:即便当前换算是对的,没有 timezone 仍不能过。把闸门接到 pull_request 上,在真实 GitHub Actions 里跑了一遍。规则集 protect-main(id 28158001)把必检设成 cron-timezone-gate,bypass 列表为空,接口返回的 current_user_can_bypass 是 never。

从冻结时钟算,naive cron 下一次是上海 17:00;未注释的 UTC 换算也会被闸门拒绝

PR #1 是 naive 夹具 5ef7c39。运行 45806496108 里,闸门在 reconcile.yml 第 6 行写出 REFUSE:timezone=<missing, defaults to UTC>,并给出下次运行 17:00 上海。检查 conclusion 是 FAILURE,mergeStateStatus 是 BLOCKED。执行 gh pr merge --squash 得到的返回是:the base branch policy prohibits the merge。规则集在这一步是有效的。

PR #2 是审查换算 aaa024c。运行 45806505134 同样 FAILURE。日志里下次运行已是 09:00 上海,但因为没有 timezone 字段,闸门仍拒绝。合并同样被策略挡住。PR #3 是 hour_copy 之后的 bcb06c0,运行 45806516922 再次把下次运行打回 17:00 上海,合并仍被拒绝。这三个 PR 都保持打开,没有合入,也没有使用 --admin。

PR #4 写下 timezone: Asia/Shanghai,提交 d9a2509。运行 45806530939 里闸门写出 ALLOW,三次运行都是上海 09:00。检查是 SUCCESS,mergeStateStatus 是 CLEAN。未加 --admin,于 2026-11-26 11:02:29 UTC squash 合入 44d3464。合入后 main 上的推送运行 45806894919 也是 success。这些 Actions 运行核对的是闸门本身,不是 schedule 已经在 09:00 上海触发。6 号机的 Windows 验证帮不上这个忙:错的不是脚本在 Windows 上的行为,而是调度时刻,本次也没有在 Windows 或 Task Scheduler 上做对照。对账脚本自己的单元测试同样不会红,因为它不负责决定自己何时被拉起。11 月 23 日那种「任务被删掉」至少会在 YAML 的 diff 里留下一大段删除;今天这种「任务还在、时刻错了」,diff 甚至可能只有一个数字 9,看起来像在落实工单。

GitHub 在 2026 年 3 月 19 日的变更日志里,为 schedule 增加了正式的 IANA timezone 字段。官方工作流语法写明:默认仍是 UTC;若要按本地时间,就在 cron 旁边写 timezone。文档给的例子是 cron: '30 5 * * 1-5' 配上 timezone: "America/New_York"。缺了这个字段,注释里写「每天上午 9 点」改变不了默认值。

关于夏令时,官方写的是:对观察 DST 的时区,春季调快时落在被跳过小时里的调度,会推进到下一个有效时刻,例子是 2:30 AM 变成 3:00 AM。这不是这次实验室里 GitHub 真的跑出来的,是按文档规则用 zoneinfo 算的。2026 年美国春季调时是周日 3 月 8 日。cron: '30 2 * * *'、timezone: America/New_York,从当天 00:00 起算,02:30 不存在,下一次有效本地时间是 03:00 EDT,也就是 07:00Z;之后两天回到普通的 02:30 EDT。秋季回调那个重复的小时,这次没有做现场验证,也不代官方立规则。上海没有夏令时,把 09:00 上海换算成 01:00 UTC,全年都成立;对会调钟的时区,只改小时、不声明时区,春季和秋季还可能各错一次。

同一类时区默认也出现在别的调度工具里,但这不是本次主实验,只作对照。Claude Code 云端定时任务的文档写明:只有五段的 cron 按 UTC 写小时,所以 0 9 * * 1-5 是工作日 09:00 UTC;若字段以 CRON_TZ= 开头,就按那个时区写,或者删掉前缀改回 UTC。Issue #49991 里,作者按本地 9 点写了 0 9 * * *,在 UTC-5 的机器上清晨 4 点触发;维护者指出输入框下已标明 UTC,该 issue 随后关闭。问题不在「文档完全没写」,而在「9 点」这个数字太容易被当成本地时间。另一个方向的例子是 moadim-io/daemon#49:MCP 工具没写明 cron 走的是主机本地 crontab,代理按 UTC 减时差写了 0 8 * * *,结果比以色列本地 11 点早了三个小时。两种相反的默认,共同点是:只写五段 cron、不钉时区,代理和审查都可能把数字抄对、把时刻抄错。

必检不要看注释里有没有「9 点」,要看 schedule 是否声明了合法时区

闸门不该设在「注释里有没有 9 点」这种字符串检查上,那一组测试在 naive 提交上是全绿的。要把必检放在「每条 schedule 是否声明了合法 timezone」,并且把下次运行用明确的时区打印出来,让 4 号机看见的是 17:00 上海,而不是一个孤零零的 9。审查里把小时换算成 UTC 可以解一时,但解不了下一次 hour_copy。官方已经提供 timezone 字段,应当直接使用:保留工单里的本地小时,把时区写在字段里,而不是把换算结果藏进 cron 的第二个字段。把 cron_timezone_gate.py 放进仓库,在 pull_request 上跑,并把同名检查设为必检,是明天就可以做的一步。夹具、错误和正确的工作流样本,以及会把小时抄回去的演示脚本,都在配套的工具包里。

实际跑过的内容

  • 浅层测试在 naive 夹具上 3 passed。闸门单测 15 passed。本地环境 git 2.47.3、Python 3.13.5。
  • 冻结时钟 2026-11-26 08:00:00+08:00。naive '0 9 * * *'(默认 UTC)下次为 09:00Z / 上海 17:00 / Fortaleza 06:00。带 timezone: Asia/Shanghai 的 '0 9 * * *' 下次为 01:00Z / 上海 09:00 / Fortaleza 2026-11-25 22:00。审查换算 '0 1 * * *' 在这一刻与工单一致,仍因缺少 timezone 被拒绝。
  • hour_copy.py 在 aaa024c 上把 cron 小时从 1 改回 9,提交 bcb06c0,不写 timezone。
  • 实验室仓库 iotxing-lab-cron-timezone-20261126,规则集 28158001,必检 cron-timezone-gate,bypass 为空。种子 36ba251 的 运行 45806364988 为 success(Actions 上 Python 3.13.18)。
  • PR #1 5ef7c39、PR #2 aaa024c、PR #3 bcb06c0:闸门均为 FAILURE,合并被策略拒绝,PR 保持打开。PR #4 d9a2509 闸门 SUCCESS,11:02:29 UTC squash 合入 44d3464。
  • DST 计算:2026-03-08 周日,'30 2 * * *' 在 America/New_York 的 02:30 不存在,按官方规则推进到 03:00 EDT = 07:00Z。这是 zoneinfo 计算,不是现场 Actions 调度。

未跑:真实的 GitHub Actions schedule 触发,Windows 或 windows-latest,也没有在 Task Scheduler 上做对照。夹具提交不是现场跑编码模型得到的。秋季回调的重复小时没有做现场验证。官方说明见 Workflow syntax for GitHub Actions 的 on.schedule,以及 2026-03-19 的 Late March 2026 updates。可复制的脚本和夹具在 cron-timezone-kit.tar.gz。下一步就是把它放进自己的仓库,在 pull_request 上跑,并把同名检查设为必检。

Three people, seven computers. Machines 1 to 3 run coding agents, 4 and 5 review, 6 does Windows validation, and 7 merges. The ticket was specific: run the daily reconciliation at 9:00 a.m., Asia/Shanghai. Do not change the reconciliation window or the auth. The clock is Shanghai wall time, not UTC.

This post is not about whether the job still exists. The timeout fix also deleted the nightly job was about the job disappearing from the workflow. Today's job is still in the YAML. The question is when it runs. If machine 4 only sees the comment "每天上午 9 点" and the same 9 that is in the ticket, the change is easy to approve. A GitHub Actions schedule still defaults to UTC when timezone is omitted, and 09:00 UTC is 5:00 p.m. in Shanghai.

The commits are fixtures I wrote in the shape of a typical agent change. I did not start a coding model to produce the diff. The agent move is to copy the hour 9 from the ticket into cron: '0 9 * * *' and put "每天上午 9 点跑对账" in a comment on the same line. machine-2-agent is a fixture identity, not a real person. The lab repo is the public iotxing-lab-cron-timezone-20261126, created public from the start so a ruleset would actually apply. The seed commit is 36ba251, the naive fixture is 5ef7c39. Locally this ran on git 2.47.3 and Python 3.13.5; Actions used Python 3.13.18 and git 2.56.1. Windows was not involved. --admin was not used. I also did not wait for a live schedule to fire. The next-run times below were computed with Python's standard-library zoneinfo from a frozen clock, 2026-11-26 08:00:00+08:00 (2026-11-26 00:00:00Z). They are not a claim that GitHub already ran the job at 17:00 in Shanghai.

Machines 4 and 5 do not spend long on a workflow diff. The 9 is the number that stands out, and the comment restates the ticket on the same line. If the review question is only "is this every day at 9?", the answer looks like yes. The real question is which clock that 9 belongs to. GitHub's default answer is UTC. In Shanghai this is not a few minutes late; it is the afternoon. If reconciliation runs at 17:00, the cutoff window has already passed, and the numbers will not match what the morning shift thinks of as the morning ledger. The worse part is that the job itself succeeds. The workflow is green. The log can say reconcile would run. Nobody is woken by a failed check. The failure is the instant, not the exit code.

The ticket asked for 09:00 Shanghai. The cron the fixture wrote fires at 17:00

The seed commit has no reconcile workflow yet, only the gate job cron-timezone-gate. The ticket lives in TICKET.md. The fixture commit adds only .github/workflows/reconcile.yml, 12 lines. The cron is '0 9 * * *', the comment is "每天上午 9 点跑对账", and there is no timezone field.

I first ran a set of shallow tests: the YAML contains schedule and cron, the cron has five fields, and the comment contains "9 点". All three tests passed. That is the path that stays green, and the approach that failed. The digit 9 matches in the ticket, the cron, and the comment, so the tests stay green. They never ask which zone that 9 belongs to. This is related to the signature tests that were written into the PR while CI's pytest -q still showed 3 passed, but it is not the same layer. That case was tests skipped at collection with exit code 0. These tests really ran; they just checked the number in the comment, not the actual fire time.

From the same frozen clock, the naive cron is interpreted in UTC. The next fire is 2026-11-26 09:00:00Z, which is 17:00 in Shanghai and 06:00 in America/Fortaleza. The intended 09:00 Asia/Shanghai is 2026-11-26 01:00:00Z, 09:00 in Shanghai, and 2026-11-25 22:00 in Fortaleza — the previous calendar day. The official fix keeps cron: '0 9 * * *' and adds timezone: Asia/Shanghai; the next three fire times then match the ticket. Asia/Shanghai is UTC+8 year-round, with no DST. America/Fortaleza is UTC-3 year-round; Brazil has abolished DST, and it should not be described as a DST-observing zone. These conversions were checked with zoneinfo, not by subtracting hours by hand.

The table also lists America/Fortaleza for a reason other than length. At the same instant, the 09:00 Shanghai the ticket wants is already 22:00 on the previous evening in Fortaleza. If one person is in Brazil and another in Shanghai, and both say "tomorrow at 9", they are not talking about the same calendar day. The naive cron puts the run at 06:00 the same day in Fortaleza. Neither mistake is marked in red in the YAML. The only way a reviewer sees it is if the next fire is printed as a timestamp with an explicit zone.

If machine 4 "knows cron defaults to UTC" and rewrites the expression to '0 1 * * *', with no timezone and no comment, then at this frozen clock the next fire is exactly the 09:00 Shanghai the ticket asked for. The review looks right. The conversion, though, lives only in the hour field; the zone is not pinned. I wrote a deterministic helper, tools/hour_copy.py, not a language model. It reads the first "N 点" from the ticket, overwrites the cron hour, and does not write timezone. On the review commit aaa024c it reported "ticket clock is 09:00" and "patched 1 cron line". The cron went from '0 1 * * *' back to '0 9 * * *'. The new commit is bcb06c0. The next fire is 17:00 Shanghai again. Converting to UTC in review can fix this once. It does not survive the next agent that still copies the hour from the ticket.

Someone will say: put the conversion on the review checklist, and forbid further hour edits. That may hold for a while in a repo that only accepts human commits. The premise today is that machines 1 to 3 run coding agents at high frequency, the ticket still says 9:00 a.m., and the next patch can still copy the hour from the ticket. hour_copy.py only turns that copy into a deterministic script, to show that it does not take a smarter model for this to happen. If a conversion is going to last, the zone has to be a field. If the job really should run in UTC, the honest form is not to omit the field, but to write timezone: UTC. The gate accepts any valid IANA name, including UTC; what it refuses is the default. After March 2026, a review that stops at "I converted the local hour to UTC" misses the official field. That field exists so the local hour in the ticket can be copied into the cron safely, without hiding the conversion in the second field.

The gate, tools/cron_timezone_gate.py, parses on.schedule with the standard library and fails closed. Every schedule entry must declare a valid IANA timezone (zoneinfo must accept it). It prints the next three fire times in UTC, Shanghai, and Fortaleza. If a nearby comment names both a clock time and a zone, it also checks that the next fire matches. A comment that only says "9 点", with no zone, is ignored, so the check does not false-fail on every annotation. Workflows without schedule are ignored and exit 0.

This gate is not a complete source of truth for scheduling. It does not ask GitHub whether the last schedule already ran, and it does not promise that Actions will start in the first minute after the hour. It answers a narrower question: whether this YAML pins the zone, and where the next instant falls under the docs and zoneinfo. Workflows without schedule are ignored so an ordinary pull_request workflow is not failed by mistake. The optional comment check fires only when a clock time and a zone both appear, so a bare "run at 9" does not become a brittle failure. The trade-off is equally clear: a contradictory comment and field will fail the gate; a comment with no field already fails because timezone is missing, and does not need the comment as a last-ditch rescue. If machine 7's job is only "merge when the required checks are green", then the required check has to put "17:00 Shanghai" into the log, not let a green tick mean "the YAML parsed".

Locally the results match that design. The naive workflow is refused, and the log prints 17:00 Shanghai. The official fix is allowed, and the log prints 09:00 Shanghai. The unannotated '0 1 * * *' is also refused — that is the point. Even a currently correct UTC conversion is not acceptable without timezone. The gate was then run for real on GitHub Actions, on pull_request. The ruleset protect-main (id 28158001) requires the check cron-timezone-gate, the bypass list is empty, and current_user_can_bypass came back as never.

From a frozen clock, the naive cron next-fires at 17:00 Shanghai. An unannotated UTC conversion is also refused

PR #1 is the naive fixture 5ef7c39. In run 45806496108 the gate printed REFUSE on line 6 of reconcile.yml: timezone=<missing, defaults to UTC>, with the next fire at 17:00 Shanghai. The check conclusion was FAILURE, and mergeStateStatus was BLOCKED. gh pr merge --squash returned the base branch policy prohibits the merge. The ruleset was doing its job.

PR #2 is the review conversion aaa024c. Run 45806505134 was also FAILURE. The log already showed the next fire at 09:00 Shanghai, but the gate still refused it because timezone was missing. The merge was refused by policy as well. PR #3 is bcb06c0 after hour_copy. Run 45806516922 put the next fire back at 17:00 Shanghai, and the merge was refused again. All three PRs were left open and not merged. --admin was not used.

PR #4 declared timezone: Asia/Shanghai, at commit d9a2509. In run 45806530939 the gate printed ALLOW, and all three fire times were 09:00 Shanghai. The check was SUCCESS, and mergeStateStatus was CLEAN. It squash-merged at 2026-11-26 11:02:29 UTC as 44d3464, without --admin. The follow-up push run on main, 45806894919, was also success. Those Actions runs checked the gate. They are not evidence that the schedule has already fired at 09:00 Shanghai. Windows validation on machine 6 does not catch this: the bug is the fire time, not the script's behavior on Windows, and this lab did not run Windows or Task Scheduler. Unit tests for the reconciliation script itself will not go red either, because they do not decide when the script is launched. A deleted job, as in the 23 November post, at least leaves a large deletion in the YAML diff. A job that is still there, at the wrong time, may change only the digit 9, which looks like a faithful reading of the ticket.

GitHub added an official IANA timezone field on schedule entries in the changelog of 19 March 2026. The official workflow syntax says scheduled workflows still run in UTC by default, and that you can add timezone next to the cron for local time. The documented example is cron: '30 5 * * 1-5' with timezone: "America/New_York". Omitting the field is not fixed by a comment that says "every day at 9 a.m."

On DST, the official rule is: for zones that observe daylight saving time, schedules in the skipped spring-forward hour advance to the next valid time. The docs example is 2:30 AM advancing to 3:00 AM. That was not a live GitHub run in this lab. It is a zoneinfo computation following the documented rule. US spring-forward in 2026 is Sunday 8 March. For cron: '30 2 * * *' and timezone: America/New_York, starting from midnight that morning, 02:30 does not exist, and the next valid local time is 03:00 EDT, which is 07:00Z. The next two days return to an ordinary 02:30 EDT. The repeated hour in the fall-back was not tested live, and this post does not invent a GitHub rule for it. Shanghai has no DST, so converting 09:00 Shanghai to 01:00 UTC is valid all year. In a zone that does observe DST, changing only the hour and omitting timezone can be wrong once in spring and once in autumn.

The same class of timezone default shows up in other schedulers. That is supporting context, not the main experiment. Claude Code's documentation for cloud scheduled tasks says that when the expression is five fields alone, the hours are written in UTC, so 0 9 * * 1-5 runs at 9:00 AM UTC on weekdays; if the field opens with a CRON_TZ= prefix, keep it and write the hours in that zone, or delete it and write them in UTC. In issue #49991, the author wrote 0 9 * * * for a local 9 a.m. and the trigger fired at 4 a.m. on a UTC-5 machine. A maintainer pointed out that the UTC label is already under the cron input, and the issue was closed. The failure was not that the docs said nothing; it was that the digit 9 is too easy to read as local time. The other direction appears in moadim-io/daemon#49: the MCP tools did not say the cron ran in the host's local crontab, an agent subtracted the UTC offset and wrote 0 8 * * *, and the routine fired three hours earlier than 11:00 Israel time. Two opposite defaults, one shared shape: a five-field cron with no pinned zone lets an agent or a reviewer copy the number correctly and still get the instant wrong.

Do not require a comment that contains “9 点”. Require a valid IANA timezone on every schedule

The required check should not be a string test for "9 点" in a comment. Those tests stayed green on the naive commit. Put the required check on whether every schedule declares a valid timezone, and print the next fire in explicit zones, so machine 4 sees 17:00 Shanghai instead of a bare 9. Converting the hour to UTC in review can fix one patch and still lose to the next hour_copy. The official timezone field is the thing to use: keep the local hour from the ticket, and write the zone as a field, rather than hiding the conversion in the second cron field. Putting cron_timezone_gate.py in the repo, running it on pull_request, and making the same check required is a step that can be done tomorrow. The fixtures, the bad and good workflows, and the helper that copies the hour back are in the companion kit.

What was actually run

  • The shallow tests were 3 passed on the naive fixture. The gate unit tests were 15 passed. Locally: git 2.47.3, Python 3.13.5.
  • Frozen clock 2026-11-26 08:00:00+08:00. Naive '0 9 * * *' (UTC default) next-fires at 09:00Z / 17:00 Shanghai / 06:00 Fortaleza. '0 9 * * *' with timezone: Asia/Shanghai next-fires at 01:00Z / 09:00 Shanghai / 2026-11-25 22:00 Fortaleza. The review conversion '0 1 * * *' matches the ticket at this instant and is still refused without timezone.
  • hour_copy.py changed the cron hour from 1 back to 9 on aaa024c, producing bcb06c0, and did not write timezone.
  • Lab repo iotxing-lab-cron-timezone-20261126, ruleset 28158001, required check cron-timezone-gate, empty bypass list. Seed 36ba251 run 45806364988 succeeded (Python 3.13.18 on Actions).
  • PR #1 5ef7c39, PR #2 aaa024c, and PR #3 bcb06c0: the gate was FAILURE each time, the merge was refused by policy, and the PRs were left open. PR #4 d9a2509 was SUCCESS and squash-merged at 11:02:29 UTC as 44d3464.
  • DST computation: Sunday 2026-03-08, '30 2 * * *' at 02:30 America/New_York is nonexistent and, per the official rule, advances to 03:00 EDT = 07:00Z. This is a zoneinfo computation, not a live Actions schedule.

Not run: a live GitHub Actions schedule firing, Windows or windows-latest, and no Task Scheduler comparison. The fixture commits were not produced by a live coding model. The repeated hour on fall-back was not tested live. The official wording is in Workflow syntax for GitHub Actions under on.schedule, and in the 19 March 2026 Late March 2026 updates. The copyable scripts and fixtures are in cron-timezone-kit.tar.gz. The next step is to put the gate in your own repo, run it on pull_request, and make the same check required.