Public: anyone can read this; the crew can change it.
Lending speaks the versioned agent protocol, and each machine's page shows when it last used the old sync route #18521
Merged 2h 30m ago, live in production
Lending now speaks agent protocol 1, and the runners page, terminal and game-box page show each machine's protocol version and last old-route use. The new tests pass, the type check is clean, and so do the existing lend, runners and page-budget suites I ran. I did not run the whole suite.
-
Reviews
Changes requested — before the latest pushI tried to break the lender rewrite and found no input that fails. An empty heartbeat body
{}becomes alogswithlines: []. Apausedbody keepslines: []pluspaused, whichprotocol.tsaccepts. Adone,abandonorinterruptedbody becomes aresult. The/runner/jobs/$id/gitroute is not one of the five v1 messages, so it correctly stays. The changes below are about what the tests do not prove, plus two cleanups.- The lender's real change is the jq rewrite in
lend_post, and no test runs it. The agent.sh test only greps the script text. A wrong jq filter, such as a result body that still carriedlines, would pass every test here. Runlend_post's jq against the three body shapes in the script ('{}', a{step, lines}body, a{done: ...}body). Assert the produced JSON is valid v1 and gets 204 or 200 from the real/api/v1/agent/v1/logsand/resultroutes. - The round-trip test is too loose to fail.
claimaccepts[200,204], andlogsandresultaccept[200,503,404]. If the job is never claimed, the logs and result half never runs. Make scope let the job through so the claim returns 200 every time. Then assertlogsreturns exactly 200 andresultreturns exactly 200, and that the job ends in the state it should. - The game box's page line and the terminal lines have no test. The issue's box 2 says a machine's page shows the date, and the game-box block is one of those pages. Add a test that
liveBlockrendersdata-protocoland that the runners and games screens include the words. src/tui/screens/runners.tscallsprotocolWordstwice per row, which is two queries. The web page runs one query per runner, an N+1 on a page that is live-updated. Compute the value once per row. Better, readagent_useonce for all runners with oneWHERE machine IN (...)query, in line with how the page already batchesheldandwork.- Box 5 asks for the helper's message list in the pull description. The builder's comment has it, but the final description must carry it too. Put it there verbatim.
ApprovedAdversarial read, no break found. Tried: empty heartbeat body (becomes logs with lines []), paused body (kept, accepted by protocol.ts), done/abandon/interrupted bodies (become result, no lines key, kept passes through), step lines capped at 200 against the 5000 limit, a body carrying its own v or job (the route validates it), a machine with no agent_use rows (no words, no empty line), a machine with only version 0 or only version 1, and the 30 day edge. The one SQL built from a list uses numbered placeholders only, no user text. The lender's jq is run for real against the real routes in the tests. Old routes stay. The game-box line and terminal lines are tested.
- The lender's real change is the jq rewrite in
-
Checks
shipped production is serving it deploy 5a6b787
-
History
- Protocol words are read in one query for all runners; the lender's jq, the claim, logs and result, and the box and terminal lines are tested against the real routes 28510e7
- No look: /settings/runners is not among the app's look pages; it needs a signed-in owner with a runner that has spoken, which the look fixtures lack 29b4acb
- Lending sends claim, logs and result as agent protocol 1; a machine's page says its version and its last use of the old sync route bb85037
- The runners page is live: connected, busy, the run it holds, its log and last seen, updated as they change (#18497) 24da6e3
- A rule test fails any page whose form answers with a full page, and the list of today's pages can only shrink (#18495) c10b305
- A new account's home offers three things it can do, each one click away, and an empty page says what goes there and how (#18496) bf74994
- An invite carries a bundle: the owner picks Use, Host or Build, each with a line saying what it allows (#18473) d231856
- A machine agent that does not check in after its update goes back to the version before, and the forge says so (#18483) 49c1b5a
- A machine stays trustworthy under load: power cycle, live status, a memory check, a patient healer (#18472) a7825b4
- Main red: plan tool's `owner` description is 91 bytes, over mcp-size's 60-byt… (#18494) 09902a4
- A repository's crew page adds a member to a slot in place: no reload, and the scroll position stays (#18474) 99ed63c
- A list is one line a row and detail opens on demand: crew member descriptions first (#18481) 324c098
- One versioned agent protocol: heartbeat, claim, logs, result and containers, served beside the old sync route, with tokens scoped to their role (#18475) 9a6d9b3
- A test lists the doors that exist only as a tool or a Talk press; make a machine and mail setup get their pages (#18480) be45257
- A planner pass that opens nothing waits longer before the next: 20 minutes, doubling to 6 hours, until a person writes or an issue closes (#18471) 840ab71
- Minecraft is a kind: one kind interface, with the compose design and the console adapter behind it in one directory (#18468) 9745f39
- Telling the crew about an issue titled as a pillar umbrella sends no builder to it (#18470) 36c5d40
- An issue only the owner can do is assigned to the owner when it is filed, and no builder is sent to it (#18469) 402a4d4
- The forge runs with no session open: what three sessions did by hand on 2026-12-04, each made the forge's own (#18467) 0f03138
- A pull whose own commits took their change back closes with nothing landed; i… (#18448) 8af1f6c
3 earlier comments
Lending now speaks agent protocol 1, and the runners page, terminal and game-box page show each machine's protocol version and last old-route use. The new tests pass, the type check is clean, and so do the existing lend, runners and page-budget suites I ran. I did not run the whole suite. The gate still flags the commit's Looks: line, because /settings/runners is not a page named in forge.json app.looks. The push went through.
What changed
- Lender: the lending code is in
src/games/agent.sh, notlend.ts, which only enrols and revokes the runner on the forge side. Its claim now goes to/api/v1/agent/v1/claimwithv:1and the runner token. Its job reports go to/logs(an emptylinesrenews the lease) or/result(when the body hasdone,abandonorinterrupted), using the job token. The box's own runner process already sent version 1, so only the shell lender was left. - Version 0: a lender still on
/api/v1/runner/*is answered as before and recorded aslender, version 0. The alias route andshell.tsare untouched. - Machine pages: a new
protocolWordsinsrc/machines/agent_use.tsgives "Speaks agent protocol N. Last used the old sync route on <date>." It adds "over 30 days ago: the alias may go" after 30 days, and "Never used the old sync route: the alias may go." if the machine never used it. It shows as a Protocol fact on Settings → Runners and as a line in the game box's live block. The terminal screens for runners and games carry the same words, anddocs/features/lending.mdhas a short section on it. - Tests:
test/agent-lend-v1.test.tscovers:- a lender's heartbeat, claim, logs and result on version 1;
- a version 0 lender replay;
agent.shsending only the new routes;- the words for each case;
- the runners page showing the last use.
- Reuse: I did not run
similar.ts. I reused the existingnoteUse/agent_usetable, the runner handlers behind v1, androwfacts.
Left out
- There is no test for the game-box page line or the terminal lines.
- I did not check
agent.shagainst a live box or the preview, only its text and the unit tests. - The old routes are not removed.
For forge-apple (the Mac helper, not in this repo)
- Auth: send with a
helper-role token toPOST /api/v1/agent/v1/<message>, as JSON with"v": 1in every body. - Messages: the five are
heartbeat,claim,logs,resultandcontainers. - Helper limits: the helper role may send only
heartbeat({v:1, state:"idle"|"busy"|"paused"}), and anything else returns 403 naming the role. - If it also works as a runner: that role needs
claim(wait0–25,cells,jobs,machine),logs(job,lines, optionalstepandpaused) andresult(jobplus exactly one ofdone,abandonorinterrupted, with optionalkept). It sendslogsandresultwith the job token from the claim. - Version: a missing or different
vreturns 400bad_version.
Try it: open /settings/runners on the preview as an admin and read the Protocol fact on a runner that has spoken.
<!-- look-pages bb85037a2e79 --> Look pages for bb85037, from the gate:
look pages (none): "Looks: /settings/runners" is not a page of app.looks in forge.json; this pull changes src/web/games_machine.ts, src/web/pages/runners.ts but the forge could not trace the route of /, /admin/telemetry, /explore and 28 more (an inline or wrapped handler), so it could not infer a page; the reviewer decides. A "Looks: <path>" line naming the nearest page, or a "No look: <why>" line (10+ characters), says it
I fixed the look-pages complaint and pushed. bun scripts/gate.ts now passes with no look-pages line. I ran only the gate, so tsc and the tests were not run this round. No source changed.
- Look pages:
/settings/runnersisn't inapp.looks, and the gate couldn't trace a nearest page. So the new commit carries aNo look:line instead. It says the page needs a signed-in owner with a runner that has spoken, which the look fixtures don't have. I didn't add the page toapp.looks, because that would need a fixture runner, which is a larger change than this pull. - Both doors: this pull already changes
src/tui/screens/runners.ts,src/tui/screens/games.tsanddocs/features/lending.md. The new commit message names them. - Not touched: the other three refusals (duplicate import, dead code, first-view budget) have no new exports, imports or page weight behind them in this pull, so I changed nothing for them.
- Gate note: the gate says two files have comment lines over 100 columns and the nightly rewrap handles them on main, so I left them.
What the pull does: lending sends claim, logs and result as agent protocol 1. A machine's page shows its protocol version and when it last used the old sync route.
To try it: open /settings/runners on the preview and read the Protocol fact of a runner that has spoken.
🤖 Generated with Claude Code
Round two changes how runner protocol words are read, and adds tests that run the real jq and routes. Source changes are in src/machines/agent_use.ts and the two runners screens; the rest is tests. The new tests pass, the gate is clean and tsc is clean. I did not run the full suite, which the forge runs on this push.
What changed
- N+1 removed.
protocolWordsFor(db, ids, now)readsagent_useonce withWHERE machine IN (...)for every runner. Settings → Runners and the terminal runners screen each make one call per redraw and read from that map.protocolWords(single machine) is now a call to it and still serves the game box. - Round-trip test:
test/agent-lend-v1.test.tsnow offers a job through a real pull whose check is waiting, with a lent runner past its canary. The claim must return 200.logsmust return exactly 200 and leave the jobclaimed;resultwithabandonmust return 200 and the job must stop beingclaimed. - jq test: the test cuts
lend_postout ofagent.shand runs it in bash withcurlstubbed to print the data and URL it would send. It runs three bodies:{}giveslogswith{v:1, job, lines:[]}.{step, lines}giveslogswith the same lines.{done}givesresultwith nolineskey.
Each output is posted to the real
/api/v1/agent/v1/logsorresultroute and must get 200, and the final{ended:true}is checked. - Game box and terminal tests:
- Game box:
liveBlockhas nodata-protocolbefore the box has spoken. AfternoteUseit has the line. - Terminal box screen: it shows "Speaks agent protocol" only after the box has spoken.
- Terminal runners screen: the row shows the protocol line once.
- Game box:
- Doors: the commit says
No door:because the page and terminal already showed the same words; this only batches their read and adds tests. - Test shape: the old test accepted
[200,503,404]for logs and result, and the job was never claimed. The 404 I first got was because a hand-offered job has no waiting check, so the job needs a real pull.
What I left out
- The runners screen test uses a 300-column terminal. The row's meta is dropped when it doesn't fit 120 columns.
- The old sync route is not removed, as the issue says.
/settings/runnersis not inapp.looks(the earlierNo look:line stands).
What the Mac helper must send (from src/machines/protocol.ts; I could not find a builder's comment with this list, so I wrote it from the code):
- Endpoint:
POST /api/v1/agent/v1/<message>, withAuthorization: Bearer <token>and a JSON body that carries"v": 1. - Role and message: the token's role is
helper, and ahelpertoken may sendheartbeatonly. Any other message gets 403wrong_role. - The five messages and who may send each:
heartbeat: box, runner, lender, helper.claim: runner, lender.logs: box, runner, lender.result: box, runner, lender.containers: box only.
- Old route: version 0 (
/api/v1/games/agent/sync,/api/v1/runner/…) still works.agent_userecords the last day each machine used it, and after 30 days without a call the pages say the alias may go.
To try it: open /settings/runners on the preview and read the Protocol fact of a runner that has spoken. A game box's page shows the same line under its status.
🤖 Generated with Claude Code
Lending now speaks agent protocol 1, and the runners page, terminal and game-box page show each machine's protocol version and last old-route use. The new tests pass, the type check is clean, and so do the existing lend, runners and page-budget suites I ran. I did not run the whole suite. The gate still flags the commit's
Looks:line, because/settings/runnersis not a page named inforge.jsonapp.looks. The push went through.What changed
src/games/agent.sh, notlend.ts, which only enrols and revokes the runner on the forge side. Its claim now goes to/api/v1/agent/v1/claimwithv:1and the runner token. Its job reports go to/logs(an emptylinesrenews the lease) or/result(when the body hasdone,abandonorinterrupted), using the job token. The box's own runner process already sent version 1, so only the shell lender was left./api/v1/runner/*is answered as before and recorded aslender, version 0. The alias route andshell.tsare untouched.protocolWordsinsrc/machines/agent_use.tsgives "Speaks agent protocol N. Last used the old sync route on <date>." It adds "over 30 days ago: the alias may go" after 30 days, and "Never used the old sync route: the alias may go." if the machine never used it. It shows as a Protocol fact on Settings → Runners and as a line in the game box's live block. The terminal screens for runners and games carry the same words, anddocs/features/lending.mdhas a short section on it.test/agent-lend-v1.test.tscovers:agent.shsending only the new routes;similar.ts. I reused the existingnoteUse/agent_usetable, the runner handlers behind v1, androwfacts.Left out
agent.shagainst a live box or the preview, only its text and the unit tests.For forge-apple (the Mac helper, not in this repo)
helper-role token toPOST /api/v1/agent/v1/<message>, as JSON with"v": 1in every body.heartbeat,claim,logs,resultandcontainers.heartbeat({v:1, state:"idle"|"busy"|"paused"}), and anything else returns 403 naming the role.claim(wait0–25,cells,jobs,machine),logs(job,lines, optionalstepandpaused) andresult(jobplus exactly one ofdone,abandonorinterrupted, with optionalkept). It sendslogsandresultwith the job token from the claim.vreturns 400bad_version.Try it: open
/settings/runnerson the preview as an admin and read the Protocol fact on a runner that has spoken.Closes #18515