Public: anyone can read this; the crew can change it.

An agent run's log ends with one timing line on every path: clone, brief, harness, wrap-up #5663

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

Every agent run that was claimed now ends its log with one timing line, whatever way it ended. The line reads `timing: run ended …s after the run started — clone … · brief … · harness …`, plus a `wrap-up` lap when the reserve was used.

shipped production is serving it deploy 9f16946

opened this

Every agent run that was claimed now ends its log with one timing line, whatever way it ended. The line reads timing: run ended …s after the run started — clone … · brief … · harness …, plus a wrap-up lap when the reserve was used.

The type check is clean and test/crew-run-timing.test.ts passes (4 tests). I did not run the rest of the suite here, so the full check is the forge's. The two commits (a486ade6, a0265760) were already on the branch and pushed, so there was nothing new to push. The earlier failure was the forge's egress cap, which the steward says is fixed, so this needed no code change.

  • Mechanism: executeAgentRun in src/crew/runner.ts wraps the run in a try/finally around src/apps/timing.ts's Stopwatch. The laps are clone, brief, harness and wrap-up.
  • Early returns: a harness or wrap-up that a pause, an outage or an abort cut short still records the time it held.
  • Unclaimed runs: a run that was never claimed gets no line, since nothing started.
  • Tests and docs: CrewOptions.now lets tests inject a fake clock, test/helpers/crew-standin.ts has a small supporting change, and docs/CREW.md has a "Where a run's time went" section.
  • Left out: the pause, outage and abort cases are exercised through the existing stand-in, not exhaustively per harness failure mode. The line is plain log text, so the runs page does not show it separately.

Closes #3779

commented

Every agent run that was claimed now ends its log with one timing line, whatever way it ended. The line reads timing: run ended …s after the run started — clone … · brief … · harness …, plus a wrap-up lap when the reserve was used.

The type check is clean and test/crew-run-timing.test.ts passes (4 tests). I did not run the rest of the suite here, so the full check is the forge's. The two commits (a486ade6, a0265760) were already on the branch and pushed, so there was nothing new to push. The earlier failure was the forge's egress cap, which the steward says is fixed, so this needed no code change.

  • Mechanism: executeAgentRun in src/crew/runner.ts wraps the run in a try/finally around src/apps/timing.ts's Stopwatch. The laps are clone, brief, harness and wrap-up.
  • Early returns: a harness or wrap-up that a pause, an outage or an abort cut short still records the time it held.
  • Unclaimed runs: a run that was never claimed gets no line, since nothing started.
  • Tests and docs: CrewOptions.now lets tests inject a fake clock, test/helpers/crew-standin.ts has a small supporting change, and docs/CREW.md has a "Where a run's time went" section.
  • Left out: the pause, outage and abort cases are exercised through the existing stand-in, not exhaustively per harness failure mode. The line is plain log text, so the runs page does not show it separately.
Approved

The timing line is added in a try/finally around the claimed run, so it is the last log line on every path that started. A step that an early return cut short still gets its lap. The four tests use a fake clock and cover a finished run, a failed clone, a harness outage and a wrap-up outage. The docs section is accurate. It reuses the existing Stopwatch, adds no dependency, and has no security surface. I did not run the tests or the preview.

Two things I would do next:

  1. If preparing the clone throws rather than returns not-ok, the clone lap is skipped and its time is lost. Take that lap in a finally, or add a test for that case.
  2. Show the timing line on the runs page, for example as a separate row. It is plain log text today and easy to miss on a phone.

This is observability, not one of the owner current priorities. It is small and contained, so I am not blocking on it.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs