fix(coding-agent): read process start times in UTC so DST fall-back hours keep live holders (senpi#3067 L1)
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
holderPids in host-reservations.ts probes the live process with the local-time form (readProcessStartTime), while host-child.pid records a UTC-tagged start time (#3054). During a DST fall-back the local time 01:30 happens twice and Date.parse takes 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 other readProcessStartTime consumer (pidfile matching via processMatchesPidFile, published session-path claims, rpc-public-key records): all direct readProcessIdentity call sites already pass "UTC", only readProcessStartTime still 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):
- Parsing trap (passes pre/post fix, documents why): under
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. - Holder test (failed pre-fix at
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
- New + directly affected:
3067-dst-fallback-holder.test.ts(2),3054-utc-child-identity-holder.test.ts(1),test/suite/process-identity.test.ts(4) — 7 passed. - Targeted host suite (29 files covering every
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.- Remaining failures share the same signatures:
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 / /proc ticks), 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). readProcessStartTime now probes live processes in UTC by default, matching the UTC-tagged records written by host-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.
- Legacy local-format records still parse as local time, so behavior outside the repeated hour is unchanged.
- Updated the 3054 regression test to assert the probe and record parse to the same instant rather than different forms.
- Added a regression test under
TZ=America/New_Yorkcovering the parsing trap, holder lookup throughholderPids, and UTC-tagged published claims.