Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

docs(x-grok): log order 024, install tokens ship and only the npm test line waits on order 401

nirholas77fccadb071b
diff --git a/prompts/finish/024-x-grok-02-cloud-agent-rate-limits.md b/prompts/finish/024-x-grok-02-cloud-agent-rate-limits.md
index ab00827e5..3ee46f421 100644
--- a/prompts/finish/024-x-grok-02-cloud-agent-rate-limits.md
+++ b/prompts/finish/024-x-grok-02-cloud-agent-rate-limits.md
@@ -1,5 +1,7 @@
# x-grok 02: rate limits that survive a shared cloud agent egress
+**Evolve status (2026-10-08):** built and verified except one Definition of done line. Shipped in `0e9635b52` (install tokens, token-keyed caps, JSON-RPC denials, tests) and `e92209633` (/connect generator, docs, probe script, changelog). Every line passes except "`npm test` passes": `vitest run` still ends 34 failed files / 72 failed tests, the same count measured before this order, 33 of them listed in order 401 and the 34th (`tests/asset-host-liveness.test.js`, tripped by `tests/agent-earnings-board.test.js` naming `cdn.three.ws`) unrelated to this change. Remaining: order 401 makes `npm test` green; then rerun `npm test` and retire this order. No owner action and no migration are needed.
+
How to run: paste this file's repo path into a fresh Claude Code chat in this repository and say "run this work order". Runnable now, no gate. Run after 023.
## Operating clause (binding)
diff --git a/prompts/finish/_context/x-grok-PROGRESS.md b/prompts/finish/_context/x-grok-PROGRESS.md
index 794b25051..ebbf98b7e 100644
--- a/prompts/finish/_context/x-grok-PROGRESS.md
+++ b/prompts/finish/_context/x-grok-PROGRESS.md
@@ -64,3 +64,13 @@ Cross-session handoff for the `x-grok-` orders ([x-grok-00-CONTEXT.md](x-grok-00
- Re-measured at `cf3286879`: production still serves `fe2a8b24f`; `npm run probe:mcp-clients` fails 4 of 7, the same OAuth resource mismatch on the four protected servers, and API-key mode still works on all seven. `db:status` still shows `20261008150000_revenue_direct_settle_backfill.sql` pending, so the deploy gate in owner row 25 is unchanged. `vitest run`: 34 failed files, 72 failed tests, every file already listed in order 401. The order's own suites pass 97 of 97.
- Remaining is unchanged: owner row 25 (apply the backfill, deploy, rerun the probe to `all 7 servers passed`, commit the capture) and order 401 (green `npm test`). Then retire this order.
+
+## 2026-10-08: order 024 (cloud agent rate limits) built, `npm test` line waits on order 401 (order file kept)
+
+- Shipped `0e9635b52`: `api/_mcp-studio/install-token.js` (mint, verify, read `?install=`), `POST /api/mcp-studio/install` (`api/mcp-studio/install.js`, 10 mints an hour per IP via `limits.studioInstallMint`), `api/_mcp-studio/handler.js` keys the transport cap and the generation burst and hourly caps on a verified token ahead of the ChatGPT subject, the Grok `Mcp-Session-Id` and the IP (`studioCaller`). Token callers still share the per-IP pool (300/h) and the global breaker. `STUDIO_LIMITS` in `api/_lib/rate-limit.js` is now the one table of studio numbers. `install` joins the redacted log query keys in `api/_lib/http.js`. 13 tests in `tests/mcp-studio-install-token.test.js` over the real in-memory limiter.
+- Shipped `e92209633`: `/connect` shows "Connector URL for cloud agents" for the free studio (real mint, remembered in localStorage, 429 explained), with a page-wide fix: body is a column flexbox, so a long URL widened `main` past a 360 px viewport (`width: 100%` on `.cn-wrap`). Docs in `docs/mcp-studio.md` (install tokens, denial shape) and `docs/grok.md`. Probe: `node scripts/probe-mcp-install-tokens.mjs --base <origin> --catalog https://three.ws`.
+- Step 0 measured: caps keyed on the IP on `/api/mcp-studio`, the `openai/subject` on `/api/mcp-chatgpt` and the issued `Mcp-Session-Id` on `/api/mcp-grok`, each behind a 300/h per-IP pool when not the IP. Burst 4/min, hourly 30/h, transport 300/min, global breaker `FORGE_PAID_GLOBAL_HOURLY` (600/h). A capped caller got HTTP 429 with a non-JSON-RPC `{error: "rate_limited"}` body and a bare sentence, no reset time and no remedy. No `mcp-studio` log lines in production over 7 days.
+- Behavior change: a capped generation now answers HTTP 200 with a JSON-RPC error (code -32000, `data.limit`, `keyed_on`, `reset_at`, `retry_after`, `remedy`), keeping `Retry-After` and the `RateLimit-*` headers, because the Python MCP SDK raises on a non-2xx before reading the body. The transport cap stays an HTTP 429 but gains `reset_at` and `remedy`.
+- Judgment call: tokens are HMAC-signed and self-authenticating (key from `MCP_INSTALL_SECRET`, else `JWT_SECRET`, domain-separated) rather than stored hashed in a table as task 1 worded it. A token is only a rate-limit key, so storage would buy revocation of nothing; skipping it removes a database round trip from every studio request and a pending migration. Production already has `JWT_SECRET`; set `MCP_INSTALL_SECRET` only to rotate tokens independently.
+- Local dev run (API on :3108, Vite on :3107): token A admitted 4 times, refused on the 5th with `generation_burst keyed_on=install`; token B from the same IP admitted. A no-token caller is refused on the 5th with the install-token remedy.
+- Remaining: `npm test`. `vitest run` ends 34 failed files / 72 failed tests, unchanged by this order; order 401 owns 33 of the files, and `tests/asset-host-liveness.test.js` fails on `tests/agent-earnings-board.test.js` naming `cdn.three.ws`. Retire this order after 401 lands and `npm test` is green.