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

GET /api/v1/forges answers the client list the /forges page and the MCP forges tool show: claimed, running, spend, what needs attention and the next step #9144

Parked opened this
Closed without merging

GET /api/v1/forges now answers { items, nextcursor: null } with the same client-list rows the /forges page and the MCP forges tool read. bun x tsc --noEmit and scripts/gate.ts are clean. test/client-list.test.ts, test/openapi-oa-forges.test.ts, test/api-family-timing.test.ts and test/mcp-size.test.ts pass.

Notes

stopped parked by the crew deploy 973859f

opened this

GET /api/v1/forges now answers { items, next_cursor: null } with the same client-list rows the /forges page and the MCP forges tool read. bun x tsc --noEmit and scripts/gate.ts are clean. test/client-list.test.ts, test/openapi-oa-forges.test.ts, test/api-family-timing.test.ts and test/mcp-size.test.ts pass. I did not run the full suite; the forge runs it on push.

  • Rows: the route reads clientRows instead of listChildren. Each item carries claim state (claimed, null when the child didn't answer), running, reach, spendTodayUsd, ceilingUsd, attention, nextStep, size, use and the heartbeat time. The link is the existing url field, which I did not rename. Order is orderRows, so what needs attention comes first.
  • Cost and access: clientRows already does one state fetch per child with the same two-second timeout. The session, read, render timing phases are unchanged. It is still admin-only with an ro token.
  • OpenAPI: the route summary in src/contract/openapi/routes/getApiV1Forges.ts now names these fields.
  • Test: a new case in test/client-list.test.ts spawns a child, backdates its ledger five days and fakes it as unclaimed. It asserts the API item equals the MCP tool's item for that child and carries attention unclaimed. It also checks the list and order match the tool's, a non-admin gets 403 and a signed-out caller 401.

Left out: no pagination (next_cursor stays null), and no new MCP tool.

Anyone who read the old response will find the shape changed. Each item was the raw child record and is now the client-list row: sentAt replaces createdAt and made replaces done. Fields like bodyId, placement and placementNote are no longer returned. I found nothing in src or test that reads the old shape.

The test run printed sandbox network denials for *--forge.test. They come from the background child lookups; the sandbox blocks the connections and the tests still pass.

Closes #9137

3 earlier comments
commented

GET /api/v1/forges now answers { items, next_cursor: null } with the same client-list rows the /forges page and the MCP forges tool read. bun x tsc --noEmit and scripts/gate.ts are clean. test/client-list.test.ts, test/openapi-oa-forges.test.ts, test/api-family-timing.test.ts and test/mcp-size.test.ts pass. I did not run the full suite; the forge runs it on push.

  • Rows: the route reads clientRows instead of listChildren. Each item carries claim state (claimed, null when the child didn't answer), running, reach, spendTodayUsd, ceilingUsd, attention, nextStep, size, use and the heartbeat time. The link is the existing url field, which I did not rename. Order is orderRows, so what needs attention comes first.
  • Cost and access: clientRows already does one state fetch per child with the same two-second timeout. The session, read, render timing phases are unchanged. It is still admin-only with an ro token.
  • OpenAPI: the route summary in src/contract/openapi/routes/getApiV1Forges.ts now names these fields.
  • Test: a new case in test/client-list.test.ts spawns a child, backdates its ledger five days and fakes it as unclaimed. It asserts the API item equals the MCP tool's item for that child and carries attention unclaimed. It also checks the list and order match the tool's, a non-admin gets 403 and a signed-out caller 401.

Left out: no pagination (next_cursor stays null), and no new MCP tool.

Anyone who read the old response will find the shape changed. Each item was the raw child record and is now the client-list row: sentAt replaces createdAt and made replaces done. Fields like bodyId, placement and placementNote are no longer returned. I found nothing in src or test that reads the old shape.

The test run printed sandbox network denials for *--forge.test. They come from the background child lookups; the sandbox blocks the connections and the tests still pass.

commented

GET /api/v1/forges now answers { items, next_cursor: null } with the same client-list rows as the /forges page and the MCP forges tool. The forge's check failed on my first push because no commit message had a Try: line. I added an empty commit with that line and pushed it, but I haven't seen the check re-run, so it may still fail.

  • Rows and order: the route reads clientRows instead of listChildren. Each item carries claimed, running, reach, spend, attention, nextStep and url, in orderRows order with what needs attention first. The url field is the link; I did not rename it. It is still one state fetch per child with the same timeout.
  • Access: unchanged. It needs an ro token and an admin. A non-admin gets 403 and a signed-out caller gets 401.
  • OpenAPI: the route summary in src/contract/openapi/routes/getApiV1Forges.ts names the new fields.
  • Test: a new case in test/client-list.test.ts backdates a spawned, unclaimed child by five days. It asserts the API item equals the MCP tool's item and carries attention unclaimed. It also checks the 403 and 401 cases.
  • Checked before the first push: bun x tsc --noEmit and scripts/gate.ts were clean. test/client-list.test.ts, test/openapi-oa-forges.test.ts, test/api-family-timing.test.ts and test/mcp-size.test.ts passed.
  • Left out: no pagination (next_cursor stays null) and no new MCP tool.
  • Shape change: each item was the raw child record and is now the client-list row. createdAt became sentAt and done became made. bodyId, placement and placementNote are no longer returned. I found no reader of the old shape in src or test.

Try: as an admin, call GET /api/v1/forges on the preview with an ro token and compare an item with the MCP forges tool's row for the same child.

commented

GET /api/v1/forges now answers the same client list rows as the /forges page and the MCP forges tool. These are admin-only, ro scope, with what needs attention first. I pushed the fix for the two failing tests.

Those two tests still expected the old ledger-shaped rows. The new rows carry made, attention, nextStep, use and the rest, and no longer bodyId, done, placement or template.

  • test/spawn-api.test.ts: the list check now matches the new row shape (name, url, for, apps, size, made, attention).
  • test/spawn-template-api.test.ts: the list check now only confirms the child is listed. The template is still asserted from the ledger file and parent.json in the same test.

Both test files pass (17 tests), and tsc --noEmit shows no errors. I did not run the full suite here; the forge's check runs it on this push.

Left out: I did not add template to the client row, since neither the page nor the MCP tool shows it.

To try it: as an admin, GET /api/v1/forges on the preview with an ro token and compare an item with the MCP forges tool's row.

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