Repository navigation
fix(coding-agent): read process start times in UTC so DST fall-back hours keep live holders (senpi#3067 L1) - #6118
Conversation
…ours keep live holders (senpi#3067 L1) Part of code-yeongyu#3067: L1 only. L2-L5 are untouched.
|
Thanks, @surlymochan. Reading process start times in UTC so the repeated hour at a DST fall-back doesn't make a live holder look dead is a subtle one to catch (#3067 L1). Queued for review; I'll post the result here. |
|
Thanks, @surlymochan. The review at
The first is worth a one-line wording fix in the changelog fragment if you're touching the branch again; the others can be follow-ups. This will be merged through the normal gate once its CI and receipt are in. |
|
Correction to my note above, @surlymochan: two of those "small notes" should land before merge, since they decide whether the fix is complete and proven:
The third note (the 3054 test) can stay a follow-up. Sorry for the mixed signal. |
|
Landed on main through the merge train #6840 (merge commit |
Summary
Fixes L1 of #3067 only (DST fall-back hour in the session-path holder lookup). L2–L5 are untouched, so this PR does not close #3067.
Root cause
holderPidsinhost-reservations.tsprobes the live process with the local-time form (readProcessStartTime), whilehost-child.pidrecords a UTC-tagged start time (#3054). During a DST fall-back the local time01:30happens twice andDate.parsetakes the earlier offset, so a child started in the repeated hour reads 1 hour off and stops counting as a holder of its sessions. The same mixed-format comparison existed in every otherreadProcessStartTimeconsumer (pidfile matching viaprocessMatchesPidFile, published session-path claims,rpc-public-keyrecords): all directreadProcessIdentitycall sites already pass"UTC", onlyreadProcessStartTimestill probed local.What changed
packages/coding-agent/src/utils/process-identity.ts:readProcessStartTimegains an optionaltimeZone: "UTC" = "UTC"parameter and passes it through toreadProcessIdentity, so every live-process start-time probe reads in UTC by construction. Legacy local-format records are still parsed as local time byprocessStartTimeMs; outside the ambiguous hour the parsed instants are identical, inside it they are exact instead of 1h off.packages/coding-agent/src/modes/rpc/host-reservations.ts: updated the now-stale comment that said the probe reads the local form.packages/coding-agent/test/suite/regressions/3054-utc-child-identity-holder.test.ts: the oldexpect(utc.identity).not.toBe(local)asserted the two forms differ; the probe now returns the UTC form too, so it asserts the two parse to the same instant instead.RED → GREEN
New regression
packages/coding-agent/test/suite/regressions/3067-dst-fallback-holder.test.ts(senpi#3067 L1):TZ=America/New_York,processStartTimeMs("Sun Nov 1 01:30:00 2026")is2026-11-01T05:30:00Zwhile the UTC form of the second-occurrence instant is06:30:00Z— exactly 3,600,000 ms apart,sameProcessStartMsisfalse. No live process can be started in a past hour, so the repeated-hour instant itself is covered here by parsing; the holder test covers the wiring under a simulated DST zone.expect(probe.endsWith(" UTC")).toBe(true), passes post-fix): under simulatedTZ=America/New_York, the probe of a live holder returns aUTC-tagged identity parsing to the same instant asreadProcessIdentity(..., "UTC"), a UTC-recorded child is found byholderPids, and a claim published bycreateSessionPathReservationscarries a UTC-taggedprocessStartTime.Tests
3067-dst-fallback-holder.test.ts(2),3054-utc-child-identity-holder.test.ts(1),test/suite/process-identity.test.ts(4) — 7 passed.readProcessStartTimeconsumer, 225 tests): 162 passed, 62 failed — all 62 failures are environmental, reproduced identically on unmodified baseline viagit stash对照:3054-supervisor-child-exit.test.ts: 11/11ENOSPC: System limit for number of file watchers reachedon baseline too.rpc-host-daemon-dir.test.ts: same 1 test (HostDaemonStateErrorexpectation) fails on baseline too.ENOSPCfile-watcher exhaustion,unsafe_key_record(supervisor refuses group-writable tmp dirs under this VM's umask0007), andstdin lifetime reopen unavailableon spawned supervisors. Two full targeted runs reproduce identical counts (13 files / 62 tests), i.e. deterministic environment failure, not a code regression.bun run check(oxlint, fmt, tsc, locks): exit 0.Out of scope
L2 (wall-clock steps /
/procticks), L3 (once-per-generation logging), L4 (recovery error chaining), L5 (shutdown-recovery test gaps) — left for follow-ups.Summary by cubic
Fixes DST fall-back hours dropping live session holders in the coding agent (L1 of #3067 only; L2–L5 untouched).
readProcessStartTimenow probes live processes in UTC by default, matching the UTC-tagged records written byhost-child.pid, so a child started in the ambiguous fall-back hour no longer reads one hour off and stops counting as a holder. A changelog fragment documents the fix.TZ=America/New_Yorkcovering the parsing trap, holder lookup throughholderPids, and UTC-tagged published claims.Written for commit 910ae77. Summary will update on new commits.