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

GET /api/v1/cloud/accounts answers the forge's cloud accounts with each token's use and today's calls, never a secret, as MCP `cloud_accounts` does #8319

Merged opened this

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

Merged

`GET /api/v1/cloud/accounts` now answers the forge's cloud accounts, as MCP `cloud_accounts` does: each token's use and today's calls, never a secret. The gate, `tsc`, the route's own test (`test/api-cloud-accounts.test.ts`) and `test/tui-model-review.test.ts` all pass here.

shipped production is serving it deploy b2c98db

opened this

GET /api/v1/cloud/accounts now answers the forge's cloud accounts, as MCP cloud_accounts does: each token's use and today's calls, never a secret. The gate, tsc, the route's own test (test/api-cloud-accounts.test.ts) and test/tui-model-review.test.ts all pass here.

  • Route: it is in src/http/api/cloud.ts, wired in src/http/api.ts and the OpenAPI contract. It reuses cloudOverview and usesByVendor, so the HTTP and MCP answers agree.
  • Who can call it: a missing session gets 401. A read-only token gets 403, because every vendor call is audited. A signed-in non-admin gets 404, as if the route didn't exist.
  • Why it was parked: the check had gone red on "a non-admin sees no review and cannot decide" in test/tui-model-review.test.ts, a review-screen test this change doesn't touch. It passes here, before and after merging main, so I treated it as unrelated or flaky and changed nothing in it. If the check goes red on it again, that test needs its own look.
  • What I did this time: I merged origin/main into the branch (121 new commits, no conflicts) and pushed it.
  • What I left out: I did not run the full suite or the whole set of tests scripts/fast.ts named (1157 files, over the 5-minute budget). The forge's check runs everything on push.

To try it, call GET /api/v1/cloud/accounts with an admin's read-write token.

🤖 Generated with Claude Code

Closes #8025

commented

GET /api/v1/cloud/accounts now answers the forge's cloud accounts, as MCP cloud_accounts does: each token's use and today's calls, never a secret. The gate, tsc, the route's own test (test/api-cloud-accounts.test.ts) and test/tui-model-review.test.ts all pass here.

  • Route: it is in src/http/api/cloud.ts, wired in src/http/api.ts and the OpenAPI contract. It reuses cloudOverview and usesByVendor, so the HTTP and MCP answers agree.
  • Who can call it: a missing session gets 401. A read-only token gets 403, because every vendor call is audited. A signed-in non-admin gets 404, as if the route didn't exist.
  • Why it was parked: the check had gone red on "a non-admin sees no review and cannot decide" in test/tui-model-review.test.ts, a review-screen test this change doesn't touch. It passes here, before and after merging main, so I treated it as unrelated or flaky and changed nothing in it. If the check goes red on it again, that test needs its own look.
  • What I did this time: I merged origin/main into the branch (121 new commits, no conflicts) and pushed it.
  • What I left out: I did not run the full suite or the whole set of tests scripts/fast.ts named (1157 files, over the 5-minute budget). The forge's check runs everything on push.

To try it, call GET /api/v1/cloud/accounts with an admin's read-write token.

🤖 Generated with Claude Code

Changes requested — before the latest push

Security review of the route is clean: it needs a signed-in user (401), a token that may write (403), and a forge admin (404 otherwise). It reuses cloudOverview, so no secret is returned, and the test checks the secret is absent and that the body equals MCP cloud_accounts. One change is needed. I did not exercise the preview as an admin; an unauthenticated request there returns 401.

  1. Add docs/features/cloud.md saying how to use the cloud accounts: the page, the terminal screen src/tui/screens/cloud.ts, MCP cloud_accounts and this route. No file in docs/features mentions cloud accounts today, and a new door needs its how-to there. Do not put it in README.md, which is capped.
commented

I added docs/features/cloud.md, as sentinel asked, and pushed it. I did not run bun test or the type check, because the only change is that one markdown file.

The new file covers the four ways to reach the cloud accounts: the Settings → Cloud accounts page, the terminal screen (src/tui/screens/cloud.ts), MCP cloud_accounts, and GET /api/v1/cloud/accounts. For the route it gives a curl example and the 401, 403 and 404 answers. It also says no door ever returns a secret.

The README is untouched, since it is capped.

I left out any write route. The HTTP route only lists accounts; attaching, rotating and removing stay on the page and in the terminal, where the token is typed masked. The doc says this.

Approved

The earlier ask, a how-to in docs/features/cloud.md with README untouched, is met. The route checks identity (401), then write scope (403 for ro), then admin (404 for non-admins). It builds the body with cloudOverview, the same function MCP uses, and the test asserts the body equals the MCP result and holds no secret. The route is in the OpenAPI contract and has tests for each refusal. I found nothing new to raise. The preview answered 401 to the agent token I used, which fits an unsigned-in caller, so I could not exercise the admin path there. The clone lacked the previous review head, so I judged from the diff as shown.

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs