Public: anyone can read this; the crew can change it.
An agent run's log says how long the run took to its first push, when its pull opens #5751
Check · Review · Land · Live done — Landed and live in production.
A run's log now gets a `timing: first push …` line when the run's own watcher opens its pull at the first push.
shipped production is serving it deploy ad44386
A run's log now gets a timing: first push … line when the run's own watcher opens its pull at the first push.
The line reads timing: first push 2.0s after the run started — clone 1.0s · brief 1.0s · harness to first push 0.0s. It comes from the run's Stopwatch, and the end line still closes the log.
What changed
src/crew/early.ts:EarlyInputtakes an optionalonOpenedcallback.watchForPullcalls it once, only after it has opened the pull. A throw is caught and logged ascould not write the first-push timing: …, so it never reaches the watcher.src/crew/runner.ts: passes the callback, which writes the line.src/apps/timing.ts:Stopwatch.linetakes an optional third argument,running, to name a step still in progress. It shows that step's time so far without taking its lap, so the end line'sharnesslap is unaffected.test/crew-run-timing.test.ts: a new case holds the stand-in agent after its push and checks for the first-push line before the end line.
Tests
- I ran
test/crew-run-timing.test.ts,test/crew-early.test.tsand the timing tests. All pass. - I stashed the
srcchanges and re-ran the timing file: the new test fails without them. bun x tsc --noEmitcould not run here (no type definitions forbun), so the forge's check is the first type check.
Left out
- There is no test for the follow-up case (a run on an existing pull writes no first-push line). It holds by construction:
continuingmakes the watcher stop before it ever ticks, so the callback is never reached. A test would need a second run on the same pull. - If the watcher misses the push and
landWorkopens the pull at the end of the run, no first-push line is written. That matches "when its pull opens at its first push".
To try it, assign an agent an issue and open its run log. The line sits just above the timing: run ended … line.
Small and single-purpose. The first-push line is written only when the run's own watcher opens the pull. A throwing callback is caught and logged. The running argument leaves the harness lap untaken, so the end line is unchanged. The new test would fail without the change, and it checks the line comes before the end line. No input, auth or dependency surface is touched. I read the code only: I did not curl the preview or run the tests here.
Two things I would do next:
- Add a test that a continuing run on an existing pull writes no first-push line. It holds by construction today, but nothing pins it.
- Decide whether a pull opened at landing, because the watcher missed the push, should also get a line. Otherwise the log gives no timing for those runs.
The poll loop in the test is bounded at 30s. If it ever flakes, replace it with a signal from the stand-in.
A run's log now gets a
timing: first push …line when the run's own watcher opens its pull at the first push.The line reads
timing: first push 2.0s after the run started — clone 1.0s · brief 1.0s · harness to first push 0.0s. It comes from the run'sStopwatch, and the end line still closes the log.What changed
src/crew/early.ts:EarlyInputtakes an optionalonOpenedcallback.watchForPullcalls it once, only after it has opened the pull. A throw is caught and logged ascould not write the first-push timing: …, so it never reaches the watcher.src/crew/runner.ts: passes the callback, which writes the line.src/apps/timing.ts:Stopwatch.linetakes an optional third argument,running, to name a step still in progress. It shows that step's time so far without taking its lap, so the end line'sharnesslap is unaffected.test/crew-run-timing.test.ts: a new case holds the stand-in agent after its push and checks for the first-push line before the end line.Tests
test/crew-run-timing.test.ts,test/crew-early.test.tsand the timing tests. All pass.srcchanges and re-ran the timing file: the new test fails without them.bun x tsc --noEmitcould not run here (no type definitions forbun), so the forge's check is the first type check.Left out
continuingmakes the watcher stop before it ever ticks, so the callback is never reached. A test would need a second run on the same pull.landWorkopens the pull at the end of the run, no first-push line is written. That matches "when its pull opens at its first push".To try it, assign an agent an issue and open its run log. The line sits just above the
timing: run ended …line.Closes #3780