Commit 9c80698
committed
Normalize loop-start boundary into actual UTC
setup-rlcr-loop.sh creates loop dirs named YYYY-MM-DD_HH-MM-SS
with `date +%Y-%m-%d_%H-%M-%S` (no -u), so the basename is local
wall clock. The previous derive_loop_start_iso_ts pasted `.000Z`
on top of that basename, treating the local wall clock as if it
were already UTC. Claude transcript events carry real UTC
timestamps, so on any non-UTC machine the filter boundary was
shifted by the local offset: west-of-UTC users inherited pre-loop
background launches and stayed parked forever, east-of-UTC users
missed in-loop background work and ran Codex review too early.
Fix in hooks/lib/loop-common.sh:
* derive_loop_start_iso_ts now does a two-step local -> epoch
-> UTC conversion. Local wall clock is parsed into epoch
seconds with `date -d` (GNU) or `date -j -f` (BSD/macOS),
then the epoch is formatted in UTC as
YYYY-MM-DDTHH:MM:SS.000Z with `date -u -d "@<epoch>"` (GNU)
or `date -u -r <epoch>` (BSD/macOS). Any failure yields an
empty string, which disables the filter in callers -- same
backward-compat behaviour as before.
Regressions in tests/test-stop-hook-bg-allow.sh:
AC-21b pinned to `export TZ=UTC` inside its subshell so the
expected 2026-03-01T00:00:00.000Z is TZ-deterministic.
AC-21d NEW. TZ=Asia/Tokyo + basename 2026-03-01_09-00-00 ->
2026-03-01T00:00:00.000Z (9am JST = 0am UTC).
AC-21e NEW. TZ=America/Los_Angeles + basename
2026-03-01_00-00-00 -> 2026-03-01T08:00:00.000Z
(0am PST = 8am UTC; March 1 is before DST starts on
March 8, 2026).
Validation:
- bash tests/test-stop-hook-bg-allow.sh -> 39 passed, 0 failed
- bash tests/run-all-tests.sh -> 1718 passed, 0 failed
- TZ=America/Los_Angeles bash tests/test-stop-hook-bg-allow.sh
-> 39 passed, 0 failed
- TZ=Asia/Tokyo bash tests/test-stop-hook-bg-allow.sh
-> 39 passed, 0 failed
- HOME=/nonexistent/readonly bash tests/test-stop-hook-bg-allow.sh
-> 39 passed, 0 failed
systemMessage wording unchanged. Version stays at 1.16.0.1 parent 7538f74 commit 9c80698
2 files changed
Lines changed: 74 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
268 | 268 | | |
269 | 269 | | |
270 | 270 | | |
271 | | - | |
| 271 | + | |
272 | 272 | | |
273 | | - | |
274 | | - | |
275 | | - | |
276 | | - | |
277 | | - | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
278 | 282 | | |
279 | 283 | | |
280 | | - | |
281 | | - | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
282 | 287 | | |
283 | 288 | | |
284 | 289 | | |
285 | 290 | | |
286 | | - | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
292 | 315 | | |
| 316 | + | |
293 | 317 | | |
294 | 318 | | |
295 | 319 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1214 | 1214 | | |
1215 | 1215 | | |
1216 | 1216 | | |
1217 | | - | |
| 1217 | + | |
1218 | 1218 | | |
1219 | 1219 | | |
1220 | 1220 | | |
| 1221 | + | |
1221 | 1222 | | |
1222 | 1223 | | |
1223 | 1224 | | |
1224 | | - | |
| 1225 | + | |
1225 | 1226 | | |
1226 | | - | |
| 1227 | + | |
1227 | 1228 | | |
1228 | 1229 | | |
1229 | 1230 | | |
| 1231 | + | |
| 1232 | + | |
| 1233 | + | |
| 1234 | + | |
| 1235 | + | |
| 1236 | + | |
| 1237 | + | |
| 1238 | + | |
| 1239 | + | |
| 1240 | + | |
| 1241 | + | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
| 1252 | + | |
| 1253 | + | |
| 1254 | + | |
| 1255 | + | |
| 1256 | + | |
| 1257 | + | |
| 1258 | + | |
| 1259 | + | |
| 1260 | + | |
| 1261 | + | |
| 1262 | + | |
1230 | 1263 | | |
1231 | 1264 | | |
1232 | 1265 | | |
| |||
0 commit comments