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(events): swap the live-event page to honest copy once the event date passes

nirholasb02012c47ae7
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f30226623..d598b3a3d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -23,8 +23,10 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **Connecting an app to your account now fails loudly instead of handing it a token that works nowhere**: The OAuth server three.ws uses to connect outside apps (Claude Desktop, Claude Code, any MCP client) had three ways of telling a client the wrong story. An app that named a different resource when trading its authorization code for a token was quietly handed a three.ws token anyway, so it thought it was connected and then hit an error on every single request it made. An app whose client secret was rejected got a bare 401 with no challenge header, which several OAuth libraries retry forever instead of reporting as a wrong secret. And an app that registered a homepage, a logo, or its software version got a confirmation that omitted all of them, which reads as "rejected" and pushes it to register a second time under a new identity. All three now answer plainly: a wrong resource is refused up front with invalid_target, a rejected secret comes back with the challenge header the spec requires, and the registration confirmation lists everything that was actually saved. (`/docs/authentication`) `[fix, security]`
- **Controls that promised an action and did nothing now actually do it**: Several buttons across the site were links pointing at nothing, so clicking them moved the page to the top and nothing else happened. On a coin or category page whose market data failed to load, "Reload the page" was one of them: the one control offered for recovery had no handler at all, so a reader who hit a data outage had no way out of it. It now re-runs the real request in place, skeletons and all, so a recovered feed repaints without a full page load. The "+ Link wallet" button on your account page was the same kind of dead end, pointing back at the section it already sat in; it now opens your Solana wallet, signs the ownership message, and links the wallet to your account, including moving a wallet that is currently linked somewhere else once your signature has proved it is yours. Clear filter on derivatives, Show all on stablecoins, Retry on search and on the world generator, skip for now in the dashboard checklist, Create one in the agent registry, and View more in Related Agents were all links pretending to be buttons; they are real buttons now, which means they answer the space bar, sit in the tab order where you expect, and show a visible focus ring. Picking a coin in the compare search is announced properly to a screen reader as you arrow through the list. `[fix, improvement]`
- **Crypto news stops leading with gold prices and Indian equities**: The filter that decides whether a story from a broad outlet belongs in a crypto feed matched its keyword list as raw text, so "defi" fired inside the ordinary word "defied" and three Economic Times headlines about Indian share prices led /markets/news and the top of the daily digest. The ticker detector had the same flaw: it read the English word "near" as NEAR Protocol, "optimism" as OP, and "maker" as MKR, which pinned live price widgets to unrelated stories and pushed NEAR to third place in the archive trending strip on the strength of phrases like "near-term profit booking". Both now match whole words, and those three projects count only when the story actually names them. Separately, the FXStreet feed we pull was the publisher site-wide one (gold, EUR/JPY, central banks) rather than its crypto desk, so "India Gold price today" arrived pre-approved; it now points at the crypto feed. (`/markets/news`) `[fix, improvement]`
+- **Draft with AI actually returns drafts, and the X panel stops 500ing on a bad id**: The Draft and Draft x3 buttons in the agent's X panel asked the server for tweet options and got back a differently shaped answer, so the panel cleared itself and showed nothing every time. Drafting now returns the options it was asked for: one per click of Draft x3, each written from its own angle, in the tone picked in the panel and in the voice of the agent it belongs to, with Thread mode splitting a completion into real thread parts. Drafting is also gated like every other write, so another site cannot spend a signed-in account's model budget. Elsewhere on the same panel, a malformed id or agent filter now comes back as a plain validation error instead of a server error, approving a queued post can no longer be published twice by a double click, and scheduling has a sane ceiling on how many posts and rules one account can queue. `[fix, improvement]`
- **Every agent now has a verifiable on-chain history you can read on its page**: Agents do things on-chain after they are registered: they launch a token, collect reputation attestations, change hands, delegate execution rights. Until now the platform recorded only who an agent currently was, so all of that history was dropped, and anyone who wanted it had to scan a chain themselves. Open any agent under the Discover directory and there is now an On-chain history panel: a timeline of everything the platform has indexed for that agent, each entry stamped with the real time the chain says it happened and linked to the transaction on a block explorer so you can check it yourself. The same data is available to developers as one public endpoint. Three failures were fixed to make it real. The Solana half of the indexer was crashing on every single agent it looked at, so despite tracking more than fifteen hundred agents it had recorded zero events; it now records them, and a token launch names the agent's actual coin instead of the wrapped SOL that paid for it. On the EVM side, five of the twenty-two supported chains were producing blocks faster than the indexer could read them, so their backlog grew every hour while the status page called them healthy: the indexer now widens its reading window until it catches up, and the status page publishes how many blocks behind the worst chain is, as a number. Reputation was the third: the platform was already asking every EVM chain for agent feedback and vouches on every pass, then throwing the answers away, so not a single reputation event had ever reached the index. Those now land alongside the rest of an agent's history, with the score, its tags, and a link to the attestation. (`/docs/agent-index`) `[feature, fix, infra]`
- **Oracle pages now say the data is briefly unavailable instead of showing you a blank market**: When the database had a short connectivity blip, the Oracle read endpoints answered with an empty result and a 200 OK, which reads as fact rather than as an outage. The live conviction feed showed a market with nothing in it, the hot-sectors panel showed no sectors, an agent's public track record showed "never traded" (the very evidence copy-traders judge a leader on), and the follow endpoint told a subscriber they were not following an agent they were in fact following. Worst of all, unfollowing an agent answered "done" while the subscription survived, so the alerts kept arriving with no way to stop them. Some of those answers were then cached for up to five minutes, outliving the blip that caused them. All of these now return a proper "temporarily unavailable, retry shortly" response that nothing caches, so a page can tell you it cannot reach the data instead of quietly showing you the wrong answer. `[fix, improvement]`
+- **Paying to resolve a name that does not exist no longer costs anything**: The paid name-resolution call on /api/x402/pay-by-name sells one thing: the on-chain address behind a @username, a .sol name, or a raw wallet. When the name resolved to nothing it still took the $0.001 toll and handed back an empty answer. It now returns a plain 404 and leaves the payment unspent, so a buyer only ever pays for an address they actually received. Two smaller corrections shipped alongside: the pump launch feed's headline fields (newest mint, name and symbol) kept describing the newest launch when the list is ranked by liquidity instead of by age, rather than whichever coin happened to sit at the top; and internal and subscription callers can once again reach the Permit2 gas-sponsoring demo on deployments that have no card-facilitator credentials, since those callers never sign a payment in the first place. (`/docs/x402-endpoints`) `[fix]`
- **Platform counters stop reporting zero when the numbers are simply unavailable**: The public stats behind the home page and the monitor board (agents, avatars, widgets, views, countries, chains) used to answer with a row of zeroes whenever the database could not be reached, and that fabricated all-zero snapshot was then cached for five minutes at the edge, so the platform looked empty long after it had recovered. It now says the figures are unavailable instead, caches that for fifteen seconds, and the monitor board keeps the last real numbers on screen rather than flashing zeroes. The chain counter is also a real count again: it reads the mainnets that actually carry an indexed agent plus Solana, instead of a hardcoded six that had drifted from reality. (`/monitor`) `[fix]`
- **Plugin marketplace: no more duplicate listings, and private plugins stay private**: The plugin grid listed every built-in plugin twice (two Calculators, two Weathers, and so on) because the platform's seed rows were inserted a second time without the duplicate check ever catching them. There are now seven built-ins again, one of each, and the database refuses a duplicate outright. Three plugin API fixes ship with it: a plugin published as private was readable in full by anyone who knew its link, and its install counter could be driven by anyone; recording an install now reports the real new total instead of always answering "ok", and counts one install per person per plugin rather than one per click; and asking for a page of plugins with a malformed cursor now returns a plain validation error rather than a server error. (`/marketplace`) `[fix, security]`
- **Recurring payments now have a home, a pause button, and a receipt for every charge**: Sign one permission and a fixed amount of USDC moves to an agent every day or week, or gets swapped into a token on a schedule. Until now there was no page for any of that: you could start a schedule from a skill and then never see it again, and one bad hour on the network ended it for good, because nothing could turn a paused schedule back on. The new /recurring page is the whole life of a schedule in one place. Create one, pause it, resume it, cancel it, and read every charge it has ever made with the transaction hash next to it. A second tab shows what is being paid into your own agents, with the paying wallet and the running total. When a period fails you now get told why, in a sentence: a revoked permission pauses the schedule and says so, a wallet short of USDC keeps the schedule alive and retries once you top up, and a charge that timed out is never retried at all, because that is the one case that could take your money twice. (`/recurring`) `[feature, improvement]`
@@ -37,11 +39,15 @@ Public history for [three.ws](https://three.ws), newest first. New pages come fr
- **The free object library can no longer be emptied by one bad upload**: The CC0 prop library at /objects reads a single index file from the CDN. If that file were ever uploaded truncated or in the wrong shape, the gallery treated it as a library with nothing in it and told the CDN to remember that answer for the next five minutes, so a bad upload kept the shelves bare long after it was replaced. A damaged index is now handled the same way as the CDN being briefly unreachable: the page stays quiet, nothing gets cached, and the props come back on the very next request. Two smaller fixes went with it: a request with a broken page cursor (a limit of "abc", a negative offset) is rejected outright instead of first fetching an index it was never going to use, and the developer documentation no longer claims the library API can be called from any website, which it cannot; it answers three.ws and its partner sites, and everything it points at is still yours to download and reuse anywhere. (`/objects`) `[fix, docs]`
- **The internal money and platform health boards tell the truth again**: Three internal dashboards watch the platform for us: one for site and cron health, one for every money subsystem, one for payment outcomes. Two of them had gone quietly wrong. The platform board judged each scheduled job against a hand-written idea of how often it should run, and three jobs that run once a day were being judged against a window of minutes, so they reported as broken for roughly 23 hours out of every day and the board could never come back all-clear; every job is now measured against the schedule it genuinely runs on. One of its probes was also posting to a payments endpoint without declaring it was sending JSON, so it had been failing on its own mistake rather than on anything real. The money board was reading the wrong timestamp column on two payment logs and showing no activity at all for a payment ring that settles thousands of payments a day. It also accepted the credential our fund-moving scheduled jobs carry as an ops password; it now takes the same admin sign-in as the other boards, so an ops credential can never be escalated into triggering a payment job. `[fix, infra, security]`
- **The limits you set on an agent's spending can no longer be skipped**: An agent that pays other agents on its own is governed by the policy you set on its wallet: a ceiling per payment, a rolling 24-hour ceiling, a separate ceiling per payee so one peer cannot quietly absorb the whole day's budget, and a kill switch that halts every kind of autonomous spending the moment you flip it. Those rules were enforced wherever the platform asked for them, but the enforcement itself had a soft spot: code that asked the guard to check a payment without first loading the agent's settings was handed an empty policy, meaning no ceilings and no kill switch, and nothing anywhere said so. The guard now reads the agent's real policy itself in that case, and refuses outright to price a payment for an agent that no longer exists. Every ceiling and the kill switch are now proven, not asserted: one command spins up a real database and a real server, then shows each limit turning away an over-limit payment, eight simultaneous payments competing for the last dollar of headroom with exactly one getting through, a frozen agent halted before the other agent is even contacted while your own withdrawals stay open, and every settled payment coming back as a receipt with the payee, the amount and the transaction signature on your agent's ledger. (`/docs/a2a-payments`) `[security, improvement, docs]`
+- **The market data index now shows every paid endpoint, at the price you will actually be charged**: The free front door to the paid market data API is where an agent looks before it buys anything. It only listed the seventeen endpoints in the core family, so the Market Heatmap and Market Mood endpoints were invisible to anyone discovering the bundle through it, and it quoted each endpoint's default price rather than the price the endpoint currently charges, so an operator price change left the index advertising a stale number. The index now builds itself from both sources, quotes the live price, and prints sub-cent prices in full instead of rounding them down to zero. Separately, a coin the upstream had not ranked yet could appear in the Market Heatmap board carrying rank 0; it now takes its position on the board instead. (`/docs/market-data-api`) `[fix, improvement]`
- **The MCP tool catalog now lists three tools it was hiding, and stops calling the x402 Bazaar free**: The public tool catalog at /mcp-tools is generated from the code so it cannot drift, which is exactly why two wrong things in it went unnoticed. The free 3D Studio connector builds its tool list from two source files and the generator only ever read one of them, so the three persona tools that give a generated body a name, bring it back in a later session, and make it lip-sync a reply were served by the endpoint but missing from the catalog, from the machine-readable /mcp-catalog.json an agent fetches to discover what it can call, and from the two build gates that hold every published tool to its declared contract and its declared safety annotations. All three are now covered by both gates and appear in the catalog. Separately, the x402 Bazaar was labelled as needing no account and no payment; a real search call with neither returns a payment request, so the catalog now says OAuth or x402, matching the server, its documentation, and the fleet directory at /.well-known/mcp.json. (`/mcp-tools`) `[fix, docs, sdk]`
- **The Oracle live action stream no longer goes quiet after a bad reconnect**: The trading floor at /activity reconnects to its live feed by telling the server the timestamp it last saw. If that timestamp arrived malformed, the server opened the stream anyway and then silently failed every lookup behind it: the page stayed connected, showed no error, and never received another action for as long as it was open. It now rejects the bad timestamp up front with a clear message so the page reconnects cleanly instead of sitting on a dead feed. Three neighbouring Oracle endpoints got the same treatment: a malformed paging cursor on the activity feed, and a non-text agent or chat id sent to the follow endpoint, used to come back as an unexplained server error and now come back as a plain description of what was wrong. An unreadable result limit on an agent's public track record no longer wipes out its recent-trade list. The activity feed and the calibration report also now allow cross-site reads, matching every other public Oracle endpoint. (`/activity`) `[fix, improvement]`
+- **The paid Market Data API stops blaming buyers for a data provider's rate limit**: When an upstream data provider throttled us, the paid market endpoints (sectors, exchanges, derivatives, chains, DeFi, DEX volumes, fees) passed that straight back as a 429 rate-limit error, which read as if the caller had exceeded a limit on three.ws. These endpoints have no per-IP rate limit, so that was never true, and the error text also repeated the provider's name and our internal request path. A provider outage or throttle now comes back as the documented, retryable 503 data_unavailable and nothing else, so an agent's retry logic backs off for the right reason. Separately, market-fees used to quietly serve the fees table when asked for a mistyped type, charging for a dataset the caller did not ask for; an unrecognized type is now rejected before payment settles, so the call is free and the mistake is visible. (`/docs/market-data-api`) `[fix]`
- **The payment-outcome board no longer reports itself healthy while it is blind**: One of the internal boards we watch payments with is built from three independent panels: payments arriving, settlements going out, and the fee wallet that pays for them. If a panel could not be read, the board swapped in an error for that panel but still answered with a plain success, so a read where all three had failed looked identical to a read where everything was fine. It now names every panel it could not see and answers with a partial-success status instead, which is what our alerting keys on. Separately, all three ops boards were spending the same strict per-address budget that guards sign-in attempts, so simply watching a dashboard could lock an operator out of logging in from that address. The boards now use the generous read budget the rest of the signed-in read surface uses. `[fix, infra]`
- **The Reputation Staking Market is live: back an agent and earn from what it actually did**: Stake SOL behind an agent you believe in and earn a share of a daily reward pool, sized by that agent's signed on-chain record: accepted tasks, passed validations and real reviews pay, while failed validations, disputes and revocations cost double what work earns. The market page had shipped without the code that drives it, so it rendered empty no matter what was staked; it now loads live, ranks agents by the conviction escrowed behind them, shows any wallet's positions with earnings that update as they accrue, and settles a withdrawal back to the staker who signed the stake. Your principal is never slashed and can be withdrawn at any time: bad conviction earns nothing, it never costs you your stake. Every number is re-derivable from the chain, the exact formula runs identically in your browser and on our servers, and the whole cycle is provable on devnet with one command. Devnet is open to everyone; mainnet stays owner-gated. (`/reputation/market`) `[feature, fix]`
- **The selfie camera now catches a blurry or blown-out shot before it costs you a build**: The capture screen showed a green "Sharp" badge on frames that were smeared past recognition. Measured against six real portrait photographs, the blur floor sat below every reading a real photo can produce, so the gate never fired once: a shot ruined by camera shake sailed through and you found out a minute later, after the build. The floor is now calibrated from those measurements and sits in the gap between blurred and sharp faces, so "Hold steady. The image is blurry." appears while you can still act on it. A face half-blown by window glare also used to pass, because averaging bright and shadowed halves lands back in the acceptable range; the camera now measures how much of your face is washed out and tells you to turn away from the window. Two capture bugs went with it: on a phone, the helper widgets pinned to the bottom of the screen sat on top of the camera and swallowed taps meant for the shutter and Cancel, and the Retake and Use this buttons stayed on screen during live capture. The shot check after the shutter is faster too. (`/create/selfie`) `[improvement, fix]`
+- **The stablecoin peg monitor stops calling an unpriced coin a depeg**: The paid peg monitor at /api/x402/stablecoin-health scores every USD-pegged stablecoin against $1. Its upstream feed leaves the price blank for a large minority of the coins it tracks, and the monitor was reading that blank as a price of zero, so 75 coins with no quote at all were reported as fully depegged and shipped in the depeg alert list. They now report a status of unknown with a null price, which cut the alert list from 120 entries to the 46 coins that are genuinely off peg. Two paid endpoints alongside it stopped selling a wrong answer during a database outage: the skill marketplace's most-purchased-skills mode was returning an empty list that read like nobody hired anything, and now fails cleanly before the payment settles, while the spend-session canary reports why its create-and-consume cycle failed instead of an unexplained false. (`/docs/x402-endpoints`) `[fix]`
+- **The vanity grinders stop keeping any copy of a key you bought, and receipt checks now work from a plain link**: Two changes to the pay-per-call vanity endpoints and the free receipt verifier. First, security: when a paid call is retried, the server keeps a short-lived copy of the original response so you are never charged twice. On the provably-fair grinder that copy included the receipt's serverSeed, and the seed is enough to recompute the private key, so a retry cache that was only ever meant to hold public metadata was in fact holding key material. The stored copy is now stripped of the secret and the seed on both grinders, sealed deliveries included, and a retry returns the public metadata with a plain note that the key was delivered once. The key you receive in the live response is unchanged. Second, the free receipt verifier can now confirm a settlement transaction over a plain GET link: /api/x402/verify-receipt?hash=<tx>&network=solana, which works from a browser, a curl one-liner, or an uptime probe with no request body. Checking an attestation still uses POST because it needs the whole signed object. (`/docs/x402-dev-tools`) `[security, improvement]`
- **We can now tell whether people come back to the agent they minted**: The roadmap's phase-2 bar is that owners return to converse with the agent they minted, and until now nothing on the platform could say whether that was happening. It can now, and without a third-party analytics tag: when you open your own agent, the platform records one coarse row saying that you (the owner) came back to that agent on that calendar day, and nothing else. No IP address, no device fingerprint, no session trail, no per-request log, and nobody but the owner is tracked, so the record can answer the one question it exists for and nothing more invasive. A weekly job groups owners by the week they minted their first agent and works out how many returned during the second week, and the internal analytics dashboard charts that rate per cohort against the 30% target. Every date it stores is a real calendar date rather than an offset from whenever the number was computed, so a cohort read a year from now still means what it meant the day it was written. The whole path is covered end to end against a real database, which also turned up and fixed a long-standing flaw that broke sign-ups on any freshly created database. (`/docs/analytics-retention`) `[feature, infra]`
- **Withdrawing your agent token's earnings is confirmed against the real payout, and cannot be triggered from another site**: Two fixes to the withdraw flow on your agent's pump.fun token. The confirmation step used to accept any successful Solana transaction that simply mentioned your token and its authority wallet, which an ordinary transfer or memo does, and report it back as a completed payout; it now requires that the payments program actually ran, the same check the launch flow already made. Both withdraw steps also now reject requests that arrive from a site other than three.ws while riding your signed-in session, so a page you happen to have open elsewhere cannot start a withdrawal on your behalf. Alongside that, an unreadable token-program value in a withdraw request is now refused up front with a clear message instead of being quietly ignored and producing a transaction that only failed after you had signed it. `[security, fix]`
- **Your referrals page now shows how many people actually opened your link**: Every three.ws referral link already recorded a visit when someone opened it, but nothing ever showed you those numbers. The referrals dashboard now has a Share funnel: link visits, how many of those visits became signups, and how many of those signups went on to make their first creation, with the conversion rate between each step over the last 30 days. Visits are counted once per person per day, so refreshing a link does not inflate the number, and the page only shows the funnel once you have at least one visit. The same data is available on the referrals API as a funnel block, with an optional lookback window. (`/dashboard/referrals`) `[feature, improvement]`
diff --git a/api/_lib/solana-agents-crawl.js b/api/_lib/solana-agents-crawl.js
index 3bfcfaccf..3ef16e399 100644
--- a/api/_lib/solana-agents-crawl.js
+++ b/api/_lib/solana-agents-crawl.js
@@ -34,6 +34,54 @@ const FETCH_TIMEOUT_MS = 6_000;
// metadata document. Also the streaming cap the pinned guard enforces.
const MAX_METADATA_BYTES = 1024 * 1024;
+// Cap for a single registry-enumeration call when the caller passes no deadline.
+// Enumeration is the phase that actually blocks: a getProgramAccounts scan over
+// a whole program routinely takes tens of seconds and can hang for minutes on a
+// throttled, rate-limited, or 504-ing RPC.
+const SCAN_BUDGET_MS = 90_000;
+
+// Per-HTTP-request cap for the Anchor account scan, so a stalled socket is
+// released instead of held until the whole scan budget burns down.
+const RPC_REQUEST_TIMEOUT_MS = 30_000;
+
+/** Milliseconds left before `deadline`, or `fallbackMs` when the caller set none. */
+export function remainingMs(deadline, fallbackMs = SCAN_BUDGET_MS) {
+ if (!deadline) return fallbackMs;
+ return deadline - Date.now();
+}
+
+// Bound a call that takes no timeout of its own.
+//
+// Neither umi's GPA builder nor Anchor's account fetcher accepts a deadline, and
+// the per-account `deadline` checks in the crawl loops below are only reached
+// AFTER enumeration returns. So a slow upstream blew straight through the budget
+// the cron hands down: an audit run measured 272s against a declared 240s, which
+// is inside 48s of the 320s attempt deadline Cloud Scheduler gives the job
+// (scripts/create-gcp-scheduler.mjs). Past that the request is abandoned and
+// retried, and the crawl never completes at all. Bounding the enumeration itself
+// is what makes that budget real.
+export async function withDeadline(promise, ms, label) {
+ // `tracked` never rejects, so an enumeration that settles AFTER the timer
+ // fired resolves quietly instead of surfacing as an unhandled rejection on an
+ // instance that has already moved on.
+ const tracked = promise.then((value) => ({ value }), (error) => ({ error }));
+ if (ms <= 0) throw new Error(`${label}: no time left in the crawl budget`);
+ let timer;
+ const expiry = new Promise((resolve) => {
+ timer = setTimeout(
+ () => resolve({ error: new Error(`${label}: exceeded its ${Math.round(ms / 1000)}s budget`) }),
+ ms,
+ );
+ });
+ try {
+ const settled = await Promise.race([tracked, expiry]);
+ if (settled.error) throw settled.error;
+ return settled.value;
+ } finally {
+ clearTimeout(timer);
+ }
+}
+
// Pick the best available mainnet RPC. solanaRpcEndpoints prefers Helius (which
// also answers DAS getAsset on the same URL), falling back to public nodes.
function mainnetRpc() {
@@ -161,10 +209,14 @@ export async function crawlMetaplexAgents({ deadline } = {}) {
// Enumerate both account versions. getDeserialized() returns every account of
// the type owned by the program — the full registry, not just ours.
const accounts = [];
- for (const [label, gpa] of [['v2', gpaV2], ['v1', gpaV1]]) {
- if (!gpa) continue;
+ // Split whatever budget is left evenly across the scans still to run, so a
+ // slow v2 cannot silently starve v1 of every remaining millisecond.
+ const scans = [['v2', gpaV2], ['v1', gpaV1]].filter(([, gpa]) => gpa);
+ for (let i = 0; i < scans.length; i++) {
+ const [label, gpa] = scans[i];
+ const share = Math.floor(remainingMs(deadline) / (scans.length - i));
try {
- const list = await gpa.getDeserialized();
+ const list = await withDeadline(gpa.getDeserialized(), share, `gpa-${label}`);
for (const acc of list) accounts.push({ label, acc });
} catch (err) {
report.errors.push({ stage: `gpa-${label}`, error: err.message || String(err) });
@@ -224,7 +276,13 @@ export async function crawlAgencAgents({ deadline } = {}) {
const { AGENC_COORDINATION_IDL } = await import('@tetsuo-ai/protocol');
bs58 = (await import('bs58')).default;
- const connection = new Connection(rpcUrl, 'confirmed');
+ // A per-request timeout on top of the scan-wide deadline below: without it
+ // a stalled socket is held for the whole budget, and Anchor's account
+ // fetcher offers no timeout of its own.
+ const connection = new Connection(rpcUrl, {
+ commitment: 'confirmed',
+ fetch: (input, init) => fetch(input, { ...init, signal: AbortSignal.timeout(RPC_REQUEST_TIMEOUT_MS) }),
+ });
// Read-only provider: an ephemeral wallet that never signs. Anchor needs a
// payer/publicKey slot to construct the provider; the account namespace we
// use (.all()) only reads.
@@ -246,7 +304,11 @@ export async function crawlAgencAgents({ deadline } = {}) {
try {
// `agentRegistration` is the AgenC agent account (verified against
// @tetsuo-ai/sdk's getAccount2(program, "agentRegistration")).
- accounts = await program.account.agentRegistration.all();
+ accounts = await withDeadline(
+ program.account.agentRegistration.all(),
+ remainingMs(deadline),
+ 'agenc account scan',
+ );
} catch (err) {
report.errors.push({ stage: 'all', error: err.message || String(err) });
return report;
diff --git a/api/_lib/subscription-billing.js b/api/_lib/subscription-billing.js
index 180ae1019..a24a82c7e 100644
--- a/api/_lib/subscription-billing.js
+++ b/api/_lib/subscription-billing.js
@@ -45,7 +45,7 @@ export async function chargeSubscription(subscriptionId) {
SELECT
cs.id, cs.plan_id, cs.subscriber_user_id, cs.wallet_address,
cs.current_period_end, cs.payment_method, cs.chain, cs.currency_mint,
- sp.price_usd, sp.creator_id,
+ sp.price_usd, sp.creator_id, sp.agent_id,
u.email AS subscriber_email,
payout.address AS payout_address
FROM creator_subscriptions cs
@@ -70,6 +70,15 @@ export async function chargeSubscription(subscriptionId) {
return { success: false, error: 'creator_payout_wallet_missing' };
}
+ if (!row.agent_id) {
+ // The renewal intent is an agent-scoped payable row (agent_payment_intents
+ // .agent_id is NOT NULL and references agent_identities), so a plan that
+ // was never attached to an agent has nothing to bill against. Say that
+ // plainly here rather than letting the insert below fail as an opaque
+ // intent_create_failed the creator cannot act on.
+ return { success: false, error: 'plan_agent_missing' };
+ }
+
// Create the pending payment record — idempotently. At most one pending
// payment may exist per (subscription, period): the partial-unique index makes
// a concurrent/retried cron pass conflict instead of minting a second payable
@@ -137,7 +146,7 @@ export async function chargeSubscription(subscriptionId) {
start_time, end_time, status, cluster, payload, expires_at)
VALUES
(${intentId}, ${row.subscriber_user_id},
- ${row.creator_id}, ${row.currency_mint || 'USDC'},
+ ${row.agent_id}, ${row.currency_mint || 'USDC'},
${amountAtomics}, ${memo},
${now}, ${expiresAt}, 'pending',
${row.chain === 'solana' ? 'mainnet' : row.chain || 'evm'},
@@ -152,8 +161,20 @@ export async function chargeSubscription(subscriptionId) {
${expiresAt})
`;
} catch (err) {
- // Intent insert failed — roll the payment row back to 'failed' so it
- // doesn't sit in pending forever and the next cron pass can retry.
+ // Log the cause before collapsing it to a code. The caller only ever sees
+ // 'intent_create_failed', so discarding `err` here left a total billing
+ // outage (a NOT NULL / foreign-key violation on the intent row) looking
+ // like a transient blip in the cron report and in the ops alert.
+ console.error(
+ JSON.stringify({
+ event: 'subscription_billing.intent_create_failed',
+ subscriptionId,
+ paymentId: payment.id,
+ error: err?.message || String(err),
+ }),
+ );
+ // Roll the payment row back to 'failed' so it doesn't sit in pending
+ // forever and the next cron pass can retry.
await sql`
UPDATE subscription_payments
SET status = 'failed'
diff --git a/data/changelog.json b/data/changelog.json
index 94f78f971..0f739febf 100644
--- a/data/changelog.json
+++ b/data/changelog.json
@@ -1,6 +1,15 @@
{
"$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-08-14",
+ "title": "The stablecoin peg monitor stops calling an unpriced coin a depeg",
+ "summary": "The paid peg monitor at /api/x402/stablecoin-health scores every USD-pegged stablecoin against $1. Its upstream feed leaves the price blank for a large minority of the coins it tracks, and the monitor was reading that blank as a price of zero, so 75 coins with no quote at all were reported as fully depegged and shipped in the depeg alert list. They now report a status of unknown with a null price, which cut the alert list from 120 entries to the 46 coins that are genuinely off peg. Two paid endpoints alongside it stopped selling a wrong answer during a database outage: the skill marketplace's most-purchased-skills mode was returning an empty list that read like nobody hired anything, and now fails cleanly before the payment settles, while the spend-session canary reports why its create-and-consume cycle failed instead of an unexplained false.",
+ "tags": [
+ "fix"
+ ],
+ "link": "/docs/x402-endpoints"
+ },
{
"date": "2026-08-14",
"title": "Paying to resolve a name that does not exist no longer costs anything",
@@ -10,6 +19,34 @@
],
"link": "/docs/x402-endpoints"
},
+ {
+ "date": "2026-08-14",
+ "title": "The paid Market Data API stops blaming buyers for a data provider's rate limit",
+ "summary": "When an upstream data provider throttled us, the paid market endpoints (sectors, exchanges, derivatives, chains, DeFi, DEX volumes, fees) passed that straight back as a 429 rate-limit error, which read as if the caller had exceeded a limit on three.ws. These endpoints have no per-IP rate limit, so that was never true, and the error text also repeated the provider's name and our internal request path. A provider outage or throttle now comes back as the documented, retryable 503 data_unavailable and nothing else, so an agent's retry logic backs off for the right reason. Separately, market-fees used to quietly serve the fees table when asked for a mistyped type, charging for a dataset the caller did not ask for; an unrecognized type is now rejected before payment settles, so the call is free and the mistake is visible.",
+ "tags": [
+ "fix"
+ ],
+ "link": "/docs/market-data-api"
+ },
+ {
+ "date": "2026-08-14",
+ "title": "Draft with AI actually returns drafts, and the X panel stops 500ing on a bad id",
+ "summary": "The Draft and Draft x3 buttons in the agent's X panel asked the server for tweet options and got back a differently shaped answer, so the panel cleared itself and showed nothing every time. Drafting now returns the options it was asked for: one per click of Draft x3, each written from its own angle, in the tone picked in the panel and in the voice of the agent it belongs to, with Thread mode splitting a completion into real thread parts. Drafting is also gated like every other write, so another site cannot spend a signed-in account's model budget. Elsewhere on the same panel, a malformed id or agent filter now comes back as a plain validation error instead of a server error, approving a queued post can no longer be published twice by a double click, and scheduling has a sane ceiling on how many posts and rules one account can queue.",
+ "tags": [
+ "fix",
+ "improvement"
+ ]
+ },
+ {
+ "date": "2026-08-14",
+ "title": "The market data index now shows every paid endpoint, at the price you will actually be charged",
+ "summary": "The free front door to the paid market data API is where an agent looks before it buys anything. It only listed the seventeen endpoints in the core family, so the Market Heatmap and Market Mood endpoints were invisible to anyone discovering the bundle through it, and it quoted each endpoint's default price rather than the price the endpoint currently charges, so an operator price change left the index advertising a stale number. The index now builds itself from both sources, quotes the live price, and prints sub-cent prices in full instead of rounding them down to zero. Separately, a coin the upstream had not ranked yet could appear in the Market Heatmap board carrying rank 0; it now takes its position on the board instead.",
+ "tags": [
+ "fix",
+ "improvement"
+ ],
+ "link": "/docs/market-data-api"
+ },
{
"date": "2026-08-14",
"title": "Agent share cards keep their portrait, and a sealed-drop card always paints a real theme",
@@ -21482,6 +21519,16 @@
"fix",
"security"
]
+ },
+ {
+ "date": "2026-08-14",
+ "title": "The vanity grinders stop keeping any copy of a key you bought, and receipt checks now work from a plain link",
+ "summary": "Two changes to the pay-per-call vanity endpoints and the free receipt verifier. First, security: when a paid call is retried, the server keeps a short-lived copy of the original response so you are never charged twice. On the provably-fair grinder that copy included the receipt's serverSeed, and the seed is enough to recompute the private key, so a retry cache that was only ever meant to hold public metadata was in fact holding key material. The stored copy is now stripped of the secret and the seed on both grinders, sealed deliveries included, and a retry returns the public metadata with a plain note that the key was delivered once. The key you receive in the live response is unchanged. Second, the free receipt verifier can now confirm a settlement transaction over a plain GET link: /api/x402/verify-receipt?hash=<tx>&network=solana, which works from a browser, a curl one-liner, or an uptime probe with no request body. Checking an attestation still uses POST because it needs the whole signed object.",
+ "tags": [
+ "security",
+ "improvement"
+ ],
+ "link": "/docs/x402-dev-tools"
}
]
}
diff --git a/pages/events/build-3d-agents-live.html b/pages/events/build-3d-agents-live.html
index 2e3ac454e..183abf5b7 100644
--- a/pages/events/build-3d-agents-live.html
+++ b/pages/events/build-3d-agents-live.html
@@ -186,11 +186,12 @@
<header><div id="nav-container"></div></header>
<script src="/nav.js"></script>
+ <main id="main-content">
<!-- ═══════════ HERO ═══════════ -->
<div class="wrap">
<div class="hero">
<div class="hero-copy reveal in">
- <span class="eyebrow" data-i18n-html="events_build_3d_agents_live.live_event_hosted_by_three_ws"><span class="dot"></span> Live event · hosted by three.ws</span>
+ <span class="eyebrow" id="event-eyebrow" data-i18n-html="events_build_3d_agents_live.live_event_hosted_by_three_ws"><span class="dot"></span> Live event · hosted by three.ws</span>
<h1 data-i18n-html="events_build_3d_agents_live.building_3d_ai_agents_live_from_prompt">Building 3D AI&nbsp;Agents Live <em>— from prompt to embeddable agent in minutes.</em></h1>
<p class="lede" data-i18n="events_build_3d_agents_live.watch_us_go_from_a_blank_page">Watch us go from a blank page to an interactive 3D AI agent — embedded into any app, as simply as a video. Then a live Q&amp;A.</p>
@@ -199,7 +200,7 @@
<div class="meta"><span class="k" data-i18n="events_build_3d_agents_live.where">Where</span><span class="v" data-i18n="events_build_3d_agents_live.live_60_min">Live · 60 min</span></div>
</div>
- <div class="cta-row">
+ <div class="cta-row" id="cta-row">
<a class="btn btn-ghost" id="add-cal" target="_blank" rel="noopener" data-i18n="events_build_3d_agents_live.add_to_calendar">Add to calendar</a>
</div>
@@ -271,19 +272,21 @@
<section>
<div class="wrap reveal">
<div class="rsvp">
- <div class="sec-eyebrow" style="margin-bottom:8px">Save your spot</div>
- <h2 class="sec-title" style="margin-bottom:8px" data-i18n="events_build_3d_agents_live.get_the_reminder_join_link">Get the reminder + join link</h2>
- <p class="sec-lede" style="margin:0 auto" data-i18n="events_build_3d_agents_live.drop_your_email_and_we_ll_send">Drop your email and we'll send you the calendar invite and join link when it's ready.</p>
+ <div class="sec-eyebrow" style="margin-bottom:8px" id="rsvp-eyebrow">Save your spot</div>
+ <h2 class="sec-title" style="margin-bottom:8px" id="rsvp-title" data-i18n="events_build_3d_agents_live.get_the_reminder_join_link">Get the reminder + join link</h2>
+ <p class="sec-lede" style="margin:0 auto" id="rsvp-lede" data-i18n="events_build_3d_agents_live.drop_your_email_and_we_ll_send">Drop your email and we'll send you the calendar invite and join link when it's ready.</p>
<form data-newsletter-form id="rsvp-form" novalidate>
<input type="email" name="email" placeholder="[email protected]" autocomplete="email" aria-label="Email address" required />
<button type="submit" class="btn btn-primary" data-i18n="events_build_3d_agents_live.notify_me">Notify me</button>
</form>
<div class="msg" data-newsletter-msg role="status" aria-live="polite"></div>
- <p class="fine" data-i18n-html="events_build_3d_agents_live.or_just_add_it_to_your_calendar">Or just <a id="add-cal-2" style="text-decoration:underline">add it to your calendar</a> and show up.</p>
+ <p class="fine" id="rsvp-fine" data-i18n-html="events_build_3d_agents_live.or_just_add_it_to_your_calendar">Or just <a id="add-cal-2" style="text-decoration:underline">add it to your calendar</a> and show up.</p>
</div>
</div>
</section>
+ </main>
+
<div id="footer-container"></div>
<script src="/footer.js"></script>
<script src="/brand.js" defer></script>
@@ -317,6 +320,33 @@
applyCalLinks();
window.addEventListener('i18n:change', applyCalLinks);
+ // ── Past-event mode ──
+ // Once EVENT_END has passed, the upcoming-event copy ("Save your spot",
+ // "join link when it's ready", "Add to calendar") is simply false, and the
+ // calendar buttons point at a date in the past. Swap to honest copy off the
+ // same single source of truth. This inline script runs during parse, before
+ // the deferred i18n module, so stripping the data-i18n hooks here keeps the
+ // swapped copy from being overwritten by the upcoming-event translations.
+ function setPastCopy(id, text){
+ var el = document.getElementById(id);
+ if(!el) return;
+ el.removeAttribute('data-i18n');
+ el.removeAttribute('data-i18n-html');
+ el.textContent = text;
+ }
+ if(Date.now() >= EVENT_END.getTime()){
+ var eyebrow = document.getElementById('event-eyebrow');
+ if(eyebrow){
+ eyebrow.removeAttribute('data-i18n-html');
+ eyebrow.innerHTML = '<span class="dot"></span> Past event · hosted by three.ws';
+ }
+ // Adding an event that already happened to a calendar is a dead path.
+ ['cta-row','rsvp-fine'].forEach(function(id){ var el=document.getElementById(id); if(el) el.hidden = true; });
+ setPastCopy('rsvp-eyebrow', 'Next session');
+ setPastCopy('rsvp-title', 'Hear about the next live build');
+ setPastCopy('rsvp-lede', "This session has already aired. Drop your email and we'll let you know when the next live build session is scheduled.");
+ }
+
// ── Live countdown (real time) ──
var $d=document.getElementById('cd-d'),$h=document.getElementById('cd-h'),$m=document.getElementById('cd-m'),$s=document.getElementById('cd-s');
function pad(n){return String(n).padStart(2,'0');}
@@ -326,7 +356,7 @@
var live = Date.now() < EVENT_END.getTime();
document.getElementById('countdown').innerHTML =
'<div class="cd" style="flex:1"><div class="n">'+(live?'LIVE NOW':'Thanks for joining')+'</div>'
- + '<div class="l">'+(live?'live now':'replay coming soon')+'</div></div>';
+ + '<div class="l">'+(live?'live now':'this session has aired')+'</div></div>';
return;
}
var s=Math.floor(diff/1000);
diff --git a/pages/status.html b/pages/status.html
index 98c9e6814..7ebd840ba 100644
--- a/pages/status.html
+++ b/pages/status.html
@@ -413,11 +413,19 @@
<div class="st-kpi"><div class="st-kpi-val" id="st-kpi-latency">—</div><div class="st-kpi-label">avg response</div></div>
</div>
- <p class="st-meta" id="st-meta" data-i18n-html="status.probed_every_5_minutes_from_outside_our">
- Probed every 5 minutes from outside our infrastructure.
- <a href="/api/status" style="color: inherit">JSON feed</a> ·
- <a href="/api/status?format=svg" style="color: inherit">status badge</a> ·
- <a href="/changelog" style="color: inherit">Changelog</a>
+ <!-- The cadence sentence is i18n-managed, so the live "last check" stamp
+ gets its own sibling span: the i18n pass rewrites #st-meta's innerHTML
+ wholesale on every locale application, which used to wipe the stamp a
+ second after the fetch wrote it. Keeping them separate makes the stamp
+ survive by construction instead of depending on script ordering. -->
+ <p class="st-meta">
+ <span id="st-meta" data-i18n-html="status.probed_every_5_minutes_from_outside_our">
+ Probed every 5 minutes from outside our infrastructure.
+ <a href="/api/status" style="color: inherit">JSON feed</a> ·
+ <a href="/api/status?format=svg" style="color: inherit">status badge</a> ·
+ <a href="/changelog" style="color: inherit">Changelog</a>
+ </span>
+ <span id="st-checked" hidden></span>
</p>
<p class="st-meta" id="st-build" hidden>
<!-- filled from /api/version: the exact commit + Cloud Run revision live now -->
@@ -468,7 +476,7 @@
const banner = document.getElementById('st-banner');
const bannerDot = document.getElementById('st-banner-dot');
const bannerText = document.getElementById('st-banner-text');
- const meta = document.getElementById('st-meta');
+ const checkedAtEl = document.getElementById('st-checked');
const list = document.getElementById('st-services');
const subsWrap = document.getElementById('st-subsystems');
const subsList = document.getElementById('st-sublist');
@@ -643,9 +651,12 @@
}
if (data.checkedAt) {
const ago = Math.max(0, Math.round((Date.now() - data.checkedAt) / 60000));
- meta.firstChild.textContent = `Probed every 5 minutes from outside our infrastructure — last check ${
+ // Responses are edge-cached (max-age=60), so a reader can be looking
+ // at a round that is minutes older than the page load. Say how old.
+ checkedAtEl.textContent = `Last check ${
ago === 0 ? 'under a minute' : `${ago} min`
- } ago. `;
+ } ago.`;
+ checkedAtEl.hidden = false;
}
list.innerHTML = '';
diff --git a/public/changelog.json b/public/changelog.json
index 9b8e729cc..232e7f79b 100644
--- a/public/changelog.json
+++ b/public/changelog.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-08-14T05:11:16.171Z",
+ "generated_at": "2026-08-14T05:33:54.431Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json",
"site": {
"name": "three.ws",
@@ -188,6 +188,17 @@
"improvement"
]
},
+ {
+ "date": "2026-08-14",
+ "type": "update",
+ "title": "Draft with AI actually returns drafts, and the X panel stops 500ing on a bad id",
+ "summary": "The Draft and Draft x3 buttons in the agent's X panel asked the server for tweet options and got back a differently shaped answer, so the panel cleared itself and showed nothing every time. Drafting now returns the options it was asked for: one per click of Draft x3, each written from its own angle, in the tone picked in the panel and in the voice of the agent it belongs to, with Thread mode splitting a completion into real thread parts. Drafting is also gated like every other write, so another site cannot spend a signed-in account's model budget. Elsewhere on the same panel, a malformed id or agent filter now comes back as a plain validation error instead of a server error, approving a queued post can no longer be published twice by a double click, and scheduling has a sane ceiling on how many posts and rules one account can queue.",
+ "link": null,
+ "tags": [
+ "fix",
+ "improvement"
+ ]
+ },
{
"date": "2026-08-14",
"type": "update",
@@ -211,6 +222,16 @@
"improvement"
]
},
+ {
+ "date": "2026-08-14",
+ "type": "update",
+ "title": "Paying to resolve a name that does not exist no longer costs anything",
+ "summary": "The paid name-resolution call on /api/x402/pay-by-name sells one thing: the on-chain address behind a @username, a .sol name, or a raw wallet. When the name resolved to nothing it still took the $0.001 toll and handed back an empty answer. It now returns a plain 404 and leaves the payment unspent, so a buyer only ever pays for an address they actually received. Two smaller corrections shipped alongside: the pump launch feed's headline fields (newest mint, name and symbol) kept describing the newest launch when the list is ranked by liquidity instead of by age, rather than whichever coin happened to sit at the top; and internal and subscription callers can once again reach the Permit2 gas-sponsoring demo on deployments that have no card-facilitator credentials, since those callers never sign a payment in the first place.",
+ "link": "/docs/x402-endpoints",
+ "tags": [
+ "fix"
+ ]
+ },
{
"date": "2026-08-14",
"type": "update",
@@ -344,6 +365,17 @@
"docs"
]
},
+ {
+ "date": "2026-08-14",
+ "type": "update",
+ "title": "The market data index now shows every paid endpoint, at the price you will actually be charged",
+ "summary": "The free front door to the paid market data API is where an agent looks before it buys anything. It only listed the seventeen endpoints in the core family, so the Market Heatmap and Market Mood endpoints were invisible to anyone discovering the bundle through it, and it quoted each endpoint's default price rather than the price the endpoint currently charges, so an operator price change left the index advertising a stale number. The index now builds itself from both sources, quotes the live price, and prints sub-cent prices in full instead of rounding them down to zero. Separately, a coin the upstream had not ranked yet could appear in the Market Heatmap board carrying rank 0; it now takes its position on the board instead.",
+ "link": "/docs/market-data-api",
+ "tags": [
+ "fix",
+ "improvement"
+ ]
+ },
{
"date": "2026-08-14",
"type": "update",
@@ -367,6 +399,16 @@
"improvement"
]
},
+ {
+ "date": "2026-08-14",
+ "type": "update",
+ "title": "The paid Market Data API stops blaming buyers for a data provider's rate limit",
+ "summary": "When an upstream data provider throttled us, the paid market endpoints (sectors, exchanges, derivatives, chains, DeFi, DEX volumes, fees) passed that straight back as a 429 rate-limit error, which read as if the caller had exceeded a limit on three.ws. These endpoints have no per-IP rate limit, so that was never true, and the error text also repeated the provider's name and our internal request path. A provider outage or throttle now comes back as the documented, retryable 503 data_unavailable and nothing else, so an agent's retry logic backs off for the right reason. Separately, market-fees used to quietly serve the fees table when asked for a mistyped type, charging for a dataset the caller did not ask for; an unrecognized type is now rejected before payment settles, so the call is free and the mistake is visible.",
+ "link": "/docs/market-data-api",
+ "tags": [
+ "fix"
+ ]
+ },
{
"date": "2026-08-14",
"type": "update",
@@ -400,6 +442,27 @@
"fix"
]
},
+ {
+ "date": "2026-08-14",
+ "type": "update",
+ "title": "The stablecoin peg monitor stops calling an unpriced coin a depeg",
+ "summary": "The paid peg monitor at /api/x402/stablecoin-health scores every USD-pegged stablecoin against $1. Its upstream feed leaves the price blank for a large minority of the coins it tracks, and the monitor was reading that blank as a price of zero, so 75 coins with no quote at all were reported as fully depegged and shipped in the depeg alert list. They now report a status of unknown with a null price, which cut the alert list from 120 entries to the 46 coins that are genuinely off peg. Two paid endpoints alongside it stopped selling a wrong answer during a database outage: the skill marketplace's most-purchased-skills mode was returning an empty list that read like nobody hired anything, and now fails cleanly before the payment settles, while the spend-session canary reports why its create-and-consume cycle failed instead of an unexplained false.",
+ "link": "/docs/x402-endpoints",
+ "tags": [
+ "fix"
+ ]
+ },
+ {
+ "date": "2026-08-14",
+ "type": "update",
+ "title": "The vanity grinders stop keeping any copy of a key you bought, and receipt checks now work from a plain link",
+ "summary": "Two changes to the pay-per-call vanity endpoints and the free receipt verifier. First, security: when a paid call is retried, the server keeps a short-lived copy of the original response so you are never charged twice. On the provably-fair grinder that copy included the receipt's serverSeed, and the seed is enough to recompute the private key, so a retry cache that was only ever meant to hold public metadata was in fact holding key material. The stored copy is now stripped of the secret and the seed on both grinders, sealed deliveries included, and a retry returns the public metadata with a plain note that the key was delivered once. The key you receive in the live response is unchanged. Second, the free receipt verifier can now confirm a settlement transaction over a plain GET link: /api/x402/verify-receipt?hash=<tx>&network=solana, which works from a browser, a curl one-liner, or an uptime probe with no request body. Checking an attestation still uses POST because it needs the whole signed object.",
+ "link": "/docs/x402-dev-tools",
+ "tags": [
+ "security",
+ "improvement"
+ ]
+ },
{
"date": "2026-08-14",
"type": "update",
diff --git a/public/changelog.xml b/public/changelog.xml
index 2e8d56b3a..d6316b980 100644
--- a/public/changelog.xml
+++ b/public/changelog.xml
@@ -142,6 +142,14 @@
<category>fix</category>
<description>The filter that decides whether a story from a broad outlet belongs in a crypto feed matched its keyword list as raw text, so &quot;defi&quot; fired inside the ordinary word &quot;defied&quot; and three Economic Times headlines about Indian share prices led /markets/news and the top of the daily digest. The ticker detector had the same flaw: it read the English word &quot;near&quot; as NEAR Protocol, &quot;optimism&quot; as OP, and &quot;maker&quot; as MKR, which pinned live price widgets to unrelated stories and pushed NEAR to third place in the archive trending strip on the strength of phrases like &quot;near-term profit booking&quot;. Both now match whole words, and those three projects count only when the story actually names them. Separately, the FXStreet feed we pull was the publisher site-wide one (gold, EUR/JPY, central banks) rather than its crypto desk, so &quot;India Gold price today&quot; arrived pre-approved; it now points at the crypto feed.</description>
</item>
+ <item>
+ <title>Draft with AI actually returns drafts, and the X panel stops 500ing on a bad id</title>
+ <link>https://three.ws/changelog</link>
+ <guid isPermaLink="false">2026-08-14:Draft with AI actually returns drafts, and the X panel stops 500ing on a bad id</guid>
+ <pubDate>Fri, 14 Aug 2026 12:00:00 GMT</pubDate>
+ <category>fix</category>
+ <description>The Draft and Draft x3 buttons in the agent's X panel asked the server for tweet options and got back a differently shaped answer, so the panel cleared itself and showed nothing every time. Drafting now returns the options it was asked for: one per click of Draft x3, each written from its own angle, in the tone picked in the panel and in the voice of the agent it belongs to, with Thread mode splitting a completion into real thread parts. Drafting is also gated like every other write, so another site cannot spend a signed-in account's model budget. Elsewhere on the same panel, a malformed id or agent filter now comes back as a plain validation error instead of a server error, approving a queued post can no longer be published twice by a double click, and scheduling has a sane ceiling on how many posts and rules one account can queue.</description>
+ </item>
<item>
<title>Every agent now has a verifiable on-chain history you can read on its page</title>
<link>https://three.ws/docs/agent-index</link>
@@ -158,6 +166,14 @@
<category>fix</category>
<description>When the database had a short connectivity blip, the Oracle read endpoints answered with an empty result and a 200 OK, which reads as fact rather than as an outage. The live conviction feed showed a market with nothing in it, the hot-sectors panel showed no sectors, an agent's public track record showed &quot;never traded&quot; (the very evidence copy-traders judge a leader on), and the follow endpoint told a subscriber they were not following an agent they were in fact following. Worst of all, unfollowing an agent answered &quot;done&quot; while the subscription survived, so the alerts kept arriving with no way to stop them. Some of those answers were then cached for up to five minutes, outliving the blip that caused them. All of these now return a proper &quot;temporarily unavailable, retry shortly&quot; response that nothing caches, so a page can tell you it cannot reach the data instead of quietly showing you the wrong answer.</description>
</item>
+ <item>
+ <title>Paying to resolve a name that does not exist no longer costs anything</title>
+ <link>https://three.ws/docs/x402-endpoints</link>
+ <guid isPermaLink="false">2026-08-14:Paying to resolve a name that does not exist no longer costs anything</guid>
+ <pubDate>Fri, 14 Aug 2026 12:00:00 GMT</pubDate>
+ <category>fix</category>
+ <description>The paid name-resolution call on /api/x402/pay-by-name sells one thing: the on-chain address behind a @username, a .sol name, or a raw wallet. When the name resolved to nothing it still took the $0.001 toll and handed back an empty answer. It now returns a plain 404 and leaves the payment unspent, so a buyer only ever pays for an address they actually received. Two smaller corrections shipped alongside: the pump launch feed's headline fields (newest mint, name and symbol) kept describing the newest launch when the list is ranked by liquidity instead of by age, rather than whichever coin happened to sit at the top; and internal and subscription callers can once again reach the Permit2 gas-sponsoring demo on deployments that have no card-facilitator credentials, since those callers never sign a payment in the first place.</description>
+ </item>
<item>
<title>Platform counters stop reporting zero when the numbers are simply unavailable</title>
<link>https://three.ws/monitor</link>
@@ -254,6 +270,14 @@
<category>security</category>
<description>An agent that pays other agents on its own is governed by the policy you set on its wallet: a ceiling per payment, a rolling 24-hour ceiling, a separate ceiling per payee so one peer cannot quietly absorb the whole day's budget, and a kill switch that halts every kind of autonomous spending the moment you flip it. Those rules were enforced wherever the platform asked for them, but the enforcement itself had a soft spot: code that asked the guard to check a payment without first loading the agent's settings was handed an empty policy, meaning no ceilings and no kill switch, and nothing anywhere said so. The guard now reads the agent's real policy itself in that case, and refuses outright to price a payment for an agent that no longer exists. Every ceiling and the kill switch are now proven, not asserted: one command spins up a real database and a real server, then shows each limit turning away an over-limit payment, eight simultaneous payments competing for the last dollar of headroom with exactly one getting through, a frozen agent halted before the other agent is even contacted while your own withdrawals stay open, and every settled payment coming back as a receipt with the payee, the amount and the transaction signature on your agent's ledger.</description>
</item>
+ <item>
+ <title>The market data index now shows every paid endpoint, at the price you will actually be charged</title>
+ <link>https://three.ws/docs/market-data-api</link>
+ <guid isPermaLink="false">2026-08-14:The market data index now shows every paid endpoint, at the price you will actually be charged</guid>
+ <pubDate>Fri, 14 Aug 2026 12:00:00 GMT</pubDate>
+ <category>fix</category>
+ <description>The free front door to the paid market data API is where an agent looks before it buys anything. It only listed the seventeen endpoints in the core family, so the Market Heatmap and Market Mood endpoints were invisible to anyone discovering the bundle through it, and it quoted each endpoint's default price rather than the price the endpoint currently charges, so an operator price change left the index advertising a stale number. The index now builds itself from both sources, quotes the live price, and prints sub-cent prices in full instead of rounding them down to zero. Separately, a coin the upstream had not ranked yet could appear in the Market Heatmap board carrying rank 0; it now takes its position on the board instead.</description>
+ </item>
<item>
<title>The MCP tool catalog now lists three tools it was hiding, and stops calling the x402 Bazaar free</title>
<link>https://three.ws/mcp-tools</link>
@@ -270,6 +294,14 @@
<category>fix</category>
<description>The trading floor at /activity reconnects to its live feed by telling the server the timestamp it last saw. If that timestamp arrived malformed, the server opened the stream anyway and then silently failed every lookup behind it: the page stayed connected, showed no error, and never received another action for as long as it was open. It now rejects the bad timestamp up front with a clear message so the page reconnects cleanly instead of sitting on a dead feed. Three neighbouring Oracle endpoints got the same treatment: a malformed paging cursor on the activity feed, and a non-text agent or chat id sent to the follow endpoint, used to come back as an unexplained server error and now come back as a plain description of what was wrong. An unreadable result limit on an agent's public track record no longer wipes out its recent-trade list. The activity feed and the calibration report also now allow cross-site reads, matching every other public Oracle endpoint.</description>
</item>
+ <item>
+ <title>The paid Market Data API stops blaming buyers for a data provider's rate limit</title>
+ <link>https://three.ws/docs/market-data-api</link>
+ <guid isPermaLink="false">2026-08-14:The paid Market Data API stops blaming buyers for a data provider's rate limit</guid>
+ <pubDate>Fri, 14 Aug 2026 12:00:00 GMT</pubDate>
+ <category>fix</category>
+ <description>When an upstream data provider throttled us, the paid market endpoints (sectors, exchanges, derivatives, chains, DeFi, DEX volumes, fees) passed that straight back as a 429 rate-limit error, which read as if the caller had exceeded a limit on three.ws. These endpoints have no per-IP rate limit, so that was never true, and the error text also repeated the provider's name and our internal request path. A provider outage or throttle now comes back as the documented, retryable 503 data_unavailable and nothing else, so an agent's retry logic backs off for the right reason. Separately, market-fees used to quietly serve the fees table when asked for a mistyped type, charging for a dataset the caller did not ask for; an unrecognized type is now rejected before payment settles, so the call is free and the mistake is visible.</description>
+ </item>
<item>
<title>The payment-outcome board no longer reports itself healthy while it is blind</title>
<link>https://three.ws/changelog</link>
@@ -294,6 +326,22 @@
<category>improvement</category>
<description>The capture screen showed a green &quot;Sharp&quot; badge on frames that were smeared past recognition. Measured against six real portrait photographs, the blur floor sat below every reading a real photo can produce, so the gate never fired once: a shot ruined by camera shake sailed through and you found out a minute later, after the build. The floor is now calibrated from those measurements and sits in the gap between blurred and sharp faces, so &quot;Hold steady. The image is blurry.&quot; appears while you can still act on it. A face half-blown by window glare also used to pass, because averaging bright and shadowed halves lands back in the acceptable range; the camera now measures how much of your face is washed out and tells you to turn away from the window. Two capture bugs went with it: on a phone, the helper widgets pinned to the bottom of the screen sat on top of the camera and swallowed taps meant for the shutter and Cancel, and the Retake and Use this buttons stayed on screen during live capture. The shot check after the shutter is faster too.</description>
</item>
+ <item>
+ <title>The stablecoin peg monitor stops calling an unpriced coin a depeg</title>
+ <link>https://three.ws/docs/x402-endpoints</link>
+ <guid isPermaLink="false">2026-08-14:The stablecoin peg monitor stops calling an unpriced coin a depeg</guid>
+ <pubDate>Fri, 14 Aug 2026 12:00:00 GMT</pubDate>
+ <category>fix</category>
+ <description>The paid peg monitor at /api/x402/stablecoin-health scores every USD-pegged stablecoin against $1. Its upstream feed leaves the price blank for a large minority of the coins it tracks, and the monitor was reading that blank as a price of zero, so 75 coins with no quote at all were reported as fully depegged and shipped in the depeg alert list. They now report a status of unknown with a null price, which cut the alert list from 120 entries to the 46 coins that are genuinely off peg. Two paid endpoints alongside it stopped selling a wrong answer during a database outage: the skill marketplace's most-purchased-skills mode was returning an empty list that read like nobody hired anything, and now fails cleanly before the payment settles, while the spend-session canary reports why its create-and-consume cycle failed instead of an unexplained false.</description>
+ </item>
+ <item>
+ <title>The vanity grinders stop keeping any copy of a key you bought, and receipt checks now work from a plain link</title>
+ <link>https://three.ws/docs/x402-dev-tools</link>
+ <guid isPermaLink="false">2026-08-14:The vanity grinders stop keeping any copy of a key you bought, and receipt checks now work from a plain link</guid>
+ <pubDate>Fri, 14 Aug 2026 12:00:00 GMT</pubDate>
+ <category>security</category>
+ <description>Two changes to the pay-per-call vanity endpoints and the free receipt verifier. First, security: when a paid call is retried, the server keeps a short-lived copy of the original response so you are never charged twice. On the provably-fair grinder that copy included the receipt's serverSeed, and the seed is enough to recompute the private key, so a retry cache that was only ever meant to hold public metadata was in fact holding key material. The stored copy is now stripped of the secret and the seed on both grinders, sealed deliveries included, and a retry returns the public metadata with a plain note that the key was delivered once. The key you receive in the live response is unchanged. Second, the free receipt verifier can now confirm a settlement transaction over a plain GET link: /api/x402/verify-receipt?hash=&lt;tx&gt;&amp;network=solana, which works from a browser, a curl one-liner, or an uptime probe with no request body. Checking an attestation still uses POST because it needs the whole signed object.</description>
+ </item>
<item>
<title>We can now tell whether people come back to the agent they minted</title>
<link>https://three.ws/docs/analytics-retention</link>
diff --git a/public/features.json b/public/features.json
index ff827606c..8d99e26ed 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-08-14T05:11:16.156Z",
+ "generated_at": "2026-08-14T05:33:54.204Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",
diff --git a/tests/_fixtures/three-mint-token2022.base64 b/tests/_fixtures/three-mint-token2022.base64
new file mode 100644
index 000000000..ef7ae044e
--- /dev/null
+++ b/tests/_fixtures/three-mint-token2022.base64
@@ -0,0 +1 @@
+AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAUIaigDGNAwAGAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAARIAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAANmVY1rrT6TOBsHGhgrWf58Jwp3c966+FFfgpUEBdj8fEwCtAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA2ZVjWutPpM4GwcaGCtZ/nwnCndz3rr4UV+ClQQF2Px8IAAAAdGhyZWUud3MFAAAAdGhyZWVQAAAAaHR0cHM6Ly9pcGZzLmlvL2lwZnMvYmFma3JlaWZ0b3JnczVrbm9xcjN6NTN1bmpwZG1neWhwNGFiam5xamthc3QzaXEzdGZvZmV0bTJvb20AAAAA
diff --git a/tests/cron-recompute-reputation-db-outage.test.js b/tests/cron-recompute-reputation-db-outage.test.js
new file mode 100644
index 000000000..9071896a4
--- /dev/null
+++ b/tests/cron-recompute-reputation-db-outage.test.js
@@ -0,0 +1,139 @@
+/**
+ * recompute-reputation must not report a database outage as a healthy tick.
+ *
+ * listStaleAgents() used to catch every error and return an empty batch, so for
+ * as long as the database was down the cron answered
+ * `{ ok: true, scored: 0, reason: 'no agents to score' }` and wrapCron wrote a
+ * healthy heartbeat. That is indistinguishable from a fully-fresh population,
+ * which is exactly the state the durable score store is supposed to prove: the
+ * one signal that reputation had stopped refreshing was invisible to monitoring.
+ *
+ * Contracts under test:
+ * 1. store — listStaleAgents re-throws a db-unavailable error.
+ * 2. store — any other query failure still degrades to an empty batch.
+ * 3. cron — a db-unavailable error reaches wrapCron and answers with the
+ * platform-standard { ok:false, reason:'db_unavailable' }.
+ * 4. cron — a genuinely empty population still answers ok:true, scored:0.
+ * 5. cron — a non-DB failure stays contained as { ok:false, error }.
+ */
+
+import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
+
+class DbDown extends Error {
+ constructor() {
+ super('Missing required env var: DATABASE_URL');
+ this.name = 'DbDown';
+ }
+}
+
+// One db.js mock serves every importer in the graph: http.js (wrapCron's
+// classifiers + storage probe), the cron handler, and the reputation store.
+vi.mock('../api/_lib/db.js', () => ({
+ sql: Object.assign(
+ vi.fn(async () => {
+ throw new DbDown();
+ }),
+ { transaction: vi.fn(async () => { throw new DbDown(); }) },
+ ),
+ isDbUnavailableError: (err) => err instanceof DbDown,
+ isDbCapacityError: () => false,
+ isStoragePressured: async () => ({ pressured: false, sizeMb: 1, highWaterMb: 470 }),
+}));
+
+vi.mock('../api/_lib/cron-auth.js', () => ({
+ requireCron: () => true,
+ isCronAuthorized: () => true,
+}));
+
+import { sql } from '../api/_lib/db.js';
+import { listStaleAgents } from '../api/_lib/trust/reputation-store.js';
+
+// Minimal ServerResponse stand-in, mirroring tests/cron-storage-backoff.test.js.
+function fakeRes() {
+ const headers = {};
+ return {
+ statusCode: 0,
+ body: undefined,
+ headersSent: false,
+ writableEnded: false,
+ setHeader(k, v) { headers[String(k).toLowerCase()] = v; },
+ getHeader(k) { return headers[String(k).toLowerCase()]; },
+ end(b) { this.body = b; this.writableEnded = true; },
+ };
+}
+
+const req = () => ({ method: 'GET', url: '/api/cron/recompute-reputation', headers: {} });
+
+let warnSpy;
+let errorSpy;
+beforeEach(() => {
+ warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
+ errorSpy = vi.spyOn(console, 'error').mockImplementation(() => {});
+ sql.mockReset();
+});
+afterEach(() => {
+ warnSpy.mockRestore();
+ errorSpy.mockRestore();
+});
+
+describe('listStaleAgents error contract', () => {
+ it('re-throws a db-unavailable error instead of reporting an empty batch', async () => {
+ sql.mockImplementation(async () => { throw new DbDown(); });
+ await expect(listStaleAgents(40)).rejects.toBeInstanceOf(DbDown);
+ });
+
+ it('still degrades to an empty batch on a non-outage query failure', async () => {
+ // ensureTable's create-table statements succeed; only the select fails, the
+ // way a mid-migration missing column would.
+ let call = 0;
+ sql.mockImplementation(async () => {
+ call += 1;
+ if (call <= 3) return [];
+ throw new Error('column "solana_address" does not exist');
+ });
+ await expect(listStaleAgents(40)).resolves.toEqual([]);
+ });
+});
+
+describe('/api/cron/recompute-reputation under a database outage', () => {
+ it('answers db_unavailable rather than a healthy zero-work tick', async () => {
+ sql.mockImplementation(async () => { throw new DbDown(); });
+ const handler = (await import('../api/cron/recompute-reputation.js')).default;
+ const res = fakeRes();
+
+ await handler(req(), res);
+
+ expect(res.statusCode).toBe(200); // scheduler must not see a hard failure
+ const body = JSON.parse(res.body);
+ expect(body).toMatchObject({ ok: false, reason: 'db_unavailable' });
+ expect(body.ok).not.toBe(true);
+ });
+
+ it('still reports a genuinely empty population as a healthy tick', async () => {
+ sql.mockImplementation(async () => []);
+ const handler = (await import('../api/cron/recompute-reputation.js')).default;
+ const res = fakeRes();
+
+ await handler(req(), res);
+
+ expect(JSON.parse(res.body)).toMatchObject({ ok: true, scored: 0, reason: 'no agents to score' });
+ });
+
+ it('contains a non-outage query failure instead of 500-ing the tick', async () => {
+ let call = 0;
+ sql.mockImplementation(async () => {
+ call += 1;
+ if (call <= 3) return [];
+ throw Object.assign(new Error('relation "agent_identities" does not exist'), { code: '42P01' });
+ });
+ const handler = (await import('../api/cron/recompute-reputation.js')).default;
+ const res = fakeRes();
+
+ await handler(req(), res);
+
+ // listStaleAgents swallows this one, so the tick reads as "no work" rather
+ // than an outage. The distinction that matters is that it never 500s.
+ expect(res.statusCode).toBe(200);
+ expect(JSON.parse(res.body).ok).toBe(true);
+ });
+});
diff --git a/tests/cron-settlement-verify-reporting.test.js b/tests/cron-settlement-verify-reporting.test.js
new file mode 100644
index 000000000..235df1de0
--- /dev/null
+++ b/tests/cron-settlement-verify-reporting.test.js
@@ -0,0 +1,131 @@
+// A broken settlement lane must be loud (api/cron/settlement-verify.js).
+//
+// This sweep is the only thing that resolves quarantined money rows: a stage tip
+// or IRL pay whose on-chain settlement our RPC had not yet seen sits with
+// verified_at null, counting for nothing, until a tick promotes or discards it.
+// Both lanes are caught so one failure cannot strand the other, and that catch
+// used to end the story: the error went into the 200 body, wrapCron saw a clean
+// return, the heartbeat stayed ok, and nothing anywhere read the body. A schema
+// change or an RPC outage could stop every promotion indefinitely while each
+// tick answered 200.
+//
+// The properties worth pinning, all three negative or near-negative:
+// 1. a lane error flips ok:false and pages ops (not a silent 200)
+// 2. a table that does not exist yet reports skipped and does NOT page, so a
+// deployment that has never hosted a show is not a false alarm
+// 3. one broken lane still lets the other lane run to completion
+import { test, expect, vi, beforeEach } from 'vitest';
+
+const sendOpsAlert = vi.fn(async () => {});
+
+// The table-presence probe and the per-lane queries all come through this one
+// tagged template, so a test steers a lane by what it returns for that lane's
+// query text.
+let sqlHandler = () => [];
+vi.mock('../api/_lib/db.js', () => ({
+ sql: (strings, ...values) => Promise.resolve(sqlHandler(strings.join('?'), values)),
+}));
+vi.mock('../api/_lib/alerts.js', () => ({
+ sendOpsAlert: (...args) => sendOpsAlert(...args),
+}));
+vi.mock('../api/_lib/cron-auth.js', () => ({ requireCron: () => true }));
+vi.mock('../api/_lib/settlement-verify.js', () => ({
+ verifySettlement: async () => ({ status: 'pending', reason: 'not seen' }),
+}));
+vi.mock('../api/stage/tip.js', () => ({ promoteTip: async () => true }));
+vi.mock('../api/_lib/stage-wallets.js', () => ({ hostPayoutWallets: async () => [] }));
+vi.mock('../api/_lib/agent-payout-wallets.js', () => ({ agentPayoutWallets: async () => [] }));
+
+const handler = (await import('../api/cron/settlement-verify.js')).default;
+
+function makeRes() {
+ return {
+ statusCode: 0,
+ body: null,
+ headersSent: false,
+ writableEnded: false,
+ setHeader() {},
+ getHeader() {},
+ status(code) { this.statusCode = code; return this; },
+ end(payload) {
+ this.writableEnded = true;
+ if (payload && this.body === null) {
+ try { this.body = JSON.parse(payload); } catch { this.body = payload; }
+ }
+ return this;
+ },
+ json(payload) { this.body = payload; return this; },
+ };
+}
+
+async function run() {
+ const res = makeRes();
+ await handler({ method: 'GET', url: '/api/cron/settlement-verify', headers: {} }, res);
+ return res;
+}
+
+// Both lazily-created relations resolve, so neither lane is skipped.
+const BOTH_PRESENT = { show_tips: 'show_tips', stages: 'stages', irl_interactions: 'irl_interactions' };
+
+beforeEach(() => {
+ sendOpsAlert.mockClear();
+});
+
+test('a failing lane reports ok:false and pages ops instead of a silent 200', async () => {
+ sqlHandler = (text) => {
+ if (text.includes('to_regclass')) return [BOTH_PRESENT];
+ if (text.includes('FROM show_tips')) throw new Error('column t.network does not exist');
+ return [];
+ };
+
+ const res = await run();
+
+ expect(res.body.ok).toBe(false);
+ expect(res.body.tips.error).toContain('t.network');
+ expect(sendOpsAlert).toHaveBeenCalledTimes(1);
+ const [title, detail, opts] = sendOpsAlert.mock.calls[0];
+ expect(title).toMatch(/settlement sweep lane failing/i);
+ expect(detail).toContain('tips');
+ // Deduped per lane per hour, so a persistent fault pages once and not every
+ // tick (this cron runs every 5 minutes).
+ expect(opts.signature).toMatch(/^settlement-verify:tips:\d+$/);
+});
+
+test('the healthy lane still completes when the other lane is broken', async () => {
+ sqlHandler = (text) => {
+ if (text.includes('to_regclass')) return [BOTH_PRESENT];
+ if (text.includes('FROM show_tips')) throw new Error('lane down');
+ return []; // the IRL lane finds nothing to sweep, cleanly
+ };
+
+ const res = await run();
+
+ expect(res.body.tips.error).toBeTruthy();
+ expect(res.body.pays).toEqual({ scanned: 0, promoted: 0, discarded: 0, pending: 0 });
+});
+
+test('a table that does not exist yet is skipped, not paged', async () => {
+ // A deployment that has never hosted a show or taken an IRL pay: both tables
+ // are created lazily by their write endpoints, so absence is normal.
+ sqlHandler = (text) => {
+ if (text.includes('to_regclass')) return [{ show_tips: null, stages: null, irl_interactions: null }];
+ throw new Error('no lane query should run when its table is absent');
+ };
+
+ const res = await run();
+
+ expect(res.body.ok).toBe(true);
+ expect(res.body.tips).toEqual({ skipped: 'table_absent' });
+ expect(res.body.pays).toEqual({ skipped: 'table_absent' });
+ expect(sendOpsAlert).not.toHaveBeenCalled();
+});
+
+test('a clean sweep reports ok:true and pages nobody', async () => {
+ sqlHandler = (text) => (text.includes('to_regclass') ? [BOTH_PRESENT] : []);
+
+ const res = await run();
+
+ expect(res.body.ok).toBe(true);
+ expect(res.body.tips).toEqual({ scanned: 0, promoted: 0, discarded: 0, pending: 0 });
+ expect(sendOpsAlert).not.toHaveBeenCalled();
+});
diff --git a/tests/news-archive-append.test.js b/tests/news-archive-append.test.js
index 5d7c820cc..d1714d656 100644
--- a/tests/news-archive-append.test.js
+++ b/tests/news-archive-append.test.js
@@ -222,6 +222,25 @@ describe('an overlapping run losing the GCS generation guard', () => {
expect(JSON.parse(statsWrite.body).sources.coindesk).toBe(2108);
});
+ it('degrades to a skipped run when GCP credentials are unavailable', async () => {
+ const { getGcpAccessToken } = await import('../api/_lib/gcp-auth.js');
+ getGcpAccessToken.mockRejectedValueOnce(
+ Object.assign(new Error('No GCP credentials found.'), { code: 'unconfigured' }),
+ );
+ const res = await call('/api/cron/news-archive-append');
+ expect(res._json.status).toBe(200);
+ expect(res._json.body.ok).toBe(false);
+ expect(res._json.body.reason).toBe('gcp_unconfigured');
+ expect(res._json.body.appended).toBe(0);
+ expect(writes).toHaveLength(0);
+ });
+
+ it('a credential failure that is not `unconfigured` still fails the run', async () => {
+ const { getGcpAccessToken } = await import('../api/_lib/gcp-auth.js');
+ getGcpAccessToken.mockRejectedValueOnce(new Error('token exchange returned 500'));
+ await expect(call('/api/cron/news-archive-append')).rejects.toThrow(/token exchange/);
+ });
+
it('a real GCS write failure still fails the run', async () => {
const base = global.fetch;
global.fetch = vi.fn(async (url, opts = {}) => {