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

A lent job on a game box keeps the server's tps and mspt from before it and during it #17957

opened this

Merged 21h 55m ago, live in production

A lent check job on a game box now keeps its server's tps and mspt from before the claim and the worst values while the job runs. Reading what the pull shows takes one line on the runners page. The new test and bun x tsc --noEmit pass, and so does bun test test/mcp-size.test.ts.

Notes

opened this

A lent check job on a game box now keeps its server's tps and mspt from before the claim and the worst values while the job runs. Reading what the pull shows takes one line on the runners page. The new test and bun x tsc --noEmit pass, and so does bun test test/mcp-size.test.ts. I did not run the full suite: the forge's check does that on push.

What changed

  • Saved numbers: each sync's lowest tps and highest mspt across the box's servers are kept as the box's newest reading. When the box's runner claims a job (claimJob), that pair is copied to the job as "before". Each sync after that lowers the job's low tps and raises its high mspt, only while the job is held. The numbers are kept in a new table, lent_proof (one row per job, kept 30 days), so they outlive the job; the code is src/games/lent_proof.ts and the migration is pinned.
  • The line: tps 19.9 → 19.6 · mspt 11 → 15 while lent. It appears in four places:
    • as a Server fact in the check's details, on the web page and in the terminal, through the shared runFacts, for writers only;
    • on the box's runner row in Settings → Runners;
    • on the terminal's runners screen;
    • as lent in the MCP games tool's list, for the box owner.
  • Test: test/game-lent-proof.test.ts feeds made-up syncs from before the job and during it, then checks the saved numbers, the runners page, the check's facts and that a sync after the job is done changes nothing. It fails without the change. I did not test the games tool's lent field.
  • Existing test edited: test/game-metrics.test.ts builds its schema by hand. I added the lent-proof and check-runner migrations to it because the rollup now writes to those tables. The test was incomplete, not wrong.
  • Docs and settings: docs/features/lent-runners.md describes it. No new setting, cap or hold, and the MCP tool doc text is unchanged.
  • Gate: the gate asked for a "both doors" no-door line, so one is in the commit message. The terminal side is in the existing screens, not a new one.

Left out

  • Per-minute averages: "before" is the last raw sync reading, not the per-minute averages in game_metric.
  • Canary jobs: the forge's own canary jobs, which lent runners get, are not recorded.
  • Games page: the box's own games page does not show the line.

To try: switch on "Run checks while servers sleep" on a game box, let it claim a job, then open /settings/runners and the check's run page. Or call the games tool with action: list.

The gate also lists three similarity notes on lent_proof.ts (startProof, newestProof, proofByRunner), but its only failing rule was the missing Try line, now added. I merged proofOfRun and proofOfBox into one newestProof after it flagged them as duplicates, and left the three it still lists.

Closes #17949

commented

A lent check job on a game box now keeps its server's tps and mspt from before the claim and the worst values while the job runs. Reading what the pull shows takes one line on the runners page. The new test and bun x tsc --noEmit pass, and so does bun test test/mcp-size.test.ts. I did not run the full suite: the forge's check does that on push.

What changed

  • Saved numbers: each sync's lowest tps and highest mspt across the box's servers are kept as the box's newest reading. When the box's runner claims a job (claimJob), that pair is copied to the job as "before". Each sync after that lowers the job's low tps and raises its high mspt, only while the job is held. The numbers are kept in a new table, lent_proof (one row per job, kept 30 days), so they outlive the job; the code is src/games/lent_proof.ts and the migration is pinned.
  • The line: tps 19.9 → 19.6 · mspt 11 → 15 while lent. It appears in four places:
    • as a Server fact in the check's details, on the web page and in the terminal, through the shared runFacts, for writers only;
    • on the box's runner row in Settings → Runners;
    • on the terminal's runners screen;
    • as lent in the MCP games tool's list, for the box owner.
  • Test: test/game-lent-proof.test.ts feeds made-up syncs from before the job and during it, then checks the saved numbers, the runners page, the check's facts and that a sync after the job is done changes nothing. It fails without the change. I did not test the games tool's lent field.
  • Existing test edited: test/game-metrics.test.ts builds its schema by hand. I added the lent-proof and check-runner migrations to it because the rollup now writes to those tables. The test was incomplete, not wrong.
  • Docs and settings: docs/features/lent-runners.md describes it. No new setting, cap or hold, and the MCP tool doc text is unchanged.
  • Gate: the gate asked for a "both doors" no-door line, so one is in the commit message. The terminal side is in the existing screens, not a new one.

Left out

  • Per-minute averages: "before" is the last raw sync reading, not the per-minute averages in game_metric.
  • Canary jobs: the forge's own canary jobs, which lent runners get, are not recorded.
  • Games page: the box's own games page does not show the line.

To try: switch on "Run checks while servers sleep" on a game box, let it claim a job, then open /settings/runners and the check's run page. Or call the games tool with action: list.

The gate also lists three similarity notes on lent_proof.ts (startProof, newestProof, proofByRunner), but its only failing rule was the missing Try line, now added. I merged proofOfRun and proofOfBox into one newestProof after it flagged them as duplicates, and left the three it still lists.

commented

All three review points and the re-claim bug are addressed and pushed on the same branch. The new tests, bun x tsc --noEmit, test/unused-exports.test.ts, test/mcp-size.test.ts, test/game-metrics.test.ts and test/tui-runners.test.ts pass. The gate passes; it prints two similarity notes on helpers in the new test file (user, tui).

Fixes

  • games tool: lent is now computed once per box. A new test calls list as the box owner and checks lent equals the line. A non-owner gets no lent key.
  • Terminal runners screen: the new test showed the line was never drawn there. The row's meta drops its pieces when a row is too wide, and the proof was part of that meta. It is now the row's note, a line under the row that stays on narrow screens.
  • Terminal run log: the test reads Server: <line> as the repository owner. A reader who does not write the repository gets no Server: line.
  • Web run page: the writer reads the line, and a guest and a non-writer do not.
  • Retention cap: I removed KEEP_MS and the delete on every claim. It is one small row per lent job. Without a cap the table grows until someone adds one.
  • Re-claim: startProof now inserts with a conflict update instead of replacing the row. A job claimed again after a lease lapse keeps its low tps and high mspt. It takes the before numbers only where it has none. A test claims the same job twice and checks the line is unchanged.

The doors test is test/lent-proof-doors.test.ts.

To try

  • Games tool: call list as a box owner and read lent.
  • Terminal: open the runners screen.
  • Page: open Settings → Runners.
Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs