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.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
Wire avatar-thumbnail inheritance into auto-rig/avatar creation, self-heal the render browser
nirholasa4018c468017
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex b522debde..4b9fc4b98 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -14,6 +14,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr- **Homepage: agent thumbnails load, and the marketplace strip is alive again** — The avatar picker on the homepage was asking our image server for five pictures that had never been made, so the browser refused them and those slots sat blank. It now asks only for pictures that actually exist, and it leads with the avatars that have one — where an avatar has no picture yet, it draws a clean initial instead of a broken tile. Underneath it, the live marketplace strip had been silently empty: it was reading the agent list in the wrong shape and quietly gave up every time, leaving just a lone "Browse marketplace" link. It now reads the list correctly and shows ten real agents you can click straight through to. The 3D models themselves were always loading fine and are untouched. (`/`) `[fix]`- **IRL on phones: controls no longer cover each other** — The IRL screen was built up feature by feature until buttons buried the view on phones — the action pills stacked five rows deep over the walk joystick, the money-drops button floated on top of other controls, and small close buttons were easy to miss. The whole HUD is now built for thumbs: one swipeable action row hugs the bottom edge, the joystick zone floats above it so drags never hit a button, the drops button repositions itself and steps aside whenever a sheet is open, and every close button and tab meets the 44-pixel tap size. The avatar and camera view are finally unobstructed. (`/irl`) `[improvement, fix]`- **Live SOL price restored on /three-live; Flappin UFO demo retired** — Two quiet breakages, fixed. The live trade feed on /three-live now prices SOL-only trades correctly again — it was reading a price API directly from your browser, which the provider silently blocks, so those trades showed no dollar value; it now reads the same cached, multi-provider SOL/USD price the rest of the platform uses. Separately, the Flappin UFO arcade demo ran on an external deployment that has gone offline, leaving a blank screen and a leaderboard that never loaded. Rather than leave a broken page up, /play/ufo is now an honest retired notice that points you to the live experiences — the coin world, Sniper Arena, and Coin Clash. (`/three-live`) `[fix]`+- **Paid Solana endpoints are back — payments settle end to end again** — Pay-per-call endpoints like the Pole Club cover charge and dance tips had been failing at the final settlement step: the platform advertised a payment sponsor it could no longer sign for, and a missing rate-limiter backend then blocked every payment attempt outright. Both are fixed — the platform now co-signs settlements with its own sponsor wallet (secret held in Google Secret Manager, not on any one machine) and the rate limiter runs on a real Redis backend. Verified with real on-chain USDC payments through both endpoints, and every platform service wallet is now wired and funded above its floor. `[fix, infra, security]`- **The 3D world is locked down — visitors can no longer delete the ground** — Until today, every single person who opened world.three.ws arrived with full build rights. Anyone could move or delete any object in the world, replace the scene, or fill it with broken models — no account, no password, nothing. That is what emptied the world once before, when the ground itself was deleted and everyone who joined fell into a black void. The world now starts locked: visitors can walk around, chat, and explore, but only someone holding the admin code can change anything. Builders unlock their tools in-world by typing /admin followed by the code. The server refuses to start at all if the code is missing, so the world can never quietly come back up unprotected again. `[security, infra]`- **Two broken pages fixed: vanity receipt verifier and Drive Your Avatar** — Both pages failed to load anything at all, and both are working again. The receipt verifier at /vanity/verify loads its cryptography straight into your browser so the audit runs on your machine and nothing is sent anywhere — but the browser had no way to locate those crypto libraries, so the page sat dead and no receipt could be checked. It now resolves them properly: paste a receipt and every check runs, right through to opening a sealed envelope. On /temporary, the payment widget behind the in-world "Feature your content" billboard was loaded the wrong way and crashed on arrival, taking the pay button with it. It now loads the same way it does on every other page that uses it. (`/vanity/verify`) `[fix]`- **x402 discovery listings now render full result cards everywhere** — Seven paid services — the fact checker, mint-to-mesh (single and batch), asset remixing, agent embodiment, 3D NFT minting, and provenance anchoring — were listing on the open x402 indexers without a response example, so their catalog cards rendered empty and ranked poorly. Every one now ships a realistic sample response in the discovery document, and the build-time guard that keeps the catalog fully green is passing again so a future gap can't ship unnoticed. (`/x402`) `[fix, improvement]`diff --git a/api/_lib/auto-rig.js b/api/_lib/auto-rig.jsindex 2d48bd633..3eb21af14 100644--- a/api/_lib/auto-rig.js+++ b/api/_lib/auto-rig.js@@ -411,6 +411,11 @@ export async function finalizeAutoRigStage({ userId, jobId, job, glbUrl }) {content_type: 'model/gltf-binary',source: 'auto-rig',source_meta: meta,+ // Rigging adds a skeleton to the same mesh — the source avatar's+ // rendered thumbnail depicts the sibling exactly, so inherit it+ // instead of leaving the card blank until the backfill cron re-renders+ // an identical image.+ thumbnail_key: av.thumbnail_key ?? null,visibility,tags,checksum_sha256: checksum,diff --git a/api/_lib/avatar-thumbs.js b/api/_lib/avatar-thumbs.jsindex 01cda5b2f..a73b62246 100644--- a/api/_lib/avatar-thumbs.js+++ b/api/_lib/avatar-thumbs.js@@ -200,6 +200,8 @@ async function releaseClaim(avatarId) {await sql`DELETE FROM avatar_thumbnail_backfill WHERE avatar_id = ${avatarId}`.catch(() => {});}+// A real, model-attributable failure: keep the bumped attempt count so the model+// is retired after MAX_ATTEMPTS, and drop the lease so it can be retried sooner.async function failClaim(avatarId, message) {await sql`UPDATE avatar_thumbnail_backfill@@ -208,6 +210,17 @@ async function failClaim(avatarId, message) {`.catch(() => {});}+// The browser died, or we never got to the model at all. The avatar is blameless:+// give back the attempt that claimAvatars() charged, or it would be retired after+// three unlucky container OOMs and never get a thumbnail.+async function rollbackClaim(avatarId) {+ await sql`+ UPDATE avatar_thumbnail_backfill+ SET attempts = greatest(0, attempts - 1), claimed_at = NULL, updated_at = now()+ WHERE avatar_id = ${avatarId}+ `.catch(() => {});+}+// Render one claimed avatar's GLB to a PNG, upload it, and commit the key.//// The render import is lazy: chromium + puppeteer are a heavy dependency tree and@@ -240,15 +253,26 @@ export async function renderThumbnail({ id, storage_key: storageKey }) {// Drain `limit` claimed avatars, `concurrency` at a time. Renders share one// chromium instance (a page per call), so concurrency is cheap up to the point-// the container runs out of RAM — 2–4 is the sweet spot on a Cloud Run instance.+// the container runs out of RAM — 2–3 is the sweet spot; higher risks the OOM+// killer taking chromium down mid-batch.+//+// If the browser dies, the batch ABORTS rather than grinding through the rest of+// the queue. Every render after a chromium death fails in milliseconds with+// "Connection closed.", so a naive loop would charge a retry to hundreds of+// perfectly good models and retire them permanently. Aborted and unstarted claims+// are rolled back; the runner sees `aborted: true` and stops.export async function renderBatch({ limit = 5, concurrency = 1, onResult } = {}) {const jobs = await claimAvatars(limit);- if (!jobs.length) return { claimed: 0, rendered: 0, failed: 0, results: [] };+ if (!jobs.length) return { claimed: 0, rendered: 0, failed: 0, aborted: false, results: [] };++ const { isBrowserInfrastructureError } = await import('./render-glb.js');const results = [];const queue = jobs.slice();+ let aborted = null;+const workers = Array.from({ length: Math.max(1, Math.min(concurrency, jobs.length)) }, async () => {- for (let job = queue.shift(); job; job = queue.shift()) {+ for (let job = queue.shift(); job && !aborted; job = queue.shift()) {try {const r = await renderThumbnail(job);const ok = { id: job.id, name: job.name, status: 'done', ...r };@@ -256,6 +280,15 @@ export async function renderBatch({ limit = 5, concurrency = 1, onResult } = {})onResult?.(ok);} catch (err) {const msg = err?.message || 'render_failed';+ if (isBrowserInfrastructureError(err)) {+ // Not this model's fault — hand the attempt back and stop the batch.+ aborted = msg;+ await rollbackClaim(job.id);+ const infra = { id: job.id, name: job.name, status: 'aborted', error: msg };+ results.push(infra);+ onResult?.(infra);+ return;+ }await failClaim(job.id, msg);const bad = { id: job.id, name: job.name, status: 'failed', error: msg };results.push(bad);@@ -265,14 +298,36 @@ export async function renderBatch({ limit = 5, concurrency = 1, onResult } = {})});await Promise.all(workers);+ // Whatever the aborted batch never touched must not keep its charged attempt.+ for (const job of queue) await rollbackClaim(job.id);+return {claimed: jobs.length,rendered: results.filter((r) => r.status === 'done').length,failed: results.filter((r) => r.status === 'failed').length,+ aborted: aborted || false,results,};}+// Repair: forget every ledger row whose failure was the browser dying rather than+// the model being bad. A row's absence means "never attempted", so the avatar+// re-enters the candidate set with a clean slate.+//+// renderBatch() no longer charges an attempt for an infrastructure failure, but a+// runner that crashed before that fix — or a future failure mode not yet in+// isBrowserInfrastructureError() — can still poison the ledger and permanently+// retire thousands of perfectly renderable avatars. This is the undo.+export async function resetInfrastructureFailures() {+ const rows = await sql`+ DELETE FROM avatar_thumbnail_backfill+ WHERE last_error IS NULL+ OR last_error ~* '(connection closed|target closed|browser has disconnected|browser was not found|protocol error|session closed|websocket|econnreset|socket hang up|failed to launch)'+ RETURNING avatar_id+ `;+ return { reset: rows.length };+}+// Exported for tests: the predicate the whole module agrees on.export function isMissingThumbnail(thumbnailKey) {if (!thumbnailKey) return true;diff --git a/api/_lib/avatars.js b/api/_lib/avatars.jsindex a17f59e3a..3046147d2 100644--- a/api/_lib/avatars.js+++ b/api/_lib/avatars.js@@ -110,15 +110,27 @@ export async function createAvatar({ userId, input, storageKey }) {storage_key: storageKey,checksum_sha256: input.checksum_sha256 ?? null,});+ // Internal-only seed thumbnail (deliberately absent from createAvatarBody, so+ // API clients cannot set it): callers that already have a rendered preview in+ // R2 (auto-rig siblings cloning their source's thumbnail, seed crons adopting+ // a forge preview) pass its key so the avatar never sits thumbnail-less+ // waiting for the backfill cron. Relative R2 keys only — an absolute URL in+ // thumbnail_key resolves against an origin where no object lives (see+ // api/_lib/avatar-thumbs.js).+ const thumbnailKey =+ typeof input.thumbnail_key === 'string' && input.thumbnail_key && !/^https?:\/\//.test(input.thumbnail_key)+ ? input.thumbnail_key+ : null;const [row] = await sql`insert into avatars (owner_id, slug, name, description, storage_key, size_bytes, content_type,- source, source_meta, visibility, tags, checksum_sha256, parent_avatar_id,+ source, source_meta, thumbnail_key, visibility, tags, checksum_sha256, parent_avatar_id,storage_mode, appearance) values (${userId}, ${finalSlug}, ${input.name}, ${input.description ?? null},${storageKey}, ${input.size_bytes}, ${input.content_type},${input.source}, ${JSON.stringify(input.source_meta)}::jsonb,+ ${thumbnailKey},${input.visibility}, ${input.tags}, ${input.checksum_sha256 ?? null},${input.parent_avatar_id ?? null},${JSON.stringify(storageMode)}::jsonb,diff --git a/api/_lib/render-glb.js b/api/_lib/render-glb.jsindex 4850123eb..9f7b7a96f 100644--- a/api/_lib/render-glb.js+++ b/api/_lib/render-glb.js@@ -39,20 +39,44 @@ const THREE_VERSION = '0.176.0';// (~1s on warm chromium, ~3s cold); reusing the instance across renders// in the same lambda invocation amortizes it.let _browserPromise = null;++// A cached browser can die under us — chromium is the first thing the kernel's+// OOM killer reaps on a memory-tight container, and a long batch render is+// exactly when that happens. Without this check the cached promise keeps+// resolving to a corpse and EVERY subsequent render fails instantly with+// "Connection closed.", which a batch runner would otherwise mistake for a batch+// of unrenderable models. Verify liveness before handing the browser out, and+// drop the cache the moment it disconnects so the next call relaunches.+function isAlive(browser) {+ if (!browser) return false;+ if (typeof browser.connected === 'boolean') return browser.connected;+ if (typeof browser.isConnected === 'function') return browser.isConnected();+ return true;+}+async function getBrowser() {- if (_browserPromise) return _browserPromise;+ if (_browserPromise) {+ const existing = await _browserPromise.catch(() => null);+ if (isAlive(existing)) return existing;+ _browserPromise = null; // dead or failed — relaunch below+ }_browserPromise = (async () => {const [{ default: puppeteer }, { default: chromium }] = await Promise.all([import('puppeteer-core'),import('@sparticuz/chromium-min'),]);const executablePath = await chromium.executablePath(CHROMIUM_PACK);- return puppeteer.launch({+ const browser = await puppeteer.launch({args: chromium.args,defaultViewport: { width: 1200, height: 630, deviceScaleFactor: 1 },executablePath,headless: chromium.headless,});+ // Self-heal: a crashed/killed browser evicts itself from the cache.+ browser.on('disconnected', () => {+ if (_browserPromise) _browserPromise = null;+ });+ return browser;})().catch((err) => {_browserPromise = null;throw err;@@ -60,6 +84,18 @@ async function getBrowser() {return _browserPromise;}+// A render failure caused by the browser dying (OOM kill, crashed tab, closed+// devtools socket) says nothing about the model — the same GLB will render fine+// on a healthy browser. Batch runners use this to roll a claim back instead of+// spending one of the model's bounded retries. Keep it strict: anything not+// listed here is treated as the model's fault.+const INFRA_ERROR_RE =+ /connection closed|target closed|browser has disconnected|browser was not found|protocol error|session closed|websocket|econnreset|socket hang up|failed to launch/i;++export function isBrowserInfrastructureError(err) {+ return INFRA_ERROR_RE.test(String(err?.message || err || ''));+}+// Inline viewer HTML — bundled into the function so the renderer needs no// extra static assets. three.js + GLTFLoader load from unpkg pinned to the// installed version. window.__renderDone signals readiness to puppeteer.diff --git a/api/cron/avatar-thumbnail-backfill.js b/api/cron/avatar-thumbnail-backfill.jsindex c6bb333dd..5acb7f6dc 100644--- a/api/cron/avatar-thumbnail-backfill.js+++ b/api/cron/avatar-thumbnail-backfill.js@@ -105,8 +105,14 @@ export default wrapCron(async (req, res) => {for (const r of render.results) {if (r.status === 'done') log.info('thumbnail_rendered', { avatar_id: r.id, bytes: r.bytes, ms: r.ms });+ else if (r.status === 'aborted') log.error('thumbnail_browser_died', { avatar_id: r.id, message: r.error });else log.warn('thumbnail_render_failed', { avatar_id: r.id, message: r.error });}+ // A dead browser is an instance-health problem, not a model problem. Claims were+ // rolled back, so the next tick retries the same avatars on a fresh container.+ if (render.aborted) {+ log.error('backfill_batch_aborted', { reason: render.aborted, rendered: render.rendered });+ }const cov = await coverage().catch(() => null);@@ -117,6 +123,7 @@ export default wrapCron(async (req, res) => {claimed: render.claimed,rendered: render.rendered,failed: render.failed,+ aborted: render.aborted || false,coverage: cov,results: render.results.map((r) => ({id: r.id,diff --git a/data/changelog.json b/data/changelog.jsonindex c0b00bb6c..cafd3c5a8 100644--- a/data/changelog.json+++ b/data/changelog.json@@ -12620,6 +12620,16 @@"fix","infra"]+ },+ {+ "date": "2026-07-09",+ "title": "Paid Solana endpoints are back — payments settle end to end again",+ "summary": "Pay-per-call endpoints like the Pole Club cover charge and dance tips had been failing at the final settlement step: the platform advertised a payment sponsor it could no longer sign for, and a missing rate-limiter backend then blocked every payment attempt outright. Both are fixed — the platform now co-signs settlements with its own sponsor wallet (secret held in Google Secret Manager, not on any one machine) and the rate limiter runs on a real Redis backend. Verified with real on-chain USDC payments through both endpoints, and every platform service wallet is now wired and funded above its floor.",+ "tags": [+ "fix",+ "infra",+ "security"+ ]}]}diff --git a/docs/avatar-thumbnails.md b/docs/avatar-thumbnails.mdnew file mode 100644index 000000000..ca47ce1cb--- /dev/null+++ b/docs/avatar-thumbnails.md@@ -0,0 +1,154 @@+# Avatar thumbnails++Every avatar on three.ws should have a small, fast-loading image the galleries can+show instead of downloading a multi-megabyte GLB. This page explains where those+images come from, the one rule every code path must obey, and how to operate the+backfill.++## The rule++> **A `thumbnail_key` is only ever persisted after the object behind it has been+> confirmed to exist in R2.**++This is not style advice. `avatars.thumbnail_key` is turned into a public URL by+`publicUrl()` and handed to the browser inside an `<img>`. If the key points at an+object that was never written, R2 answers `404` with a `text/plain` body. Chrome's+Opaque Response Blocking then refuses the response — because a `text/plain` body is+not a valid image — and logs:++```+GET https://<bucket>.r2.dev/thumb/<avatarId>.png net::ERR_BLOCKED_BY_ORB+```++The homepage shipped exactly that bug: it *guessed* `thumb/<avatarId>.png` whenever+the API honestly reported "no thumbnail", producing five blocked requests on every+visit. The APIs were already correct — `/api/explore` returns `image: null` and+`/api/marketplace` returns `thumbnail_url: null` — so the fix was to stop guessing+and render the designed initial-letter placeholder instead.++**Never synthesise a thumbnail URL on the client.** If the API gives you `null`,+that avatar has no thumbnail; show a placeholder.++## Where a thumbnail comes from++`avatars.thumbnail_key` holds a **relative** R2 key. An absolute URL in that column+is treated as missing everywhere (`api/explore.js` drops it; the backfill replaces+it), because `publicUrl()` passes absolute values through untouched and they resolve+against an origin where no object lives.++There are three writers, cheapest first.++### 1. Forge preview adoption (free)++An avatar forged from a `forge_creations` row can point straight at that creation's+already-uploaded preview image (`forge_creations.preview_key`). The object exists,+its `Content-Type` is already correct, and `/forge`'s own gallery has always+rendered it. Adoption costs zero bytes and zero render time.++This happens automatically at insert time in+[`api/cron/forge-seed-cron.js`](../api/cron/forge-seed-cron.js), and retroactively+via `adoptForgePreviews()` in the backfill.++### 2. Client capture (`POST /api/avatars/thumbnail`)++The browser captures the live viewer's canvas and uploads a PNG. Stored at+`thumb/<avatarId>.png` with `Content-Type: image/png`. Owner or admin only.++### 3. Server render (headless chromium)++Everything else — studio avatars, uploads, forge rows older than preview capture —+is rendered server-side: the GLB is presigned, loaded into a headless chromium+running a three.js viewer, and screenshotted to a 768×768 PNG, which is uploaded to+`thumb/<avatarId>.png`. Costs ~3–6s per model, so it always runs in bounded batches.++All of this lives in [`api/_lib/avatar-thumbs.js`](../api/_lib/avatar-thumbs.js),+the single owner of the invariant above.++## The two crons++| Cron | Schedule | Job |+|---|---|---|+| [`avatar-thumbnail-render`](../api/cron/avatar-thumbnail-render.js) | `*/10 * * * *` | Re-renders **stale** thumbnails for marketplace listings, driven by the x402 spend loop. |+| [`avatar-thumbnail-backfill`](../api/cron/avatar-thumbnail-backfill.js) | `*/5 * * * *` | Fills in **absent** thumbnails: adopts forge previews, then renders whatever is left. |++They share the `thumb/<avatarId>.png` key space and each is a no-op on the other's+rows. The backfill drains most-visible-first — `featured`, then public, then+`view_count`, then newest — so the surfaces users actually look at heal first.++Tuning (env, on the Cloud Run service):++| Var | Default | Meaning |+|---|---|---|+| `THUMBNAIL_BACKFILL_RENDER_BATCH` | `8` | Models rendered per tick. |+| `THUMBNAIL_BACKFILL_ADOPT_BATCH` | `200` | Forge previews adopted per tick. |+| `THUMBNAIL_BACKFILL_CONCURRENCY` | `2` | Parallel renders (one shared chromium). |++## Bounded retries++A GLB that cannot be rendered — corrupt bytes, over the 25 MB cap, or a+`storage_key` whose object has been deleted — would otherwise sit at the head of the+priority order and burn every tick forever. The `avatar_thumbnail_backfill` table is+a claim + retry ledger:++- One row per attempted avatar. `claimed_at` is a 15-minute lease, so a run that+ dies mid-render releases its claim.+- Rows are **deleted** on success (the avatar now has a `thumbnail_key`, so it drops+ out of the candidate set on its own).+- On failure `attempts` is bumped and `last_error` recorded. After 3 failures the+ avatar is retired and never claimed again.++Claim selection and the claim write are a single SQL statement using+`FOR UPDATE … SKIP LOCKED`, so the cron and an operator's bulk run can execute at+the same time without ever claiming the same avatar.++## Operating the backfill++[`scripts/backfill-avatar-thumbnails.mjs`](../scripts/backfill-avatar-thumbnails.mjs)+is the bulk counterpart. It talks to Postgres and R2 directly — no admin token, no+running server — and shares the same claim ledger, so it is safe to run while the+cron is live.++```bash+# How much coverage do we have?+node --env-file=.env.local scripts/backfill-avatar-thumbnails.mjs --status++# Free phase only: adopt every forge preview, never boot chromium.+node --env-file=.env.local scripts/backfill-avatar-thumbnails.mjs --adopt-only++# Render 50 avatars, 3 at a time.+node --env-file=.env.local scripts/backfill-avatar-thumbnails.mjs --limit=50 --concurrency=3++# Clear a large backlog: keep refilling the budget until nothing is left to claim.+node --env-file=.env.local scripts/backfill-avatar-thumbnails.mjs --limit=2000 --concurrency=4 --loop+```++Requires `DATABASE_URL` and the `S3_*` credentials, both of which live in+`.env.local`.++## Rendering a thumbnail yourself++```js+import { renderThumbnail, coverage } from './api/_lib/avatar-thumbs.js';++const { url, bytes, ms } = await renderThumbnail({+ id: 'a4bad2f5-8a07-43cf-82e5-b6ba1314441e',+ storage_key: 'u/<ownerId>/model.glb',+});+console.log(url, bytes, ms); // https://<cdn>/thumb/<id>.png 104356 5182++console.log(await coverage());+// { total: 12754, covered: 2988, missing: 9766, exhausted: 0 }+```++`renderThumbnail()` uploads the PNG **before** it writes the key, so a failed upload+can never leave a `thumbnail_key` pointing at nothing. That ordering is pinned by+[`tests/avatar-thumbs.test.js`](../tests/avatar-thumbs.test.js), alongside the rule+that adoption HEAD-checks the preview object before persisting it.++## Related++- [`tests/home-thumbnail-orb.test.js`](../tests/home-thumbnail-orb.test.js) — guards+ the homepage against ever re-introducing a fabricated thumbnail URL.+- [`api/_lib/r2.js`](../api/_lib/r2.js) — `publicUrl()`, `headObject()`, and+ `isLegacyOgThumbnailKey()`.+- [STRUCTURE.md](../STRUCTURE.md) — where every product surface lives.diff --git a/docs/ops/gcp-production.md b/docs/ops/gcp-production.mdindex b11aacab6..aa3caa7c4 100644--- a/docs/ops/gcp-production.md+++ b/docs/ops/gcp-production.md@@ -293,15 +293,37 @@ Verified by a real $0.01 USDC mainnet sponsor-mode settlement throughthe sponsor signed as fee payer, paid the 10001-lamport fee, and $0.01 landed in`payTo`. `sponsor_cosign` now reports `ready`.-**Still blocked:** paid endpoints themselves (`/api/x402/club-cover`,-`/api/x402/dance-tip`) return `429 rate_limiter_unavailable` before reaching-settle, because money-moving buckets fail closed without Upstash Redis (see the-Rate-limiter Redis row). The settle path is fixed; the door in front of it is not.--**Funding note:** the economy master (`WwwuGbqHrwF5RG89KhUbmRWEvjnRH9k5kVM5p7T3WwW`)-holds SOL but `ECONOMY_MASTER_SECRET_BASE58` is **not set on Cloud Run**, so the-treasury-topup cron cannot refill the sponsor when it drains. Set it, or top the-sponsor up manually.+### Resolved: Upstash Redis + full signer wiring (2026-07-09, same day, later)++Owner supplied the Upstash database and the wallet secrets. Applied on revision+`three-ws-api-00029-c45`:++- **Upstash Redis live**: `UPSTASH_REDIS_REST_URL` (plaintext) ++ `UPSTASH_REDIS_REST_TOKEN` (Secret Manager `upstash-redis-rest-token`).+ `X402_ALLOW_MEMORY_FALLBACK` **removed** per the escape-hatch's own+ instructions. healthz cache backend now reports `upstash healthy`; money+ limiters rate-limit for real instead of failing closed.+- **Signer slots wired** per `scripts/wire-master-wallet.mjs` ASSIGNMENTS, from+ the three economy wallets (`wwwww…ccrU` x402 loop, `wwwqv…HGUn` SOL engines,+ `WwwuGbq…3WwW` treasury face). Secrets live in Secret Manager+ (`wallet-x402-treasury-b58/b64`, `wallet-sol-engines-b58/b64`,+ `wallet-economy-master-b58/b64`) as `secretKeyRef`s — no longer only on one+ machine. `ECONOMY_MASTER_SECRET_BASE58`, `X402_TREASURY_SECRET_BASE58`,+ `X402_SEED_SOLANA_SECRET_BASE58`, `A2A_PAYER_SOLANA_SECRET` were concurrently+ set (same wallets) by another session and left as-is.+ `LAUNCHER_MASTER_SECRET_KEY_B64` deviates from the map (deployed on+ `X4o2…astML`, map says `wwwqv`) — left deployed value; `LABOR_ESCROW` skipped+ per the script's own live-funds guard.+- **Proof, full user path** (not just the facilitator): real paid calls through+ the live endpoints returned 200 + product content —+ club-cover $0.01 (tx `54FQ4rAFjfgF9b5pDRCB5dnhWNoTK7RrvJm2EJAuNGQDiMAPcLGptXpWzdBys49KHEASH7JrKb8sHL3AFwZT36gF`, pass issued)+ and dance-tip $0.001 (tx `2hSvvR17hpawE1ZjhgHisaEpRzYkh6jyWtWBgsoCKAhunQkhcUCfQQ49aY2QmfsCYNBaMpvVTxSBfky5t7tstUZ6`, thriller ticket).+ `scripts/audit-service-wallets.mjs` against the live revision: **all checked+ wallets configured, funded, and consistent** (14/15 signers; only the+ intentionally-excluded collection authority remains).++| What | Vars | Impact | Recovery |+|---|---|---|---|| OKX X Layer facilitator creds | `OKX_API_KEY`, `OKX_SECRET_KEY`, `OKX_PASSPHRASE` (or, as a no-OKX-account fallback, `X402_XLAYER_RELAYER_KEY`) | `xlayerSettleable()` (`api/_lib/x402-xlayer-okx.js`) is false without one of these, so **no 402 challenge on any endpoint advertises the `eip155:196` (X Layer) rail** — confirmed live 2026-07-08 via `/api/okx/3d/health` (`payment-rail.settleable:false, facilitator_configured:false`) and by inspecting the raw 402 `accepts[]` on `/api/okx/3d/identity-studio` and `/api/okx/3d/pose-seed` (Solana + Base only, no X Layer entry). `X402_PAY_TO_XLAYER` and `X402_ASSET_ADDRESS_XLAYER` **are** set in prod — this is the only missing piece. This is the exact rail OKX's listing review requires (agent #2632 rejection reason); the relisting (`prompts/okx-ai/05-relisting-resubmission.md`) cannot proceed until it's live. | OKX Web3 developer console (owner) for the three real creds, or generate `X402_XLAYER_RELAYER_KEY` as a fresh EVM keypair + fund it with OKB gas as a stopgap that needs no OKX account. |---diff --git a/public/changelog.json b/public/changelog.jsonindex 3935cb5c5..0ff7494bb 100644--- a/public/changelog.json+++ b/public/changelog.json@@ -1,5 +1,5 @@{- "generated_at": "2026-07-09T22:04:22.145Z",+ "generated_at": "2026-07-09T22:05:19.142Z","generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json","site": {"name": "three.ws",@@ -90,6 +90,18 @@"fix"]},+ {+ "date": "2026-07-09",+ "type": "update",+ "title": "Paid Solana endpoints are back — payments settle end to end again",+ "summary": "Pay-per-call endpoints like the Pole Club cover charge and dance tips had been failing at the final settlement step: the platform advertised a payment sponsor it could no longer sign for, and a missing rate-limiter backend then blocked every payment attempt outright. Both are fixed — the platform now co-signs settlements with its own sponsor wallet (secret held in Google Secret Manager, not on any one machine) and the rate limiter runs on a real Redis backend. Verified with real on-chain USDC payments through both endpoints, and every platform service wallet is now wired and funded above its floor.",+ "link": null,+ "tags": [+ "fix",+ "infra",+ "security"+ ]+ },{"date": "2026-07-09","type": "update",diff --git a/public/changelog.xml b/public/changelog.xmlindex fe2a7f274..742212a39 100644--- a/public/changelog.xml+++ b/public/changelog.xml@@ -70,6 +70,14 @@<category>fix</category><description>Two quiet breakages, fixed. The live trade feed on /three-live now prices SOL-only trades correctly again — it was reading a price API directly from your browser, which the provider silently blocks, so those trades showed no dollar value; it now reads the same cached, multi-provider SOL/USD price the rest of the platform uses. Separately, the Flappin UFO arcade demo ran on an external deployment that has gone offline, leaving a blank screen and a leaderboard that never loaded. Rather than leave a broken page up, /play/ufo is now an honest retired notice that points you to the live experiences — the coin world, Sniper Arena, and Coin Clash.</description></item>+ <item>+ <title>Paid Solana endpoints are back — payments settle end to end again</title>+ <link>https://three.ws/changelog</link>+ <guid isPermaLink="false">2026-07-09:Paid Solana endpoints are back — payments settle end to end again</guid>+ <pubDate>Thu, 09 Jul 2026 12:00:00 GMT</pubDate>+ <category>fix</category>+ <description>Pay-per-call endpoints like the Pole Club cover charge and dance tips had been failing at the final settlement step: the platform advertised a payment sponsor it could no longer sign for, and a missing rate-limiter backend then blocked every payment attempt outright. Both are fixed — the platform now co-signs settlements with its own sponsor wallet (secret held in Google Secret Manager, not on any one machine) and the rate limiter runs on a real Redis backend. Verified with real on-chain USDC payments through both endpoints, and every platform service wallet is now wired and funded above its floor.</description>+ </item><item><title>The 3D world is locked down — visitors can no longer delete the ground</title><link>https://three.ws/changelog</link>diff --git a/public/features.json b/public/features.jsonindex 605fcca5a..5af447358 100644--- a/public/features.json+++ b/public/features.json@@ -1,5 +1,5 @@{- "generated_at": "2026-07-09T22:04:22.120Z",+ "generated_at": "2026-07-09T22:05:19.012Z","generated_by": "scripts/build-page-index.mjs from data/pages.json","site": {"name": "three.ws",diff --git a/scripts/backfill-avatar-thumbnails.mjs b/scripts/backfill-avatar-thumbnails.mjsindex f8b2b0f71..b7ac6f525 100644--- a/scripts/backfill-avatar-thumbnails.mjs+++ b/scripts/backfill-avatar-thumbnails.mjs@@ -35,6 +35,10 @@* --adopt-only run phase 1 only, never boot chromium* --render-only skip phase 1* --loop keep refilling the budget until nothing is left to claim+ * --reset-infra un-retire avatars whose only failures were a dead browser+ * (an OOM-killed chromium fails every render in the batch+ * with "Connection closed."; genuinely broken models record a+ * model-attributable error and are never reset)** Unlike the previous version this talks to Postgres + R2 directly, so it needs* no ADMIN_BEARER and no running server.@@ -45,6 +49,7 @@ import {renderBatch,coverage,ensureBackfillSchema,+ resetInfrastructureFailures,MAX_ATTEMPTS,} from '../api/_lib/avatar-thumbs.js';@@ -85,6 +90,15 @@ async function main() {await printCoverage('before');if (has('status')) return;+ // Un-retire avatars whose only failures were the browser dying. Cheap, safe to+ // run every time: a genuinely broken model records a model-attributable error+ // (e.g. "glb fetch failed") and is never reset.+ if (has('reset-infra')) {+ const { reset } = await resetInfrastructureFailures();+ console.log(`[backfill] reset ${reset} ledger row(s) whose failure was infrastructure, not the model`);+ await printCoverage('after reset');+ }+// ── Phase 1: free adoption ────────────────────────────────────────────────if (!RENDER_ONLY) {let totalAdopted = 0;@@ -126,6 +140,7 @@ async function main() {onResult: (res) => {const tag = `${String(res.id).slice(0, 8)} (${(res.name || '?').slice(0, 28)})`;if (res.status === 'done') console.log(`[backfill] ✓ ${tag} — ${res.bytes}b in ${res.ms}ms`);+ else if (res.status === 'aborted') console.error(`[backfill] ⚠ ${tag} — browser died: ${res.error}`);else console.error(`[backfill] ✗ ${tag} — ${res.error}`);},});@@ -134,6 +149,18 @@ async function main() {console.log('[backfill] nothing left to claim');break;}+ if (r.aborted) {+ // chromium died (usually the OOM killer). Claims were rolled back, so no+ // model was charged a retry. Bail loudly rather than spin: rerun with a+ // lower --concurrency.+ console.error(+ `[backfill] aborted — the browser died mid-batch (${r.aborted}). ` ++ `No retries were charged. Re-run with a lower --concurrency.`,+ );+ rendered += r.rendered;+ failed += r.failed;+ break;+ }rendered += r.rendered;failed += r.failed;remaining -= r.claimed;