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

An agent run's log says where its time went: one timing line at the first push and one at the end #3689

Parked opened this
Closed without merging

An agent run's log now carries two timing: lines. I couldn't run the type check: bun install and bun x tsc fail in this sandbox with "unable to write files to tempdir", so tsc didn't run. The new test and the existing test/crew.test.ts, test/crew-early.test.ts and test/apps.test.ts pass.

Notes

stopped parked by the crew deploy 7cb95f2

opened this

An agent run's log now carries two timing: lines. I couldn't run the type check: bun install and bun x tsc fail in this sandbox with "unable to write files to tempdir", so tsc didn't run. The new test and the existing test/crew.test.ts, test/crew-early.test.ts and test/apps.test.ts pass. I did not check that the new test fails without the change.

  • First push: when the pull opens early, the log gets timing: first push Xs after the run started — clone … · brief … · harness to first push ….
  • End of run: the log gets timing: run ended Xs after the run started — … with every lap so far, plus harness to the end and wrap-up when the reserve was used. Neither line appears for a paused run. A follow-up on an existing pull has no first-push line, since no pull opens.
  • Reuse: the laps reuse Stopwatch from src/apps/timing.ts, so there is no new table and no new dependency. Stopwatch.line takes an optional since phrase, so the wording says "the run started" instead of "the deploy started". The deploy line is unchanged.
  • Hooks: CrewOptions gets an optional now clock, which tests use to fake time. watchForPull takes an onOpened callback that fires after the early pull opens.
  • Test: test/crew-timing.test.ts drives a run with the stand-in harness and a clock that advances 1 s per reading. It reads both lines and checks the laps are in order.
  • Docs: docs/CREW.md has a short section naming the lines.

I left out landing time. landWork has no lap, and the end line is written before it. I also didn't add timing for review runs or paused runs.

Closes #3665

3 earlier comments · 2 events
commented

An agent run's log now carries two timing: lines. I couldn't run the type check: bun install and bun x tsc fail in this sandbox with "unable to write files to tempdir", so tsc didn't run. The new test and the existing test/crew.test.ts, test/crew-early.test.ts and test/apps.test.ts pass. I did not check that the new test fails without the change.

  • First push: when the pull opens early, the log gets timing: first push Xs after the run started — clone … · brief … · harness to first push ….
  • End of run: the log gets timing: run ended Xs after the run started — … with every lap so far, plus harness to the end and wrap-up when the reserve was used. Neither line appears for a paused run. A follow-up on an existing pull has no first-push line, since no pull opens.
  • Reuse: the laps reuse Stopwatch from src/apps/timing.ts, so there is no new table and no new dependency. Stopwatch.line takes an optional since phrase, so the wording says "the run started" instead of "the deploy started". The deploy line is unchanged.
  • Hooks: CrewOptions gets an optional now clock, which tests use to fake time. watchForPull takes an onOpened callback that fires after the early pull opens.
  • Test: test/crew-timing.test.ts drives a run with the stand-in harness and a clock that advances 1 s per reading. It reads both lines and checks the laps are in order.
  • Docs: docs/CREW.md has a short section naming the lines.

I left out landing time. landWork has no lap, and the end line is written before it. I also didn't add timing for review runs or paused runs.

Changes requested — before the latest push

The run timing lines are sound: they reuse Stopwatch, add no dependency, and the deploy line is unchanged. One miss blocks it. The change overwrites test/crew-timing.test.ts and deletes the existing test that checked /settings/crew names session, scorecards, spending and render in Server-Timing. No other test mentions scorecards, so that behaviour now has no coverage. The test was not wrong, and the pull does not say it was. Fix first: put the /settings/crew Server-Timing test back in its own file, or restore it in the original file, and keep the new run-timing test in a new file such as test/crew-run-timing.test.ts. Smaller points: the timing lines are never shown to be absent for a follow-up on an existing pull, which the pull description claims. The first-push regex starts with .* where ^ plus the real log prefix would pin it better.

commented

Each agent run's log now has two timing: lines: one when the pull opens at the first push, one when the run ends. I could not run the type check here (bun install and bun x tsc fail on a read-only temp directory). The new test and the restored one pass; I did not re-run the other crew suites after this round of changes.

The overwrite you flagged: my earlier commit overwrote test/crew-timing.test.ts and deleted the /settings/crew Server-Timing test. That was my mistake, not a test I judged wrong. The original file is back as it was on main, so session, scorecards, spending and render are covered again. The new run-timing test is in test/crew-run-timing.test.ts.

  • Where the lines come from: Stopwatch in src/apps/timing.ts takes a lap after clone, brief, harness to first push, harness to the end, and wrap-up. Its line method takes an optional "since" phrase, so crew runs say "the run started" and the deploy line is unchanged.
  • Hooks: CrewOptions gets an optional now clock for tests, and watchForPull gets an onOpened callback.
  • Test: the clock advances 1 s per reading, so the laps are exact. The test reads the first-push line and the end line and checks the laps are in order.
  • Follow-up run: the test now comments on the stand-in's pull to queue a follow-up run, which opens no pull. That run's log has the end line and no first-push line.
  • Regex: both patterns are pinned with ^. Run-log lines carry no prefix, so ^ is the whole anchor.
  • Docs: docs/CREW.md has a short section naming the lines.

Not covered: landing time. The end line is written before landWork, so it is not a lap. A paused run writes no end line.

Approved — before the latest push

Does what #3665 asked: a first-push timing line and an end line in the run log, reusing Stopwatch with a since phrase, so the deploy line is unchanged and there is no new dependency. The test pins both lines and the lap order with a fake clock, and checks that a follow-up run on a standing pull gets only the end line. The docs section is accurate. I read the diff and did not exercise the preview; this change has no page or terminal surface. The next two things I would do:

  1. Write the end line on the failed and early-return paths too (clone failure, outage pause, abort). A failed run is the one where people ask where the time went, and today it gets no line.
  2. Add a landing lap, or say in the README that the end line excludes landing, so the total is not mistaken for wall time.
commented

I merged main into the branch and pushed it. The merge is clean now, but one crew test and one test error didn't pass in this sandbox, so the forge's check is the real verdict.

What changed: the only conflict was test/helpers/crew-standin.ts. main added a reviewBudgetMs option to the stand-in crew helper, and this pull added a now option. I kept both: the helper accepts reviewBudgetMs (default 4000), tickMs and now, and passes each to the crew only when it's set.

What I ran:

  • bun test test/crew* gave 260 pass, 2 fail and 1 error.
  • The visible failure is "a young lock that blocks checkout is recovered by a fresh clone". The error is that a sandbox can't be made here because rg is missing. I took both to be limits of this sandbox, not of the merge, but I didn't re-run them on main to confirm.
  • The pull's own run-timing test (test/crew-run-timing.test.ts) passes.
  • I didn't run the type check. bun x tsc --noEmit stopped with "bun is unable to write files to tempdir: ReadOnlyFileSystem". Nor did I run the full suite, because the same tempdir error stopped it.

What I left alone: I didn't touch the tests that failed.

commented

Parked by the crew: the check stayed red through 2 automatic tries

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs