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

Each crew run records the model and prompt version it ran on, and the scorecard splits by them #2686

Merged opened this

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

Merged

Each agent run now records its model and a prompt version, and `/settings/crew` shows the scorecard cut by each. The new tests and the existing `test/crew-totals.test.ts` pass (5 tests). I could not run the type check: `bun install` and `bun x tsc --noEmit` both fail here with "unable to write files to tempdir: ReadOnlyFileSystem". The forge's check will be the first type check of this change.

shipped production is serving it deploy 28f939d

opened this

Each agent run now records its model and a prompt version, and /settings/crew shows the scorecard cut by each. The new tests and the existing test/crew-totals.test.ts pass (5 tests). I could not run the type check: bun install and bun x tsc --noEmit both fail here with "unable to write files to tempdir: ReadOnlyFileSystem". The forge's check will be the first type check of this change.

  • What is recorded: a migration adds model and prompt_version columns to run. The runner sets both through noteRunProgress when a run starts. The model is the agent's configured model (empty means the default). The prompt version is promptVersion() in src/crew/brief.ts, a 10-character hash of the agent's brief, its crew role and the standing system-prompt text.
  • Per-run facts stay out of the hash: the issue number and branch are not hashed. Two runs of one agent on one brief share a version, and editing the brief starts a new one.
  • What the page shows: /settings/crew has two new tables, "Per model" and "Per prompt version". Each lists runs, landed, failed, spent and cost per run, and is hidden until there is a run. Runs from before this change show as "default" and "not recorded".
  • Tests: test/crew-splits.test.ts covers the issue's case. Two briefs give two prompt versions, with run counts 2 and 1. It also checks the split by model and that the page shows both tables.
  • Left out: the splits count all agents together, so there is no per-agent breakdown, and old runs are not backfilled. I added no dependency.

Closes #2682

commented

Each agent run now records its model and a prompt version, and /settings/crew shows the scorecard cut by each. The new tests and the existing test/crew-totals.test.ts pass (5 tests). I could not run the type check: bun install and bun x tsc --noEmit both fail here with "unable to write files to tempdir: ReadOnlyFileSystem". The forge's check will be the first type check of this change.

  • What is recorded: a migration adds model and prompt_version columns to run. The runner sets both through noteRunProgress when a run starts. The model is the agent's configured model (empty means the default). The prompt version is promptVersion() in src/crew/brief.ts, a 10-character hash of the agent's brief, its crew role and the standing system-prompt text.
  • Per-run facts stay out of the hash: the issue number and branch are not hashed. Two runs of one agent on one brief share a version, and editing the brief starts a new one.
  • What the page shows: /settings/crew has two new tables, "Per model" and "Per prompt version". Each lists runs, landed, failed, spent and cost per run, and is hidden until there is a run. Runs from before this change show as "default" and "not recorded".
  • Tests: test/crew-splits.test.ts covers the issue's case. Two briefs give two prompt versions, with run counts 2 and 1. It also checks the split by model and that the page shows both tables.
  • Left out: the splits count all agents together, so there is no per-agent breakdown, and old runs are not backfilled. I added no dependency.
Changes requested — before the latest push

The recording is sound: parameterised migration, by limited to two literals, hash leaves per-run facts out, and the tests cover it. Two items on the list are missed. I could not open the preview (the sandbox denied the host), so this is judged from source only; the forge took pictures but I did not need them for these points.

  1. Both doors: the splits exist only on /settings/crew. Nothing in src/tty.ts shows the per-model or per-prompt-version scorecard. Add the same two cuts to the terminal crew view (reading agentSplits, gated like the page) with a test, or point to the existing terminal crew scorecard and extend it.
  2. README: it says nothing about the new Per model / Per prompt version tables, what a prompt version is (hash of brief + role + sandbox text), or that runs before this change show as default / not recorded. Add a short paragraph.

Smaller: the page test only checks headings and one model string; add a case for the empty-key row ("default"/"not recorded") since that is the shipped state for every existing run. Fix first: the terminal view.

commented

I've added the per-model and per-prompt-version scorecard to the terminal, written the README paragraph, and tested the empty-key rows. The new tests and crew-totals pass (7 tests); I haven't run the type check, since bun install and tsc fail in this sandbox with a read-only tempdir.

  • Terminal view: there is no src/tty.ts and no existing terminal crew scorecard, so I added a new palette command, Crew scorecard (src/tui/screens/crewsplits.ts). It reads agentSplits for both cuts and shows runs, landed, failed, spent and per-run cost. An admin gets the command. It is gated on isAdmin like the page, not the admin-who-isn't-an-agent gate that Usage uses. A non-admin has no command, and I tested that. test/tui-crew-splits.test.ts covers the admin view and the empty keys.
  • README: a paragraph under "The crew" says what a prompt version is (a hash of brief, role and sandbox text), that Settings → Crew has both tables, that the terminal has the same view, and that earlier runs show as default / not recorded and are not backfilled.
  • Empty-key test: test/crew-splits.test.ts now includes a run with no recorded model or prompt version. It asserts the page shows the default and not recorded cells, and that the empty key sorts in order.

The terminal test inserts its runs with no matching repository row, with foreign keys switched off for that setup.

Approved

Approved. Runs now record model and prompt version through noteRunProgress. The prompt hash leaves out issue and branch, so one brief gives one version. /settings/crew shows both cuts, and an admin gets a Crew scorecard command in the terminal. Both doors use the same admin gate, SQL interpolates only two literal column names, and output goes through the html escaper. The tests cover both cuts, the empty key and the non-admin case, and the README says how to use it. I could not view the preview page, because /settings/crew needs an admin sign-in. Next: (1) the terminal test turns foreign keys off to insert runs with no repo, so create a real repo there and drop the pragma. The non-admin test only checks that one hint string is absent. Assert the command is missing from the palette. (2) Neither cut shows which agent a run belongs to, which the issue may later want. Consider a per-agent filter, as a separate issue.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs