# Paused job contract clock

2026-11-26. Separate branch `fix/paused-job-clock`, based on plain main
`eb36731524663399e39a543080413d0dda0716ae`. No native task-view changes.

## Reproduction and cause

At 02:48 UTC, on an unmodified checkout of main:

```sh
GOTOOLCHAIN=go1.26.11 CGO_ENABLED=0 go test -tags testbuild \
  ./internal/thintest -run '^TestContractPausedJob$' -count=1
```

FAIL at `assistant_paused_contract_test.go:175`: HTTP 409
`carry_on_unavailable`, with a reset at 11:49. This is the same failure as
slice 3's Linux CI, so the Step projection is not responsible.

`newTeamRigAt` sets housekeeping to today's noon, while the paused fixture
previously used the wall clock. At this hour, housekeeping sees newly running
work as hours old. A diagnostic overlay of the original test observed a
completed `triage_stall` housekeeping action before Carry on. The offer is no
longer available after that unrelated sweep.

## Change

Only the paused contracts use a fixed chat clock, with housekeeping following
that same clock. Connection timestamps and allowance resets use it too. The
full contract runs at 02:30, 12:30 and 23:30 UTC on 2026-11-24; the unavailable
case uses 02:30. These resets avoid local midnight in Dublin and Tokyo, where
the reviewed words intentionally say midnight instead of a numeric time.
The response's started-at timestamp is checked against the injected clock.

The real transport and stream quiet timers still use elapsed time. No
production behavior, copy, route, schema or native code changes. The thintest
line allowance increases by 13 to its measured 35085 lines for this fixture
and the three clock cases.

## Test first and mutations

Before injection, the fixed-clock cases failed against the wall clock. After
injection, the public paused words, timestamp, time-zone changes, stream
compatibility, stale revision rejection, release and idempotency assertions
pass.

```sh
GOTOOLCHAIN=go1.26.11 CGO_ENABLED=0 go test -tags testbuild \
  ./internal/thintest -run '^TestContractPausedJob' -count=5
```

PASS: all three clock cases and the unavailable case, five times (15.236s).

Each mutation used `go test -overlay=<mutation.json> -tags testbuild
./internal/thintest -run '^TestContractPausedJob$/2$' -count=1`, leaving the
checkout intact. That regex selects both the 2 and 12 suffixes.

| Mutation | Result |
| --- | --- |
| Remove chat `SetClock` injection | KILLED: paused words/timestamp no longer match the fixed reset. |
| Remove `SetHousekeepingClock(nil)` | KILLED: Carry on returns HTTP 409 `carry_on_unavailable`, reproducing the original regression. |

## Gates

All commands use `GOTOOLCHAIN=go1.26.11 CGO_ENABLED=0`.

- `make test-lane LANE=thintest-contract`: PASS.
- `GOOS=linux GOARCH=amd64 make build vet`: PASS, including the Makefile's Darwin runner checks. Linux targeting avoids the known Darwin `unix.O_PATH` toolproxy compile error.
- `make fmt-check lanes-check budget copy-release-check`: PASS. `fmt-check` uses the pinned toolchain's bin directory on PATH.
- staticcheck v0.7.0, `GOOS=linux GOARCH=amd64`, `-tags testbuild ./internal/thintest`: PASS.
- `make migration-check gitleaks`: PASS.
- Post-commit dead references and Linux CI are recorded with the handoff results.

Linux hub CI is the full gate; the native gate is unchanged by this test-only
branch. Slice 3 remains separate at `dc5e8d8c`. Its `TestDependencyStage`
telemetry TempDir cleanup race is the known main flake the controller approved
rerunning; no changes for that race are included here.

## Second infrastructure commit: dependency fixture telemetry

The first Linux CI run at `cf517c83` passed the paused contract and 28 of 29
check shards. Only `TestDependencyStage` failed, twice, in TempDir cleanup;
perf was consequently skipped. The controller requested this separate second
commit on the same branch because the race also blocks main.

The fixture already set `GOTELEMETRY=off`, but that environment variable does
not configure the Go tool's telemetry mode. A test-first assertion running
`go env GOTELEMETRY` with the exact child environment failed with `local`.
Go 1.26.11's `cmd/internal/telemetry` and vendored telemetry `start.go` read a
mode file and can start a sidecar that outlives the Go command. The shell runs
its Go command synchronously and `CombinedOutput` waits for the shell; there
is no un-awaited application child in this test.

A Linux `strace -ff -ttt -e trace=process,file` of the original test confirmed
the writer: `go mod download` exited at timestamp `1795662290.018607`, but its
`** telemetry **` sidecar created the fixture HOME's
`.config/go/telemetry/upload` at `1795662290.024016`. Thus command completion
does not guarantee that the fixture HOME has no writers.

The test now reuses `telemetryOffConfig` to write the off mode, and supplies
Go's `TEST_TELEMETRY_DIR` override so the same configuration works on Linux
and macOS. It keeps `GOTELEMETRY=off` too and asserts Go's effective mode is
actually off. Its child HOME, TMPDIR, GOMODCACHE and GOCACHE live in a dedicated
TempDir created before the source tree, so it is removed last. A failed child
also logs its execution error. Production code is unchanged; no retries,
cleanup suppression, global environment changes or sleeps were added.

Validation:

- Linux arm64 container, pinned Go 1.26.11 on PATH, CGO disabled. Four concurrent
  `yes >/dev/null` processes provided CPU load and were killed on exit.
  `go test ./internal/runner/checks -run '^TestDependencyStage$' -count=50`:
  **PASS, 1.239s**. The unmodified fixture also passed 50 runs locally under
  that load; the CI failure remains the observed cleanup reproduction.
- Fixed Linux strace: **zero telemetry sidecar execs**, versus three in the
  original trace. Only the fixture itself creates the configured directory.
- Mutations, each through a Go overlay with `-count=1`: remove the telemetry
  directory override, and change the off-mode file to local. **Both KILLED**
  by the effective-mode assertion (`local`, wanted `off`).
- macOS catches the same original effective-mode failure. Its stress run
  cannot exercise the stage because the existing command uses `/usr/bin/bash`,
  absent on this Mac; the execution diagnostic records that limitation.
- The full checks package was attempted in the minimal Linux container; its
  sandbox integration tests require the Codex binary and fail because it is
  absent there. Full integration remains the equipped Linux CI gate.
- Linux-target staticcheck v0.7.0 for `./internal/runner/checks`: PASS.
- `make fmt-check lanes-check budget`: PASS. The existing checks directory
  allowance covers the added fixture assertions.
- Evidence (logs, overlays and original/fixed strace archive) is retained in
  `site/build/slice3/delta-validation/paused-job-clock/` in the audit checkout.
