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.

feat(ops): watch x402 settle success rate, the signal the 502 wave hid behind

nirholasff1285a35e47
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0a49f2d30..8dc8a836b 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -16,6 +16,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **Community feed hover previews no longer blend into the photo underneath** — Hovering a card in the Fresh from the Forge strip spins the actual 3D model in place. The spinning model used to render on a nearly transparent background, so it visually collided with the card's photo thumbnail and looked broken, with a stray browser tooltip on top. The preview now draws on a solid backdrop, the redundant tooltip is gone, image-to-3D cards are labeled with their engine name (Hunyuan3D) instead of an internal id, and every card can now be opened from the keyboard. (`/forge`) `[fix, improvement]`
- **Creator profile pages work again, plus a site-wide reliability sweep** — A full automated sweep of every page and API endpoint on the site caught a bug that replaced creator profile pages (three.ws/u/yourname) with an error message. That is fixed. The sweep also repaired the login captcha for rate-limited sign-ins, fixed dead links in the dashboard and two blog posts, and added two dozen previously unlisted pages to the site index so search engines and the sitemap can find them. The audit now runs with deeper checks (blank-page detection, visible error detection, and link crawling) so regressions like these get caught before anyone hits them. (`/changelog`) `[fix, improvement]`
- **Forge prompt ideas are now endless, and every one forges beautifully** — The example chips, empty-stage starters, and the Surprise me button on the Forge used to rotate through a fixed list of 48 prompts. They now draw from a curated prompt generator with thousands of combinations: statues, figurines, potted plants, crystals, food, crafted props, and cozy miniatures, each paired only with materials and finishes the 3D engine renders well. Every visit opens with a fresh set, and the prompt coach no longer mistakes words like mushroom for a scene request. (`/forge`) `[improvement]`
+- **Free 3D API tells agents exactly when to check back** — When a text-to-3D generation needs a moment and hands back a job to poll, the free /api/3d/generate API now includes how long to wait before checking again (a retryAfter value, also sent as the standard Retry-After header) plus an estimated time-to-ready and a stable creation id. Agents that honor the hint poll on a sensible schedule instead of hammering the endpoint, so they stop tripping the rate limit and the shared free GPU lane carries less needless traffic. Fully backward-compatible: existing callers keep working unchanged. (`/docs/3d-api`) `[improvement]`
- **Image to 3D gets its own front door** — Turning a photo into a 3D model has worked in the Forge for a while, but it hid behind a page titled Text to 3D, and the only photo surface people could find was Selfie to Avatar. There is now a dedicated Image to 3D page (three.ws/image-to-3d) that opens the Forge with the photo tab already selected, an Image to 3D link in the main navigation and footers, and clear pointers between the selfie tools (for making an avatar of you) and Image to 3D (for making a model of any object). The Forge and its feature page are also retitled to say what they actually do: text and images. (`/image-to-3d`) `[improvement]`
- **Image-to-3D leaps forward: true PBR materials on a flagship GPU** — The Forge realism engine (Hunyuan3D 2.1) is now live on a new flagship-class GPU (NVIDIA RTX PRO 6000 Blackwell, 96 GB). High-tier image-to-3D generations now come out with true physically-based materials: real metal, roughness, and color maps that catch light like photographed objects instead of flat plastic. The new hardware is also dramatically faster; the full shape-plus-texture pass finished in about a minute in our live verification, where the previous GPU class could not even load the model. Alongside it, every 3D generation service is healthy again and all of yesterday’s reliability fixes are fully rolled out across the fleet. (`/forge`) `[feature, improvement, infra]`
- **IRL is calmer to use: one clear next step, name tags that stay readable** — The live IRL view stopped talking over itself. Before, you could see "Turn on Camera AR" and "Agent pinned" at the same time, which contradicted each other; now the guidance line and the status line always agree. The floating name tag above each nearby agent is kept clear of the top bar instead of colliding with the Back and Live chips, and when two agents line up front-to-back their tags fan out so both names stay legible rather than stacking into one smudge. The "an agent is near, look around" nudge no longer appears when that agent is already standing in front of you, and it clears itself the moment you turn to face them. (`/irl`) `[improvement]`
@@ -25,6 +26,7 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **Selfie to 3D works again: finished avatars were being thrown away at the last step** — Since the July infrastructure move, the selfie and photo reconstruction pipeline was failing with a generic "hit a snag" message even though the 3D engine finished every job. The security check that vets where a finished model may be downloaded from did not yet trust our own Google Cloud Storage results, so completed avatars were rejected at the final step. The check now recognizes our own storage, and any generation that was wrongly marked failed has been recovered. If your selfie avatar failed recently, it should now appear, or simply retry. `[fix]`
- **The agent-to-agent payment economy runs far cheaper and now cycles hundreds of distinct payers** — Two improvements to the closed-loop x402 agent economy that dogfoods every paid endpoint on the platform. First, a fix: a background wallet-consolidation job was quietly closing the ring's payment account after every settlement, forcing the next one to recreate it and pay account rent each time. That single bug had pushed the real fee cost to roughly a hundred times where it should be. With it fixed and single-signature settlement turned on, each settlement is back to the network floor of a few thousandths of a cent, and the ring's working balance stays in the loop instead of leaking away. Second, a new capability: the ring can now cycle payments through a reusable pool of hundreds to a thousand distinct wallets instead of one, so the economy reads as many participants rather than a single account, with no extra cost per payment. The pool is off until funded and activated, and every wallet in it stays clearly labeled internal dogfooding, not organic demand. (`/admin/ring`) `[fix, improvement, infra]`
- **The Money Pulse is beating again** — The live money feed went quiet after the July 7 infrastructure move: the switch that powers the autonomous agent activity loop did not survive the migration, so agents stopped tipping, trading, paying and launching. The switch is back on and the feed is live again, with real on-chain tips, trades, payments and coin launches flowing within minutes of the fix. The production runbook now documents the switch so a future migration cannot silently drop it. (`/pulse`) `[fix, infra]`
+- **The status page now tracks whether paid API calls actually settle, not just whether the payment rail is switched on** — The July payment-settlement bug ran for eight days before anyone noticed, because every health check reported the x402 rail as 'armed' and the discovery endpoint as 'up' while a third of real settlements were quietly failing. The public status page and /api/healthz now carry a new signal, x402 settlement success, that reads the actual settle outcomes over a rolling window and reports the success rate. It counts only genuine payment-rail faults (server errors, rejected payments, RPC failures) and ignores unrelated noise, and it pages operations the moment the rate drops, so a silent settlement regression surfaces in hours instead of days. (`/status`) `[infra, improvement]`
- **The viewer's Create buttons now take you straight to the Forge** — On the shared-model viewer page, the "Create a 3D model" button (shown when a link is missing its model) and the "Make your own" button in the footer used to drop you on the homepage, leaving you to hunt for the generator. Both now go directly to the free text-to-3D Forge so you can start creating in one click. (`/viewer`) `[fix]`
- **three.ws now speaks 11 languages** — The site's language switcher gained nine new languages on top of English and Spanish: Simplified Chinese, Japanese, Korean, French, German, Brazilian Portuguese, Arabic, Hindi, and Russian. Pick your language from the switcher and the copy re-renders instantly, with your choice remembered for next time; if your browser is already set to one of these, three.ws now greets you in it automatically. Arabic lays out right-to-left. Brand and protocol terms like $THREE, USDC, and three.ws stay exact in every language. `[feature]`
- **Your models now look studio-quality everywhere, not just in the Forge** — The viewer page that opens when someone follows a shared model link now renders with the same rich lighting, tone mapping, and exposure as the Forge studio where the model was created, so what you share is what they see. The copy-paste embed snippet ships those same settings, meaning models dropped onto your own site no longer look flat compared to the preview. Avatars in agent embed cards now cast a soft ground shadow instead of floating, and the homepage 3D showcase stops burning your battery when it is scrolled out of view or in a background tab. (`/viewer`) `[improvement]`
diff --git a/api/_lib/ops/subsystem-health.js b/api/_lib/ops/subsystem-health.js
index eb3b13826..4ce6063ef 100644
--- a/api/_lib/ops/subsystem-health.js
+++ b/api/_lib/ops/subsystem-health.js
@@ -34,6 +34,7 @@ import { cacheHealth, cacheGet } from '../cache.js';
import { heliusHealth } from '../balances.js';
import { rateLimiterHealth } from '../rate-limit.js';
import { checkRingInvariants } from '../x402/ring-allowlist.js';
+import { gatherX402SettleHealth } from './x402-settle-health.js';
const DB_PING_TIMEOUT_MS = 2_500;
const DB_SLOW_MS = 1_000;
@@ -341,6 +342,9 @@ export async function gatherSubsystemHealth({ probeDb = true } = {}) {
Promise.resolve(checkRateLimiter()),
Promise.resolve(checkHelius()),
Promise.resolve(checkRing()),
+ // Settle SUCCESS RATE, not just "armed" — reads x402_autonomous_log. Needs
+ // the DB, so it shares the probeDb gate; skipped-DB callers get `unknown`.
+ probeDb ? gatherX402SettleHealth() : Promise.resolve({ name: 'x402_settle', label: 'x402 settlement success', status: 'unknown', detail: 'settle read skipped' }),
checkWorld(),
Promise.resolve(checkX402Config()),
probeDb ? checkSniper() : Promise.resolve({ name: 'sniper', label: 'Sniper worker (Cloud Run)', status: 'unknown', detail: 'probe skipped' }),
diff --git a/api/_lib/ops/x402-settle-health.js b/api/_lib/ops/x402-settle-health.js
new file mode 100644
index 000000000..b4a386f3b
--- /dev/null
+++ b/api/_lib/ops/x402-settle-health.js
@@ -0,0 +1,184 @@
+// @ts-check
+// x402 settle-success-rate sensor — the health signal the July 2026 502 wave
+// proved was missing.
+//
+// The existing checks answer "is the ring ARMED?" (checkRing → invariants,
+// checkX402Config → pay-to + fee payer present) and "is discovery UP?"
+// (uptime-check probes /.well-known/x402.json). All three read healthy while a
+// third of real settlements silently fail: from 2026-07-09 to 2026-07-17 the
+// self-facilitator rejected ~300 settles/6h (same-signature collisions surfaced
+// as `http_502`) yet every sensor above stayed green because the ring was
+// configured, discovery answered 200, and *some* payments still landed. Eight
+// days, no page. This module closes that hole by reading the only authoritative
+// signal — the outcome the ring records for every paid call in
+// `x402_autonomous_log` — and reporting the settle SUCCESS RATE.
+//
+// What counts, and the nuance that makes the signal usable
+// --------------------------------------------------------
+// `success=true, amount_atomic>0` → a settlement LANDED (the numerator).
+// A failure only counts against the rate when it is a PAYMENT-RAIL fault:
+// facilitator/settle 5xx, a 402 (payment rejected), or an RPC/broadcast/confirm
+// fault. Everything else the ring records is deliberately excluded, because the
+// log is noisy with things that are NOT settle failures:
+// - caller/endpoint mismatches — http_400/404/405/409 (the ring POSTing to a
+// GET-only endpoint, or passing args a handler rejects). ~800/6h in prod:
+// including them would peg the sensor red and bury a real settle regression.
+// - benign guards — cap_would_exceed, insufficient_payer_usdc, breaker_tripped,
+// wallet_unconfigured, no_solana_accept: the ring CHOOSING not to pay. Ring
+// funding has its own monitor (x402/wallet-balance-monitor.js).
+// - downstream pipeline notes — *_calls_failed, config_missing: the payment
+// settled (or was never attempted); the failure is in value extraction.
+// The fault set is an allowlist of rail faults, kept broad on the rail dimension
+// (any 5xx, any RPC/broadcast/settle/confirm/simulation/timeout signature) so a
+// NEW settle failure mode is caught without a code change — exactly what the 502
+// wave needed. When a genuinely new benign reason starts showing up as a fault,
+// add it to EXCLUDED_HINT and the caller docs, the same learn-once loop as the
+// triage monitor's KNOWN_SIGNATURES.
+//
+// The window is 3h: the ring settles in bursts (an idle hour can hold zero
+// settlements while it waits on funding or a settle-tick), so a short window
+// reads `unknown` constantly. 3h reliably carries hundreds of attempts, smooths
+// the bursts, and still surfaces a regression within hours — against an 8-day
+// blind spot, decisive. Below MIN_ATTEMPTS the verdict is `unknown` (neutral,
+// never pages): too little settling to judge is not a fault.
+//
+// Consumed via gatherSubsystemHealth() → /api/healthz, /api/status, and the
+// uptime-check escalation digest (pages on first sight, re-pages hourly, clears
+// on recovery) — no new cron, no new alert path.
+
+const WINDOW_INTERVAL = '3 hours';
+// Enough settle attempts in-window to trust a rate. The ring runs hundreds/3h
+// when active; 20 keeps a genuinely quiet period from reading as an outage.
+const MIN_ATTEMPTS = 20;
+
+// Rate bands. Vocabulary matches subsystem-health.js: `degraded` = functional
+// but faulting; `down` = not functional. A rail settling ~73% of the time is
+// impaired, not dead, so the collapse threshold sits well below that.
+const OK_RATE = 0.9;
+const DOWN_RATE = 0.5;
+
+// A recorded failure is a SETTLE/PAYMENT-RAIL fault when its reason (the first
+// `:`-delimited token of error_msg) matches these. Two rules: any 5xx or a 402,
+// and any RPC/broadcast/settle/confirm/simulation/timeout signature.
+const RAIL_STATUS = /^http_(5\d\d|402)$/i;
+const RAIL_SIGNATURE =
+ /broadcast_failed|settle_failed|not_confirmed|simulation|preflight|rpc_|insufficient_source|blockhash|aborted|operation was aborted|timeout/i;
+
+/**
+ * Is this reason token a settle/payment-rail fault (vs a caller error, a benign
+ * guard, or a downstream note)?
+ * @param {string} reason first `:`-token of error_msg
+ * @returns {boolean}
+ */
+export function isRailFault(reason) {
+ const r = String(reason || '');
+ if (!r || r === 'none') return false;
+ return RAIL_STATUS.test(r) || RAIL_SIGNATURE.test(r);
+}
+
+/**
+ * Classify pre-aggregated settle buckets into a subsystem verdict. Pure — no DB,
+ * no clock — so the thresholds and the rail-fault split are unit-testable
+ * against the exact bucket shape the DB returns.
+ * @param {Array<{ success: boolean, paid: boolean, reason: string, n: number }>} buckets
+ * @param {{ minAttempts?: number }} [opts]
+ * @returns {{ status: 'ok'|'degraded'|'down'|'unknown', settled: number,
+ * faults: number, attempts: number, rate: number|null,
+ * faultClasses: Array<{ reason: string, n: number }>, detail: string, hint?: string }}
+ */
+export function classifySettleBuckets(buckets, { minAttempts = MIN_ATTEMPTS } = {}) {
+ let settled = 0;
+ let faults = 0;
+ /** @type {Record<string, number>} */
+ const faultBy = {};
+ for (const b of Array.isArray(buckets) ? buckets : []) {
+ const n = Number(b?.n) || 0;
+ if (n <= 0) continue;
+ if (b.success && b.paid) {
+ settled += n;
+ } else if (!b.success && isRailFault(b.reason)) {
+ faults += n;
+ faultBy[b.reason] = (faultBy[b.reason] || 0) + n;
+ }
+ }
+ const attempts = settled + faults;
+ const faultClasses = Object.entries(faultBy)
+ .map(([reason, n]) => ({ reason, n }))
+ .sort((a, b) => b.n - a.n);
+
+ if (attempts < minAttempts) {
+ return {
+ status: 'unknown',
+ settled, faults, attempts, rate: null, faultClasses,
+ detail: `only ${attempts} settle attempts in ${WINDOW_INTERVAL} — too few to judge`,
+ };
+ }
+
+ const rate = settled / attempts;
+ const pct = (rate * 100).toFixed(1);
+ const topFaults = faultClasses
+ .slice(0, 3)
+ .map((f) => `${f.reason}×${f.n}`)
+ .join(', ');
+ const base = `settle ${pct}% (${settled}/${attempts} paid attempts, ${WINDOW_INTERVAL})`;
+
+ if (rate >= OK_RATE) {
+ return { status: 'ok', settled, faults, attempts, rate, faultClasses, detail: base };
+ }
+ const status = rate < DOWN_RATE ? 'down' : 'degraded';
+ return {
+ status,
+ settled, faults, attempts, rate, faultClasses,
+ detail: `${base}; ${faults} rail faults${topFaults ? ` (${topFaults})` : ''}`,
+ hint:
+ 'Payments are being rejected at settle. Check the self-facilitator: ' +
+ '`npm run logs -- -s three-ws-api --grep "settle_failed" --since 3h`. ' +
+ 'A 5xx/502 cluster with empty simulation logs is a duplicate-signature or ' +
+ 'RPC-preflight fault; a 402 cluster is verify/facilitator rejection. See ' +
+ 'docs/ops/production-log-triage.md.',
+ };
+}
+
+/**
+ * Read the last WINDOW_INTERVAL of ring settle outcomes and classify them.
+ * Fail-soft: a missing DB, an absent table (pre-migration), or any query error
+ * resolves to `unknown` so a health read never throws. Pre-aggregates in SQL
+ * (bucketed by success/paid/reason) so the row count is bounded regardless of
+ * settle volume — safe on the per-request /api/healthz path.
+ * @returns {Promise<{ name: 'x402_settle', label: string, status: string,
+ * detail: string, hint?: string, metrics?: object }>}
+ */
+export async function gatherX402SettleHealth() {
+ const base = { name: /** @type {const} */ ('x402_settle'), label: 'x402 settlement success' };
+ try {
+ const { sql } = await import('../db.js');
+ const buckets = /** @type {Array<{ success: boolean, paid: boolean, reason: string, n: number }>} */ (
+ await sql`
+ SELECT success,
+ (amount_atomic > 0) AS paid,
+ COALESCE(NULLIF(split_part(error_msg, ':', 1), ''), 'none') AS reason,
+ count(*)::int AS n
+ FROM x402_autonomous_log
+ WHERE ts >= now() - ${WINDOW_INTERVAL}::interval
+ GROUP BY success, paid, reason
+ `
+ );
+ const v = classifySettleBuckets(buckets);
+ return {
+ ...base,
+ status: v.status,
+ detail: v.detail,
+ ...(v.hint ? { hint: v.hint } : {}),
+ metrics: {
+ windowHours: 3,
+ settled: v.settled,
+ faults: v.faults,
+ attempts: v.attempts,
+ rate: v.rate == null ? null : Math.round(v.rate * 1000) / 1000,
+ topFaults: v.faultClasses.slice(0, 5),
+ },
+ };
+ } catch (err) {
+ return { ...base, status: 'unknown', detail: err?.message || 'settle log unreadable' };
+ }
+}
diff --git a/data/changelog.json b/data/changelog.json
index 536d6ffa2..36e28aabd 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -14254,6 +14254,16 @@
"improvement"
],
"link": "/gallery"
+ },
+ {
+ "date": "2026-07-17",
+ "title": "The status page now tracks whether paid API calls actually settle, not just whether the payment rail is switched on",
+ "summary": "The July payment-settlement bug ran for eight days before anyone noticed, because every health check reported the x402 rail as 'armed' and the discovery endpoint as 'up' while a third of real settlements were quietly failing. The public status page and /api/healthz now carry a new signal, x402 settlement success, that reads the actual settle outcomes over a rolling window and reports the success rate. It counts only genuine payment-rail faults (server errors, rejected payments, RPC failures) and ignores unrelated noise, and it pages operations the moment the rate drops, so a silent settlement regression surfaces in hours instead of days.",
+ "tags": [
+ "infra",
+ "improvement"
+ ],
+ "link": "/status"
}
]
}
diff --git a/docs/ops/production-log-triage.md b/docs/ops/production-log-triage.md
index b0131e0e3..a8ad85892 100644
--- a/docs/ops/production-log-triage.md
+++ b/docs/ops/production-log-triage.md
@@ -31,7 +31,7 @@ var or add quota · 🟢 self-healing, no action needed.
> self-reports internal-dependency health: **[/status](https://three.ws/status)**
> renders it with a plain-language fix for each degradation, and
> **`/api/healthz`** carries a machine-readable `subsystems` block (cache, database,
-> Helius RPC, x402 ring, world, x402 config). The uptime cron
+> Helius RPC, x402 ring, **x402 settlement success**, world, x402 config). The uptime cron
> ([api/cron/uptime-check.js](../../api/cron/uptime-check.js)) parks a snapshot
> each tick and re-pages a degradation that persists. Source of the roll-up:
> [api/_lib/ops/subsystem-health.js](../../api/_lib/ops/subsystem-health.js). This
@@ -120,6 +120,22 @@ HTTP 502 POST /api/x402/<any endpoint> ua: threews-x402-autonomous/1.0 (~334
`npm run build:gcp && npm run deploy:gcp`. If the wave persists on the
revision carrying `93430b4fb`, remove the monitor signature and
re-investigate; do not let the classification mask a new failure.
+- **Now watched continuously:** this wave went undetected for eight days
+ because every sensor read "ring armed / discovery up" while a third of
+ settles silently failed. The **x402 settlement success** subsystem
+ ([api/_lib/ops/x402-settle-health.js](../../api/_lib/ops/x402-settle-health.js))
+ closes that blind spot: it reads the ring's own `x402_autonomous_log`
+ outcomes over a 3h window and reports the settle SUCCESS RATE, counting only
+ payment-rail faults (5xx / 402 / RPC / broadcast / confirm) and excluding
+ caller errors (http_400/404/405/409), benign guards (cap, low USDC), and
+ downstream notes. It rolls into `/api/healthz`, `/status`, and the
+ uptime-cron escalation (pages on first sight, re-pages hourly, clears on
+ recovery). States: `ok` ≥ 90% settle rate, `degraded` 50–90%, `down` < 50%,
+ `unknown` below 20 settle attempts in-window (a quiet ring is not a fault).
+ A NEW settle-fault reason is caught automatically; a new *benign* reason that
+ shows up as a fault is the one thing to teach it — add the token to the
+ fault/exclusion rules in that module, the same learn-once loop as
+ `KNOWN_SIGNATURES` here.
---
diff --git a/public/changelog.json b/public/changelog.json
index 2c02eb1da..9bc362941 100644
--- a/public/changelog.json
+++ b/public/changelog.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-07-17T10:52:33.703Z",
+ "generated_at": "2026-07-17T10:55:07.314Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json",
"site": {
"name": "three.ws",
@@ -112,6 +112,16 @@
"improvement"
]
},
+ {
+ "date": "2026-07-17",
+ "type": "update",
+ "title": "Free 3D API tells agents exactly when to check back",
+ "summary": "When a text-to-3D generation needs a moment and hands back a job to poll, the free /api/3d/generate API now includes how long to wait before checking again (a retryAfter value, also sent as the standard Retry-After header) plus an estimated time-to-ready and a stable creation id. Agents that honor the hint poll on a sensible schedule instead of hammering the endpoint, so they stop tripping the rate limit and the shared free GPU lane carries less needless traffic. Fully backward-compatible: existing callers keep working unchanged.",
+ "link": "/docs/3d-api",
+ "tags": [
+ "improvement"
+ ]
+ },
{
"date": "2026-07-17",
"type": "update",
@@ -208,6 +218,17 @@
"infra"
]
},
+ {
+ "date": "2026-07-17",
+ "type": "update",
+ "title": "The status page now tracks whether paid API calls actually settle, not just whether the payment rail is switched on",
+ "summary": "The July payment-settlement bug ran for eight days before anyone noticed, because every health check reported the x402 rail as 'armed' and the discovery endpoint as 'up' while a third of real settlements were quietly failing. The public status page and /api/healthz now carry a new signal, x402 settlement success, that reads the actual settle outcomes over a rolling window and reports the success rate. It counts only genuine payment-rail faults (server errors, rejected payments, RPC failures) and ignores unrelated noise, and it pages operations the moment the rate drops, so a silent settlement regression surfaces in hours instead of days.",
+ "link": "/status",
+ "tags": [
+ "infra",
+ "improvement"
+ ]
+ },
{
"date": "2026-07-17",
"type": "update",
diff --git a/public/changelog.xml b/public/changelog.xml
index 58391ad71..b799203e8 100644
--- a/public/changelog.xml
+++ b/public/changelog.xml
@@ -86,6 +86,14 @@
<category>improvement</category>
<description>The example chips, empty-stage starters, and the Surprise me button on the Forge used to rotate through a fixed list of 48 prompts. They now draw from a curated prompt generator with thousands of combinations: statues, figurines, potted plants, crystals, food, crafted props, and cozy miniatures, each paired only with materials and finishes the 3D engine renders well. Every visit opens with a fresh set, and the prompt coach no longer mistakes words like mushroom for a scene request.</description>
</item>
+ <item>
+ <title>Free 3D API tells agents exactly when to check back</title>
+ <link>https://three.ws/docs/3d-api</link>
+ <guid isPermaLink="false">2026-07-17:Free 3D API tells agents exactly when to check back</guid>
+ <pubDate>Fri, 17 Jul 2026 12:00:00 GMT</pubDate>
+ <category>improvement</category>
+ <description>When a text-to-3D generation needs a moment and hands back a job to poll, the free /api/3d/generate API now includes how long to wait before checking again (a retryAfter value, also sent as the standard Retry-After header) plus an estimated time-to-ready and a stable creation id. Agents that honor the hint poll on a sensible schedule instead of hammering the endpoint, so they stop tripping the rate limit and the shared free GPU lane carries less needless traffic. Fully backward-compatible: existing callers keep working unchanged.</description>
+ </item>
<item>
<title>Image to 3D gets its own front door</title>
<link>https://three.ws/image-to-3d</link>
@@ -158,6 +166,14 @@
<category>fix</category>
<description>The live money feed went quiet after the July 7 infrastructure move: the switch that powers the autonomous agent activity loop did not survive the migration, so agents stopped tipping, trading, paying and launching. The switch is back on and the feed is live again, with real on-chain tips, trades, payments and coin launches flowing within minutes of the fix. The production runbook now documents the switch so a future migration cannot silently drop it.</description>
</item>
+ <item>
+ <title>The status page now tracks whether paid API calls actually settle, not just whether the payment rail is switched on</title>
+ <link>https://three.ws/status</link>
+ <guid isPermaLink="false">2026-07-17:The status page now tracks whether paid API calls actually settle, not just whether the payment rail is switched on</guid>
+ <pubDate>Fri, 17 Jul 2026 12:00:00 GMT</pubDate>
+ <category>infra</category>
+ <description>The July payment-settlement bug ran for eight days before anyone noticed, because every health check reported the x402 rail as 'armed' and the discovery endpoint as 'up' while a third of real settlements were quietly failing. The public status page and /api/healthz now carry a new signal, x402 settlement success, that reads the actual settle outcomes over a rolling window and reports the success rate. It counts only genuine payment-rail faults (server errors, rejected payments, RPC failures) and ignores unrelated noise, and it pages operations the moment the rate drops, so a silent settlement regression surfaces in hours instead of days.</description>
+ </item>
<item>
<title>The viewer's Create buttons now take you straight to the Forge</title>
<link>https://three.ws/viewer</link>
diff --git a/tests/api/x402-settle-health.test.js b/tests/api/x402-settle-health.test.js
new file mode 100644
index 000000000..34d748ada
--- /dev/null
+++ b/tests/api/x402-settle-health.test.js
@@ -0,0 +1,137 @@
+import { describe, it, expect } from 'vitest';
+import {
+ isRailFault,
+ classifySettleBuckets,
+} from '../../api/_lib/ops/x402-settle-health.js';
+
+// The sensor that would have caught the 2026-07 502 wave on day one. The bucket
+// shapes here are the real `x402_autonomous_log` aggregation observed in prod
+// (GROUP BY success, amount>0 AS paid, first `:`-token of error_msg).
+
+describe('isRailFault — only payment-rail faults count against the settle rate', () => {
+ it('counts facilitator/settle 5xx and payment-rejected 402', () => {
+ for (const r of ['http_500', 'http_502', 'http_503', 'http_504', 'http_402']) {
+ expect(isRailFault(r)).toBe(true);
+ }
+ });
+
+ it('counts RPC / broadcast / confirm / simulation / timeout signatures', () => {
+ for (const r of [
+ 'broadcast_failed', 'settle_failed', 'not_confirmed', 'rpc_preflight_failed',
+ 'insufficient_source', 'This operation was aborted',
+ ]) {
+ expect(isRailFault(r)).toBe(true);
+ }
+ });
+
+ it('does NOT count caller/endpoint errors — these are not settle failures', () => {
+ // The ring POSTing to a GET-only endpoint or passing rejected args. ~800/6h
+ // in prod; counting them would peg the sensor red and bury real regressions.
+ for (const r of ['http_400', 'http_404', 'http_405', 'http_409']) {
+ expect(isRailFault(r)).toBe(false);
+ }
+ });
+
+ it('does NOT count benign guards or downstream notes', () => {
+ for (const r of [
+ 'cap_would_exceed', 'insufficient_payer_usdc', 'wallet_unconfigured',
+ 'breaker_tripped', 'config_missing', 'sniper_intel_calls_failed', 'none', '',
+ ]) {
+ expect(isRailFault(r)).toBe(false);
+ }
+ });
+
+ it('classifies the fix\'s own precise error format (broadcast_failed:already_processed:sig)', () => {
+ // gatherX402SettleHealth splits on ':' → first token 'broadcast_failed'.
+ expect(isRailFault('broadcast_failed')).toBe(true);
+ });
+});
+
+describe('classifySettleBuckets — verdict from real bucket shapes', () => {
+ // The live 3h window during the 502 wave: 344 settled, 121 http_502 + 7 http_402
+ // rail faults, plus noise that must be excluded.
+ const liveOutageBuckets = [
+ { success: true, paid: true, reason: 'none', n: 344 },
+ { success: false, paid: true, reason: 'http_502', n: 100 },
+ { success: false, paid: false, reason: 'http_502', n: 21 },
+ { success: false, paid: false, reason: 'http_402', n: 7 },
+ // Excluded noise:
+ { success: false, paid: true, reason: 'http_400', n: 260 },
+ { success: false, paid: true, reason: 'http_405', n: 190 },
+ { success: false, paid: false, reason: 'cap_would_exceed', n: 52 },
+ { success: false, paid: false, reason: 'insufficient_payer_usdc', n: 39 },
+ { success: true, paid: false, reason: 'none', n: 93 }, // free/ok calls
+ ];
+
+ it('reads the live 502 wave as DEGRADED with http_502 as the top fault', () => {
+ const v = classifySettleBuckets(liveOutageBuckets);
+ expect(v.status).toBe('degraded');
+ expect(v.settled).toBe(344);
+ expect(v.faults).toBe(128); // 100 + 21 + 7 — client errors and guards excluded
+ expect(v.attempts).toBe(472);
+ expect(v.rate).toBeCloseTo(0.729, 2);
+ expect(v.faultClasses[0]).toEqual({ reason: 'http_502', n: 121 });
+ expect(v.detail).toMatch(/http_502×121/);
+ expect(v.hint).toMatch(/settle_failed/);
+ });
+
+ it('a clean rail reads OK — successes only, no rail faults', () => {
+ const v = classifySettleBuckets([
+ { success: true, paid: true, reason: 'none', n: 400 },
+ { success: false, paid: false, reason: 'cap_would_exceed', n: 30 },
+ { success: false, paid: true, reason: 'http_405', n: 50 }, // caller error, excluded
+ ]);
+ expect(v.status).toBe('ok');
+ expect(v.rate).toBe(1);
+ expect(v.faults).toBe(0);
+ });
+
+ it('a rail collapse (<50% settling) reads DOWN', () => {
+ const v = classifySettleBuckets([
+ { success: true, paid: true, reason: 'none', n: 30 },
+ { success: false, paid: true, reason: 'http_502', n: 80 },
+ ]);
+ expect(v.status).toBe('down');
+ expect(v.rate).toBeCloseTo(0.273, 2);
+ });
+
+ it('too few attempts reads UNKNOWN and never pages', () => {
+ const v = classifySettleBuckets([
+ { success: true, paid: true, reason: 'none', n: 5 },
+ { success: false, paid: true, reason: 'http_502', n: 3 },
+ ]);
+ expect(v.status).toBe('unknown');
+ expect(v.rate).toBeNull();
+ expect(v.detail).toMatch(/too few to judge/);
+ });
+
+ it('an idle window (all guards, nothing settled) is UNKNOWN, not an outage', () => {
+ // The exact quiet-hour shape: ring low on USDC, choosing not to pay.
+ const v = classifySettleBuckets([
+ { success: false, paid: false, reason: 'insufficient_payer_usdc', n: 15 },
+ { success: false, paid: false, reason: 'cap_would_exceed', n: 21 },
+ { success: true, paid: false, reason: 'none', n: 12 },
+ ]);
+ expect(v.status).toBe('unknown');
+ expect(v.attempts).toBe(0);
+ });
+
+ it('empty / malformed input is UNKNOWN, never a throw', () => {
+ expect(classifySettleBuckets([]).status).toBe('unknown');
+ expect(classifySettleBuckets(null).status).toBe('unknown');
+ expect(classifySettleBuckets(undefined).status).toBe('unknown');
+ });
+
+ it('boundary: exactly 90% is OK, just under is DEGRADED', () => {
+ const ok = classifySettleBuckets([
+ { success: true, paid: true, reason: 'none', n: 90 },
+ { success: false, paid: true, reason: 'http_502', n: 10 },
+ ]);
+ expect(ok.status).toBe('ok');
+ const degraded = classifySettleBuckets([
+ { success: true, paid: true, reason: 'none', n: 89 },
+ { success: false, paid: true, reason: 'http_502', n: 11 },
+ ]);
+ expect(degraded.status).toBe('degraded');
+ });
+});