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

An agent asking `forges` sees each child's size and usage, as the machines page shows them #10957

Merged opened this

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

Merged

MCP `forges` already returned `size` and `use` for each child. `clientRows` in `src/spawn/clients.ts` includes them, and `use` comes from `forgeUse`, the same function the machines page reads. The REST route `/api/v1/forges` and its OpenAPI summary already named them too. So the missing pieces were a test and a mention in the tool's own wording.

shipped production is serving it deploy befa93c

opened this

MCP forges already returned size and use for each child. clientRows in src/spawn/clients.ts includes them, and use comes from forgeUse, the same function the machines page reads. The REST route /api/v1/forges and its OpenAPI summary already named them too. So the missing pieces were a test and a mention in the tool's own wording.

What changed

  • src/http/mcp/tools/forges.ts: the tool description and doc line now name size and use (short). The matching row in docs/MCP.md is updated.
  • test/mcp-forges-usage.test.ts (new): it writes two child ledger fixtures, then reads them as an admin through MCP forges and through GET /api/v1/forges.

- A hosted small child reads {kind: "shared"}. - A cell medium child that isn't running reads {kind: "idle", limits: SIZES.medium}.

What I left out

  • Live figures: the test doesn't read live memory, CPU or disk for a running cell. A fixture can't run a cell in this sandbox, so those paths keep their existing coverage of usage.ts.
  • Page output: I didn't reshape use. It is the same object the page reads, with null where a reading is unknown.

Checks

  • Passing: test/mcp-size.test.ts (no ceiling raised), the new test, test/openapi-oa-forges.test.ts (the drift test) and test/mcp.test.ts.
  • The gate and tsc printed nothing when run.
  • The first push was refused by the pre-push hook until a commit said how to try the change, so I added an empty "Try:" commit.

To try Sign in as an admin and call the MCP forges tool. Each item carries size and use, or fetch /api/v1/forges for the same fields.

Closes #10903

commented

MCP forges items now name size and use, and a new test reads both through MCP and REST. The previous push failed the check because I had hand-edited the forges row in the docs/MCP.md tool table and it didn't match what the code renders. I regenerated it with bun scripts/mcp-table.ts and pushed. test/mcp-table.test.ts and test/mcp-size.test.ts now pass locally; I did not re-run the full suite, which the forge's check does on push.

What changed

  • The data was already there. clientRows already carried size and use for each child. use comes from forgeUse, the same function the machines page reads. GET /api/v1/forges and its OpenAPI summary already named them too.
  • The tool wording. src/http/mcp/tools/forges.ts now names size and use in its description and doc line. The docs/MCP.md row is regenerated to match, with no ceiling raised.
  • The test. test/mcp-forges-usage.test.ts writes two child fixtures and reads them as an admin.

- A hosted small child reads {kind: "shared"}. - A cell medium child that isn't running reads {kind: "idle", limits: SIZES.medium}. - The same two values are asserted from GET /api/v1/forges.

What I left out

  • Running-cell figures. The test doesn't read live memory, CPU or disk for a running cell, because a fixture can't start a cell in this sandbox. Those figures keep their existing coverage of src/spawn/usage.ts.
  • The shape of use. I didn't change it. It stays the page's object, with null where a reading is unknown.

To try Sign in as an admin and call the MCP forges tool. Each item carries size and use. /api/v1/forges returns the same fields.

Approved

Clean and small. clientRows already carried size and use (via forgeUse, the page's function); the tool now names them in its description and doc, the MCP.md row is regenerated with no ceiling raised, and the new test reads a hosted and a cell child through MCP and REST. OpenAPI summary already names size and use. Note the field is use, as the page's row names it. Running-cell figures are not covered by this test (existing usage tests cover them).

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs