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.

fix(economy): keep the ring alive when the settle is unaffordable + public heartbeat status

fudjia26e92160cd54
diff --git a/CHANGELOG.md b/CHANGELOG.md
index b7afa0d99..dcabf1fb4 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -11,11 +11,13 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **3D avatars load about 4x faster - and reliably everywhere** — Seven of the heaviest built-in avatars were compressed from a combined 42 MB down to under 10 MB (76% smaller), so avatar pickers, NPC scenes, and the walk companion appear much sooner - especially on slower connections. Along the way we fixed a loading bug: a few pages, including the live agent-to-agent trade demo, could silently show placeholder capsule figures instead of the real 3D avatars. Every 3D surface on the site now decodes compressed avatars correctly. `[improvement, fix]`
- **A little Fourth of July on the homepage** — For Independence Day (July 1–5) the homepage wears a touch of red, white, and blue: a soft ribbon glow along the top of the page and real launch-and-burst fireworks that rise and shower over the hero. It's sparse and tasteful, respects your reduced-motion setting, pauses when the tab is in the background, and retires itself automatically once the holiday passes. (`/`) `[improvement]`
- **A little Fourth of July on the homepage** — Visit the homepage this week and you'll catch some quiet Independence Day touches: a thin red-white-and-blue line across the top of the page and the occasional tiny firework sparkling in the hero. Nothing loud — it keeps the site clean, respects reduced-motion settings, works in both light and dark themes, and retires itself automatically after July 5. (`/`) `[improvement]`
+- **Agent economy back online, with a public heartbeat you can watch** — The live agent-to-agent economy (ring settlements, tips, the Money Pulse feed) stalled after settlement defaults were raised roughly 35× ahead of wallet funding that never arrived — every per-minute tick paused itself on an affordability check. Defaults are back to funded levels, and a tick that can afford tips but not the big settlement now keeps the small payments flowing instead of going silent. You can also now watch the economy's pulse directly: the status page (and /api/status) shows the per-minute heartbeat with each engine's last run and skip reason. `[fix, improvement]`
- **Deploys restored — the platform ships again, and builds are 4× lighter** — three.ws was briefly unreachable while production moved to new infrastructure: every deploy was timing out at the build platform's 45-minute ceiling. The root cause is fixed — a monitoring SDK was being baked into every one of the platform's ~800 API functions, inflating the deploy payload to 2.3 GB; it now loads only where it is actually enabled, cutting that to 540 MB. Two smaller deploy blockers found along the way (a build-order race and two missing packages) are fixed too. The site is back, deploys complete with time to spare, and nothing about how you use the platform changes. `[infra, fix]`
- **Four gestures return to the walk companion — nod, shrug, jog, celebrate** — The gesture wheel regained four expressive moves that had been silently dropped: nod (a quick upper-body affirm), shrug, jog (a full-body run loop), and celebrate (a whole-body cheer). Open the wheel with G (or long-press the action button on mobile) — the wheel now lays out all twelve gestures; keys 1–8 still trigger the first eight. Also part of this pass: the entire test suite now runs fully green, locking every one of these behaviors in. (`/walk`) `[fix]`
- **Fourth of July presets across the create + forge flows** — The Independence Day moment now reaches the creation tools, not just the homepage. For July 1–5, the avatar prompt page offers festive one-tap presets — Uncle Sam, a bald-eagle mascot, a hero take on Lady Liberty, and a glowing red-white-and-blue firework sprite — and the Forge adds matching props you can generate in a click: a bald-eagle statue, a rippling flag, a cracked liberty bell, and a firework rocket. On the Forge they stay pinned while 'More ideas' shuffles the regular prompts, and everything retires itself automatically once the holiday passes. (`/create/prompt`) `[improvement]`
- **Global markets — live prices and a rich detail page for every coin** — three.ws now covers the whole market, not just pump.fun launches. The new Markets page shows global market cap, dominance, the Fear & Greed index, and the top coins with live prices, 24h/7d moves, and 7-day sparklines — sortable, searchable, and paginated. Click any coin (or visit /coin/<id> directly) for a rich profile: interactive price chart across five time ranges, full market stats including all-time high and low, related news from live sources, a plain-language about section, official links, and contract addresses. Solana coins cross-link straight into Alpha Copilot and the live trade feed. (`/coins`) `[feature]`
- **Light off your own fireworks on the homepage** — The Fourth of July fireworks over the homepage hero are now yours to fire. Click or tap anywhere in the hero and a rocket streaks up and bursts right where you clicked — or hit the new 🎆 Fireworks chip and the hero avatar lights a torch, with a full volley launching right as the flame catches. Fireworks you set off get a quiet, real-time synthesized boom (mute it with the 🔊 chip; your choice is remembered), while the ambient show stays silent. Two torch-lighting animations joined the avatar motion library, bringing it past 100 clips. Visitors with reduced motion enabled skip the ambient show but can still fire their own — an explicit click is always honored. The whole display packs itself away after July 5. (`/`) `[feature]`
+- **Production hardening sweep — smoother embeds, sign-in, and background jobs** — A full pass over a day of production logs closed every code-side issue it surfaced. Avatar embed grids no longer run out of memory on long pages — each preview now loads only when it scrolls into view and unloads when it scrolls far away. Wallet sign-in failures on misconfigured deployments now return a clear 'not configured' response instead of a generic server error. Database housekeeping now covers four data families it previously missed, so background jobs stop pausing on a full database. The $THREE holder leaderboard scan backs off politely when its data provider rate-limits, cache writes stop retrying hopeless oversized payloads, and the proof-of-custody attestation job got the time budget it needed to finish reliably. `[fix, infra]`
- **Put a 3D store guide on your Shopify shop — one-tag tour SDK release** — The guided-tour engine now installs on any external site with a single script tag. @three-ws/tour 0.2.0 ships a self-contained CDN build (tour.global.js) that auto-starts from data attributes — point it at a curriculum JSON and your storefront gets an avatar that walks the page, spotlights sections, narrates each one, and offers free roam. @three-ws/walk 0.1.1 fixes cross-origin animation loading so avatars animate correctly when assets are served from the three.ws CDN onto another domain. A new step-by-step tutorial shows the full Shopify install: theme.liquid tags, a store curriculum, a Take-the-tour button, and the optional docked page narrator. (`/tutorials/shopify-store-guide`) `[sdk, feature, docs]`
- **Soldier, X Bot, and Michelle animations no longer float away** — Eleven animation clips baked from centimeter-scale source models (the Soldier idle/run/walk set, the full X Bot set, and Michelle's samba) carried hip positions about 100× too large, which could send an avatar drifting far above the ground when one of them played directly. The animation build pipeline now detects centimeter-authored skeletons from the data itself instead of guessing from the file type, and all eleven clips have been rebaked at true meter scale. `[fix]`
- **The agent economy now runs from a single always-on heartbeat** — The live agent-to-agent economy - ring settlements, x402 micropayments, the Money Pulse feed, and the Labor Market - used to stall for hours at a time because it depended on schedulers that were silently not firing. It now runs from one consolidated heartbeat that any always-on trigger can drive every minute, so activity stays continuous instead of arriving in bursts. The Labor Market, which previously had no scheduler at all, is now driven too. We also lifted the ring's throughput ceiling so it can carry far higher daily on-chain volume once funded. `[improvement, infra]`
diff --git a/api/_lib/x402/autonomous-registry.js b/api/_lib/x402/autonomous-registry.js
index 5e9fa1a71..b77320233 100644
--- a/api/_lib/x402/autonomous-registry.js
+++ b/api/_lib/x402/autonomous-registry.js
@@ -3888,14 +3888,12 @@ const EXTERNAL_ENDPOINTS = [
// volume without hammering one service. Override via env.
export const MAX_PER_TICK = Number(process.env.X402_AUTONOMOUS_MAX_PER_TICK || 12);
-// Daily USDC spend cap for the autonomous loop (atomics, 6 decimals). This loop
-// pays external + self catalog endpoints (signals, audits, reputation) — separate
-// budget from the ring tick's ~$50k/day settle throughput. Set to $5k so the cap
-// is never the binding limit at platform scale; funding + per-endpoint cooldowns
-// govern real spend. Still a hard, bounded ceiling enforced per tick — lower it
-// any time via env without a deploy.
-// Default: $5,000.00 = 5_000_000_000 atomics. Override via X402_AUTONOMOUS_DAILY_CAP_ATOMIC.
-export const DAILY_CAP_ATOMIC = Number(process.env.X402_AUTONOMOUS_DAILY_CAP_ATOMIC || 5_000_000_000);
+// Daily USDC spend cap for the autonomous loop (atomics, 6 decimals). Raised from
+// the demo default ($5) to $15 so the higher per-tick throughput isn't money-
+// starved mid-day. Still a hard, bounded ceiling enforced per tick — raise it
+// via env (together with actually funding the payer) without a deploy.
+// Default: $15.00 = 15_000_000 atomics. Override via X402_AUTONOMOUS_DAILY_CAP_ATOMIC.
+export const DAILY_CAP_ATOMIC = Number(process.env.X402_AUTONOMOUS_DAILY_CAP_ATOMIC || 15_000_000);
export function getSelfRegistry() { return SELF_ENDPOINTS; }
export function getExternalRegistry() { return EXTERNAL_ENDPOINTS; }
diff --git a/api/_lib/x402/ring-tick-plan.js b/api/_lib/x402/ring-tick-plan.js
index 7627c577b..2099e608d 100644
--- a/api/_lib/x402/ring-tick-plan.js
+++ b/api/_lib/x402/ring-tick-plan.js
@@ -99,6 +99,30 @@ export function assessBackpressure({ solLamports, usdcAtomic, floorLamports, min
return { ok: true, reason: null };
}
+// ── Degrade: cheap-only tick when the settle is unaffordable ────────────────────
+// A settle tick whose payer can't cover the ring-settle price used to skip the
+// WHOLE tick — including the cheap tips/services that ride alongside it — so an
+// underfunded payer flat-lined every visible ring activity until someone funded
+// it. Instead: keep the hard skip for SOL-floor and RPC faults (settlement is
+// genuinely unsafe there), but when the ONLY problem is that the settle price
+// exceeds the payer's USDC, drop the settle carrier and re-assess as a cheap-only
+// tick. The loop stays visibly alive on tips; `degraded: true` tells the caller
+// to surface the funding gap (log + throttled ops alert), not hide it.
+// Pure: same inputs → same decision. Returns { settleTick, backpressure, degraded,
+// minUsdcAtomic } — `backpressure` is the FINAL assessment for the tick as planned.
+export function planBackpressure({
+ isSettleTick, solLamports, usdcAtomic, floorLamports, ringSettlePriceAtomic, tipHeadroomAtomic = 20_000,
+}) {
+ const minUsdc = minUsdcForTick({ isSettleTick, ringSettlePriceAtomic, tipHeadroomAtomic });
+ const bp = assessBackpressure({ solLamports, usdcAtomic, floorLamports, minUsdcAtomic: minUsdc });
+ if (bp.ok || !isSettleTick || bp.reason !== 'insufficient_payer_usdc') {
+ return { settleTick: isSettleTick, backpressure: bp, degraded: false, minUsdcAtomic: minUsdc };
+ }
+ const minCheap = minUsdcForTick({ isSettleTick: false, ringSettlePriceAtomic, tipHeadroomAtomic });
+ const cheapBp = assessBackpressure({ solLamports, usdcAtomic, floorLamports, minUsdcAtomic: minCheap });
+ return { settleTick: false, backpressure: cheapBp, degraded: cheapBp.ok, minUsdcAtomic: minCheap };
+}
+
// ── Config gate ─────────────────────────────────────────────────────────────────
// validateRingConfig() returns findings [{ code, severity, message, fix }].
// The tick runs only when there are no ERROR-severity findings — those mean
diff --git a/api/cron/economy-tick.js b/api/cron/economy-tick.js
index 517409e96..dc5669b41 100644
--- a/api/cron/economy-tick.js
+++ b/api/cron/economy-tick.js
@@ -27,6 +27,7 @@ import { json, method, wrapCron } from '../_lib/http.js';
import { env } from '../_lib/env.js';
import { constantTimeEquals } from '../_lib/crypto.js';
import { logger } from '../_lib/usage.js';
+import { cacheSet } from '../_lib/cache.js';
const log = logger('economy-tick');
@@ -88,7 +89,10 @@ const TARGETS = [
{ label: 'reflect-sweep', path: '/api/cron/reflect-sweep', method: 'GET' },
// ── $THREE market & holder state ───────────────────────────────────────
{ label: 'three-market-refresh', path: '/api/cron/three-market-refresh', method: 'GET' },
- { label: 'three-holders-snapshot', path: '/api/cron/three-holders-snapshot', method: 'GET' },
+ // three-holders-snapshot is deliberately NOT a target: it has its own */5
+ // vercel cron, and driving it from this every-minute tick as well multiplied
+ // the Helius DAS walk ~6× — the sustained 429 storm in the July 2026 log
+ // export (≈400 rate-limit deferrals in 10h). One scheduler owns that scan.
];
const CALL_TIMEOUT_MS = 60_000;
@@ -128,8 +132,11 @@ async function fireTarget(origin, secret, target) {
ok: res.ok,
status: res.status,
ms: Date.now() - started,
- // Surface the engine's own skip reason so the summary is diagnostic.
- ...(body && typeof body === 'object' && body.reason ? { reason: body.reason } : {}),
+ // Surface the engine's own skip reason so the summary is diagnostic. Some
+ // engines (circulation) return the reason string IN `skipped` rather than
+ // a separate `reason` field — keep the string, don't flatten it away.
+ ...(body && typeof body === 'object' && (body.reason || typeof body.skipped === 'string')
+ ? { reason: String(body.reason || body.skipped).slice(0, 200) } : {}),
...(body && typeof body === 'object' && body.skipped ? { skipped: true } : {}),
};
} catch (err) {
@@ -158,6 +165,15 @@ export default wrapCron(async (req, res) => {
log.info('economy_tick_complete', { origin, fired, failed, results });
+ // Park the summary where the public /api/status endpoint can read it (its
+ // `economy` section). Every past economy stall was diagnosed hours late, from
+ // the symptom (a dead Money Pulse feed) instead of the cause, because the
+ // heartbeat's liveness and each engine's skip reason were invisible from
+ // outside. Per-engine label/ok/status/reason only — no wallets, no amounts, no
+ // secrets. A cache fault never fails the tick.
+ await cacheSet('economy:last-tick', { t: Date.now(), fired, failed, engines: results }, 24 * 60 * 60)
+ .catch(() => {});
+
// 200 as long as at least one engine responded OK; 502 only on a total outage
// (bad secret / origin down / every engine failing) so an external scheduler's
// own alerting can catch a real economy-wide failure.
diff --git a/api/cron/x402-ring-tick.js b/api/cron/x402-ring-tick.js
index fc11a8bdf..506a04628 100644
--- a/api/cron/x402-ring-tick.js
+++ b/api/cron/x402-ring-tick.js
@@ -64,9 +64,8 @@ import {
import {
ringTickConfig,
planTick,
- minUsdcForTick,
+ planBackpressure,
tickBudget,
- assessBackpressure,
gateOnRingConfig,
} from '../_lib/x402/ring-tick-plan.js';
@@ -234,18 +233,9 @@ export default wrapCron(async (req, res) => {
return json(res, 200, { ok: false, skipped: true, reason: `rpc_preflight_failed: ${err?.message}`, run_id: runId });
}
- // ── Plan this tick (durable cadence counters) ──────────────────────────────
+ // ── Cadence intent for this tick (durable counter) ─────────────────────────
const tickSeq = await nextTickSeq(redis);
- const isSettleTick = cfg.settleEveryN > 0 && (tickSeq % cfg.settleEveryN === 0) && !!RING_SETTLE_ENDPOINT;
- const cheapNeeded = Math.max(0, cfg.calls - (isSettleTick ? 1 : 0));
- const cheapStart = await reserveCheapCursor(redis, cheapNeeded);
- const plan = planTick({
- tickSeq,
- calls: cfg.calls,
- settleEveryN: RING_SETTLE_ENDPOINT ? cfg.settleEveryN : 0,
- cheapCount: CHEAP_ENDPOINTS.length,
- cheapStart,
- });
+ const wantSettle = cfg.settleEveryN > 0 && (tickSeq % cfg.settleEveryN === 0) && !!RING_SETTLE_ENDPOINT;
// ── Back-pressure pre-flight (never fire calls that will 502) ──────────────
const ringSettlePriceAtomic = Number(priceFor('ring-settle', RING_SETTLE_DEFAULT_PRICE));
@@ -261,23 +251,52 @@ export default wrapCron(async (req, res) => {
usdcAtomic = Number((await getAccount(conn, payerAta)).amount);
} catch { usdcAtomic = Number.isFinite(solLamports) ? 0 : Number.NaN; }
- const minUsdc = minUsdcForTick({ isSettleTick: plan.isSettleTick, ringSettlePriceAtomic });
- const bp = assessBackpressure({
- solLamports, usdcAtomic, floorLamports: cfg.solFloorLamports, minUsdcAtomic: minUsdc,
+ // Settle-unaffordable degrades to a cheap-only tick (tips keep the ring alive);
+ // SOL-floor and RPC faults still skip the whole tick — settlement is unsafe there.
+ const pbp = planBackpressure({
+ isSettleTick: wantSettle, solLamports, usdcAtomic,
+ floorLamports: cfg.solFloorLamports, ringSettlePriceAtomic,
});
+ const bp = pbp.backpressure;
if (!bp.ok) {
await recordSkip(runId, origin, bp.reason, {
detail: bp.detail, sol_lamports: Number.isFinite(solLamports) ? solLamports : null,
- usdc_atomic: Number.isFinite(usdcAtomic) ? usdcAtomic : null, min_usdc_atomic: minUsdc,
+ usdc_atomic: Number.isFinite(usdcAtomic) ? usdcAtomic : null, min_usdc_atomic: pbp.minUsdcAtomic,
});
await sendOpsAlert(
`x402 ring tick paused: ${bp.reason}`,
- `sol=${solLamports} usdc=${usdcAtomic} floor=${cfg.solFloorLamports} min_usdc=${minUsdc}`,
+ `sol=${solLamports} usdc=${usdcAtomic} floor=${cfg.solFloorLamports} min_usdc=${pbp.minUsdcAtomic}`,
{ signature: `ring-tick:${bp.reason}` },
);
log.warn('ring_tick_backpressure', { reason: bp.reason, detail: bp.detail });
return json(res, 200, { ok: true, skipped: true, reason: bp.reason, run_id: runId });
}
+ if (pbp.degraded) {
+ // The funding gap must stay loud even though the tick proceeds: one
+ // throttled ops alert + a structured log row per degraded tick.
+ await sendOpsAlert(
+ 'x402 ring tick degraded: settle_unaffordable',
+ `ring-settle price ${ringSettlePriceAtomic} exceeds payer USDC ${usdcAtomic}; firing cheap-only ticks until the payer is funded`,
+ { signature: 'ring-tick:settle_unaffordable' },
+ );
+ log.warn('ring_tick_settle_unaffordable', {
+ ring_settle_price_atomic: ringSettlePriceAtomic,
+ usdc_atomic: Number.isFinite(usdcAtomic) ? usdcAtomic : null,
+ });
+ }
+
+ // ── Plan this tick (cursor reserved AFTER the degrade decision so the
+ // reservation matches the cheap slots actually fired) ──────────────────────
+ const cheapNeeded = Math.max(0, cfg.calls - (pbp.settleTick ? 1 : 0));
+ const cheapStart = await reserveCheapCursor(redis, cheapNeeded);
+ const plan = planTick({
+ tickSeq,
+ calls: cfg.calls,
+ // Force the post-degrade decision: 1 → every tick settles, 0 → none does.
+ settleEveryN: pbp.settleTick ? 1 : 0,
+ cheapCount: CHEAP_ENDPOINTS.length,
+ cheapStart,
+ });
// ── Daily cap ──────────────────────────────────────────────────────────────
let dailySpent = 0;
@@ -340,7 +359,7 @@ export default wrapCron(async (req, res) => {
log.info('ring_tick_complete', {
run_id: runId, tick_seq: tickSeq, settle_tick: plan.isSettleTick,
- calls, paid, errors, spent_usdc: (spent / 1e6).toFixed(4),
+ degraded: pbp.degraded, calls, paid, errors, spent_usdc: (spent / 1e6).toFixed(4),
payer: payer.publicKey.toBase58(),
});
@@ -349,6 +368,7 @@ export default wrapCron(async (req, res) => {
run_id: runId,
tick_seq: tickSeq,
settle_tick: plan.isSettleTick,
+ ...(pbp.degraded ? { degraded: true, reason: 'settle_unaffordable' } : {}),
calls,
paid,
errors,
diff --git a/api/status.js b/api/status.js
index 219a217ff..42aac7a8e 100644
--- a/api/status.js
+++ b/api/status.js
@@ -54,13 +54,17 @@ export default wrap(async (req, res) => {
const rl = await limits.publicIp(clientIp(req));
if (!rl.success) return rateLimited(res, rl);
- const [snapshots, daily, subsystemsSnap] = await Promise.all([
+ const [snapshots, daily, subsystemsSnap, economySnap] = await Promise.all([
cacheGet('uptime:snapshots'),
cacheGet('uptime:daily'),
// Parked by api/cron/uptime-check.js every 5 min. We read the cron's
// snapshot rather than re-gathering live so this public, cacheable endpoint
// never fires a DB ping per request. null until the first post-deploy tick.
cacheGet('uptime:subsystems'),
+ // Parked by api/cron/economy-tick.js every minute: the agent-economy
+ // heartbeat's last fan-out, per-engine ok/skip reason. null until the first
+ // tick — and a STALE `t` here is itself the diagnosis (scheduler dead).
+ cacheGet('economy:last-tick'),
]);
const snaps = Array.isArray(snapshots) ? snapshots : [];
const days = Array.isArray(daily) ? daily : [];
@@ -191,6 +195,27 @@ export default wrap(async (req, res) => {
})),
}
: null,
+ // Agent-economy heartbeat: the last economy-tick fan-out (per-engine
+ // ok/skip reason), parked every minute by api/cron/economy-tick.js.
+ // `stale` (tickedAt > 3 min old) means the heartbeat itself is dead —
+ // the exact failure mode that used to be invisible from outside. Null
+ // until the first post-deploy tick.
+ economy: economySnap && typeof economySnap === 'object'
+ ? {
+ tickedAt: economySnap.t ?? null,
+ stale: economySnap.t ? Date.now() - economySnap.t > 3 * 60_000 : true,
+ fired: economySnap.fired ?? 0,
+ failed: economySnap.failed ?? 0,
+ engines: (economySnap.engines || []).map((e) => ({
+ label: e.label,
+ ok: e.ok === true,
+ status: e.status ?? null,
+ ...(e.skipped ? { skipped: true } : {}),
+ ...(e.reason ? { reason: e.reason } : {}),
+ ...(e.error ? { error: e.error } : {}),
+ })),
+ }
+ : null,
},
// json() defaults to no-store; status is probed every 5 minutes, so a
// short shared cache absorbs page-load bursts without staleness.
diff --git a/data/changelog.json b/data/changelog.json
index 4bd2781da..6b89e7f06 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -1,6 +1,24 @@
{
"$comment": "Curated changelog entries for three.ws — the editorial layer of the public changelog. New PAGE launches are tracked automatically via the `added` field in data/pages.json; this file is for everything else holders care about: improvements, fixes, SDK releases, trading/payments capabilities, security work. scripts/build-page-index.mjs merges both sources into CHANGELOG.md, public/changelog.json, and public/changelog.xml. Newest first. Allowed tags: feature, improvement, fix, sdk, infra, docs, security. `link` is optional and must be a live three.ws path.",
"entries": [
+ {
+ "date": "2026-07-04",
+ "title": "Agent economy back online, with a public heartbeat you can watch",
+ "summary": "The live agent-to-agent economy (ring settlements, tips, the Money Pulse feed) stalled after settlement defaults were raised roughly 35× ahead of wallet funding that never arrived — every per-minute tick paused itself on an affordability check. Defaults are back to funded levels, and a tick that can afford tips but not the big settlement now keeps the small payments flowing instead of going silent. You can also now watch the economy's pulse directly: the status page (and /api/status) shows the per-minute heartbeat with each engine's last run and skip reason.",
+ "tags": [
+ "fix",
+ "improvement"
+ ]
+ },
+ {
+ "date": "2026-07-04",
+ "title": "Production hardening sweep — smoother embeds, sign-in, and background jobs",
+ "summary": "A full pass over a day of production logs closed every code-side issue it surfaced. Avatar embed grids no longer run out of memory on long pages — each preview now loads only when it scrolls into view and unloads when it scrolls far away. Wallet sign-in failures on misconfigured deployments now return a clear 'not configured' response instead of a generic server error. Database housekeeping now covers four data families it previously missed, so background jobs stop pausing on a full database. The $THREE holder leaderboard scan backs off politely when its data provider rate-limits, cache writes stop retrying hopeless oversized payloads, and the proof-of-custody attestation job got the time budget it needed to finish reliably.",
+ "tags": [
+ "fix",
+ "infra"
+ ]
+ },
{
"date": "2026-07-04",
"title": "Put a 3D store guide on your Shopify shop — one-tag tour SDK release",
diff --git a/docs/economy-heartbeat.md b/docs/economy-heartbeat.md
index 54ba6f57e..c648af728 100644
--- a/docs/economy-heartbeat.md
+++ b/docs/economy-heartbeat.md
@@ -74,6 +74,27 @@ The whole economy now needs exactly one thing: something hitting
`CRON_SECRET=… node scripts/economy-heartbeat.mjs` reads `vercel.json` and
fires every due cron each minute — not just the economy ones.
+## Watching it — the public heartbeat status
+
+Every tick parks its fan-out summary in the cache (`economy:last-tick`), and the
+public status feed exposes it — no auth needed:
+
+```bash
+curl -s https://three.ws/api/status | jq .economy
+```
+
+- `tickedAt` / `stale` — when the last tick ran; `stale: true` (older than ~3
+ minutes) means **the heartbeat itself is dead** (scheduler not firing), which
+ used to be invisible from outside until the Money Pulse feed went quiet hours
+ later.
+- `fired` / `failed` — how many engines responded OK vs errored on that tick.
+- `engines[]` — per-engine `label`, `ok`, `status`, and the engine's own
+ `reason` when it skipped (e.g. `settle_unaffordable`, `disabled`, a treasury
+ floor) — the cause, not just the symptom.
+
+The same data renders as the **Agent economy heartbeat** section on
+[/status](https://three.ws/status).
+
## Manual / one-off
```bash
diff --git a/docs/x402-ring-economy.md b/docs/x402-ring-economy.md
index 01eb95a19..e5885376f 100644
--- a/docs/x402-ring-economy.md
+++ b/docs/x402-ring-economy.md
@@ -433,10 +433,28 @@ per-run cap — is now **impossible to hit quietly** three ways:
### Back-pressure, never a retry-storm
Before paying, the tick pre-flights the payer's SOL and USDC balances. Below the
-facilitator SOL floor (`X402_SPONSOR_SOL_FLOOR_LAMPORTS`, default 0.02 SOL),
-insufficient payer USDC, or an RPC fault → the whole tick **skips** with a
-structured `x402_autonomous_log` row and **one throttled ops alert** (max 1/hour per
-reason via `sendOpsAlert`). It never fires settlements that would 502 in a loop.
+facilitator SOL floor (`X402_SPONSOR_SOL_FLOOR_LAMPORTS`, default 0.02 SOL) or on
+an RPC fault → the whole tick **skips** with a structured `x402_autonomous_log`
+row and **one throttled ops alert** (max 1/hour per reason via `sendOpsAlert`).
+It never fires settlements that would 502 in a loop.
+
+An **unaffordable settle degrades instead of killing the tick**: when the payer
+holds enough USDC for tips but not for the ring-settle price (e.g. the price was
+raised ahead of funding), the tick drops the settle carrier and fires cheap-only
+calls, logs `ring_tick_settle_unaffordable`, and raises one throttled
+`ring-tick:settle_unaffordable` ops alert until the payer is funded. The ring
+stays visibly alive on tips; the funding gap stays loud. Only a payer that can't
+even cover tip headroom hard-skips (`insufficient_payer_usdc`). Decision logic:
+`planBackpressure()` in
+[api/_lib/x402/ring-tick-plan.js](../api/_lib/x402/ring-tick-plan.js).
+
+**Never raise the settle price ahead of funding.** The defaults ($1.00 settle,
+$1.10 tick cap, $50/day) are sized to the ring's real balances. Scaling to higher
+daily volume is an env change (`X402_PRICE_RING_SETTLE`,
+`X402_RING_TICK_CAP_ATOMIC`, `X402_RING_DAILY_CAP_ATOMIC`,
+`X402_RING_SETTLE_EVERY_N_TICKS`) made **together with funding the payer wallet**
+— in July 2026 a defaults-only lift to $35/settle put every tick into
+back-pressure and flat-lined the visible ring economy for hours.
## Agents in the ring — buyers with names, not a cron
diff --git a/pages/status.html b/pages/status.html
index d965c6204..c5cf0a61f 100644
--- a/pages/status.html
+++ b/pages/status.html
@@ -419,6 +419,18 @@
</p>
<div class="st-sublist" id="st-sublist"></div>
</section>
+
+ <!-- Agent-economy heartbeat — hidden until the API returns an economy
+ block (older deploys / pre-first-tick omit it). -->
+ <section id="st-economy" aria-label="Agent economy heartbeat" hidden>
+ <h2 class="st-subhead">Agent economy heartbeat</h2>
+ <p class="st-subnote">
+ The per-minute tick that drives every agent-to-agent engine — ring
+ settlements, the Money Pulse, the Labor Market, launches, payouts.
+ Each engine reports ran, skipped (with its own reason), or failed.
+ </p>
+ <div class="st-sublist" id="st-econlist"></div>
+ </section>
</main>
<script type="module">
@@ -429,6 +441,8 @@
const list = document.getElementById('st-services');
const subsWrap = document.getElementById('st-subsystems');
const subsList = document.getElementById('st-sublist');
+ const econWrap = document.getElementById('st-economy');
+ const econList = document.getElementById('st-econlist');
const summaryEl = document.getElementById('st-summary');
const kpiUptime = document.getElementById('st-kpi-uptime');
const kpiServices = document.getElementById('st-kpi-services');
@@ -499,9 +513,47 @@
.join('');
}
+ function renderEconomy(econ) {
+ // Older API shapes / pre-first-tick omit the block — keep it hidden then.
+ if (!econ || !Array.isArray(econ.engines) || econ.engines.length === 0) {
+ econWrap.hidden = true;
+ return;
+ }
+ econWrap.hidden = false;
+ const ageMin = econ.tickedAt ? Math.max(0, Math.round((Date.now() - econ.tickedAt) / 60000)) : null;
+ const head = econ.stale
+ ? `<div class="st-sub" data-state="down">
+ <span class="st-dot" data-state="down" aria-hidden="true"></span>
+ <span class="st-sub-name">Heartbeat</span>
+ <span class="st-sub-state">stalled</span>
+ <span class="st-sub-detail">last tick ${ageMin == null ? 'never' : `${ageMin} min ago`} — engines below reflect the last run, not the present</span>
+ </div>`
+ : `<div class="st-sub" data-state="ok">
+ <span class="st-dot" data-state="ok" aria-hidden="true"></span>
+ <span class="st-sub-name">Heartbeat</span>
+ <span class="st-sub-state">ticking</span>
+ <span class="st-sub-detail">last tick ${ageMin === 0 ? 'under a minute' : `${ageMin} min`} ago · ${econ.fired} engines ok · ${econ.failed} failing</span>
+ </div>`;
+ const rows = econ.engines
+ .map((e) => {
+ const state = e.ok ? 'ok' : 'down';
+ const word = e.ok ? (e.skipped ? 'skipped' : 'ran') : 'failed';
+ const detail = e.reason || e.error || '';
+ return `<div class="st-sub" data-state="${esc(state)}">
+ <span class="st-dot" data-state="${esc(state)}" aria-hidden="true"></span>
+ <span class="st-sub-name">${esc(e.label)}</span>
+ <span class="st-sub-state">${esc(word)}</span>
+ ${detail ? `<span class="st-sub-detail">${esc(detail)}</span>` : ''}
+ </div>`;
+ })
+ .join('');
+ econList.innerHTML = head + rows;
+ }
+
function render(data) {
renderSummary(data);
renderSubsystems(data.subsystems);
+ renderEconomy(data.economy);
const probed = data.services.filter((s) => s.operational !== null);
const down = probed.filter((s) => !s.operational);
// Degraded internal dependencies (from the subsystems block) that the
diff --git a/public/changelog.json b/public/changelog.json
index 009b80c8d..bd27211e6 100644
--- a/public/changelog.json
+++ b/public/changelog.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-07-04T09:29:09.609Z",
+ "generated_at": "2026-07-04T21:51:09.061Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json",
"site": {
"name": "three.ws",
@@ -57,6 +57,17 @@
"improvement"
]
},
+ {
+ "date": "2026-07-04",
+ "type": "update",
+ "title": "Agent economy back online, with a public heartbeat you can watch",
+ "summary": "The live agent-to-agent economy (ring settlements, tips, the Money Pulse feed) stalled after settlement defaults were raised roughly 35× ahead of wallet funding that never arrived — every per-minute tick paused itself on an affordability check. Defaults are back to funded levels, and a tick that can afford tips but not the big settlement now keeps the small payments flowing instead of going silent. You can also now watch the economy's pulse directly: the status page (and /api/status) shows the per-minute heartbeat with each engine's last run and skip reason.",
+ "link": null,
+ "tags": [
+ "fix",
+ "improvement"
+ ]
+ },
{
"date": "2026-07-04",
"type": "update",
@@ -108,6 +119,17 @@
"feature"
]
},
+ {
+ "date": "2026-07-04",
+ "type": "update",
+ "title": "Production hardening sweep — smoother embeds, sign-in, and background jobs",
+ "summary": "A full pass over a day of production logs closed every code-side issue it surfaced. Avatar embed grids no longer run out of memory on long pages — each preview now loads only when it scrolls into view and unloads when it scrolls far away. Wallet sign-in failures on misconfigured deployments now return a clear 'not configured' response instead of a generic server error. Database housekeeping now covers four data families it previously missed, so background jobs stop pausing on a full database. The $THREE holder leaderboard scan backs off politely when its data provider rate-limits, cache writes stop retrying hopeless oversized payloads, and the proof-of-custody attestation job got the time budget it needed to finish reliably.",
+ "link": null,
+ "tags": [
+ "fix",
+ "infra"
+ ]
+ },
{
"date": "2026-07-04",
"type": "update",
diff --git a/public/changelog.xml b/public/changelog.xml
index 4db1c9188..3010ef53b 100644
--- a/public/changelog.xml
+++ b/public/changelog.xml
@@ -46,6 +46,14 @@
<category>improvement</category>
<description>Visit the homepage this week and you'll catch some quiet Independence Day touches: a thin red-white-and-blue line across the top of the page and the occasional tiny firework sparkling in the hero. Nothing loud — it keeps the site clean, respects reduced-motion settings, works in both light and dark themes, and retires itself automatically after July 5.</description>
</item>
+ <item>
+ <title>Agent economy back online, with a public heartbeat you can watch</title>
+ <link>https://three.ws/changelog</link>
+ <guid isPermaLink="false">2026-07-04:Agent economy back online, with a public heartbeat you can watch</guid>
+ <pubDate>Sat, 04 Jul 2026 12:00:00 GMT</pubDate>
+ <category>fix</category>
+ <description>The live agent-to-agent economy (ring settlements, tips, the Money Pulse feed) stalled after settlement defaults were raised roughly 35× ahead of wallet funding that never arrived — every per-minute tick paused itself on an affordability check. Defaults are back to funded levels, and a tick that can afford tips but not the big settlement now keeps the small payments flowing instead of going silent. You can also now watch the economy's pulse directly: the status page (and /api/status) shows the per-minute heartbeat with each engine's last run and skip reason.</description>
+ </item>
<item>
<title>Deploys restored — the platform ships again, and builds are 4× lighter</title>
<link>https://three.ws/changelog</link>
@@ -86,6 +94,14 @@
<category>feature</category>
<description>The Fourth of July fireworks over the homepage hero are now yours to fire. Click or tap anywhere in the hero and a rocket streaks up and bursts right where you clicked — or hit the new 🎆 Fireworks chip and the hero avatar lights a torch, with a full volley launching right as the flame catches. Fireworks you set off get a quiet, real-time synthesized boom (mute it with the 🔊 chip; your choice is remembered), while the ambient show stays silent. Two torch-lighting animations joined the avatar motion library, bringing it past 100 clips. Visitors with reduced motion enabled skip the ambient show but can still fire their own — an explicit click is always honored. The whole display packs itself away after July 5.</description>
</item>
+ <item>
+ <title>Production hardening sweep — smoother embeds, sign-in, and background jobs</title>
+ <link>https://three.ws/changelog</link>
+ <guid isPermaLink="false">2026-07-04:Production hardening sweep — smoother embeds, sign-in, and background jobs</guid>
+ <pubDate>Sat, 04 Jul 2026 12:00:00 GMT</pubDate>
+ <category>fix</category>
+ <description>A full pass over a day of production logs closed every code-side issue it surfaced. Avatar embed grids no longer run out of memory on long pages — each preview now loads only when it scrolls into view and unloads when it scrolls far away. Wallet sign-in failures on misconfigured deployments now return a clear 'not configured' response instead of a generic server error. Database housekeeping now covers four data families it previously missed, so background jobs stop pausing on a full database. The $THREE holder leaderboard scan backs off politely when its data provider rate-limits, cache writes stop retrying hopeless oversized payloads, and the proof-of-custody attestation job got the time budget it needed to finish reliably.</description>
+ </item>
<item>
<title>Put a 3D store guide on your Shopify shop — one-tag tour SDK release</title>
<link>https://three.ws/tutorials/shopify-store-guide</link>
diff --git a/public/features.json b/public/features.json
index b9117cefe..cd0d776f4 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-07-04T09:29:09.597Z",
+ "generated_at": "2026-07-04T21:51:09.049Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",
diff --git a/tests/x402-ring-tick.test.js b/tests/x402-ring-tick.test.js
index d0da146cb..bd3092626 100644
--- a/tests/x402-ring-tick.test.js
+++ b/tests/x402-ring-tick.test.js
@@ -3,6 +3,7 @@ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
import {
ringTickConfig,
planTick,
+ planBackpressure,
minUsdcForTick,
dailyRemaining,
tickBudget,
@@ -132,6 +133,55 @@ describe('ring-tick back-pressure', () => {
});
});
+// ── Degrade: settle-unaffordable falls back to a cheap-only tick ─────────────────
+describe('ring-tick planBackpressure — settle-unaffordable degrade', () => {
+ const FLOOR = 20_000_000; // 0.02 SOL
+ const SETTLE = 1_000_000; // $1.00
+ const base = { solLamports: 50_000_000, floorLamports: FLOOR, ringSettlePriceAtomic: SETTLE };
+
+ it('an affordable settle tick proceeds unchanged', () => {
+ const r = planBackpressure({ ...base, isSettleTick: true, usdcAtomic: 5_000_000 });
+ expect(r.settleTick).toBe(true);
+ expect(r.degraded).toBe(false);
+ expect(r.backpressure.ok).toBe(true);
+ });
+
+ it('settle price above payer USDC degrades to a cheap-only tick (never a dead tick)', () => {
+ // $0.50 in the wallet: can't cover the $1.00 settle, easily covers tips.
+ const r = planBackpressure({ ...base, isSettleTick: true, usdcAtomic: 500_000 });
+ expect(r.settleTick).toBe(false);
+ expect(r.degraded).toBe(true);
+ expect(r.backpressure.ok).toBe(true);
+ expect(r.minUsdcAtomic).toBe(20_000); // re-assessed against tip headroom
+ });
+
+ it('below even the tip headroom → still a hard skip', () => {
+ const r = planBackpressure({ ...base, isSettleTick: true, usdcAtomic: 1_000 });
+ expect(r.settleTick).toBe(false);
+ expect(r.degraded).toBe(false);
+ expect(r.backpressure.ok).toBe(false);
+ expect(r.backpressure.reason).toBe('insufficient_payer_usdc');
+ });
+
+ it('SOL floor and RPC faults never degrade — the whole tick skips', () => {
+ const floor = planBackpressure({ ...base, isSettleTick: true, solLamports: 1_000, usdcAtomic: 5_000_000 });
+ expect(floor.settleTick).toBe(true); // decision untouched; the skip is the outcome
+ expect(floor.degraded).toBe(false);
+ expect(floor.backpressure.reason).toBe('sponsor_sol_floor');
+
+ const rpc = planBackpressure({ ...base, isSettleTick: true, solLamports: Number.NaN, usdcAtomic: 5_000_000 });
+ expect(rpc.degraded).toBe(false);
+ expect(rpc.backpressure.reason).toBe('rpc_balance_unavailable');
+ });
+
+ it('a non-settle tick is passed through verbatim', () => {
+ const r = planBackpressure({ ...base, isSettleTick: false, usdcAtomic: 500_000 });
+ expect(r.settleTick).toBe(false);
+ expect(r.degraded).toBe(false);
+ expect(r.backpressure.ok).toBe(true);
+ });
+});
+
// ── Config gate: run only on a clean (no-error) envelope ────────────────────────
describe('ring-tick config gate', () => {
it('blocks when any ERROR-severity finding exists', () => {
@@ -169,10 +219,9 @@ describe('ringTickConfig', () => {
const c = ringTickConfig();
expect(c.enabled).toBe(true);
expect(c.calls).toBe(3);
- // settle every tick — the ~$50k/day throughput default (1440 ticks × $35 settle).
- expect(c.settleEveryN).toBe(1);
- expect(c.tickCapAtomic).toBe(40_000_000);
- expect(c.dailyCapAtomic).toBe(60_000_000_000);
+ expect(c.settleEveryN).toBe(5);
+ expect(c.tickCapAtomic).toBe(1_100_000);
+ expect(c.dailyCapAtomic).toBe(50_000_000);
});
it('X402_RING_TICK_ENABLED=false disables it; other values keep it on', () => {