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: close out remaining issues from the 2026-07-04 production log export

fudjiaeb441b1d4630
diff --git a/.env.example b/.env.example
index 5862ac9d9..b9d155ccc 100644
--- a/.env.example
+++ b/.env.example
@@ -35,6 +35,14 @@ UPSTASH_REDIS_REST_TOKEN=
UPSTASH_CACHE_REST_URL=
UPSTASH_CACHE_REST_TOKEN=
+# Optional cache tuning (api/_lib/cache.js). CMD timeout: per-command deadline in ms
+# before falling back to memory (default 3000, clamped 500–30000) — raise it when the
+# cache store is not co-located with the function region. Max value bytes: values whose
+# serialized JSON exceeds this stay memory-only instead of timing out over REST and
+# flapping the write-suppression gate (default 262144 = 256KB, clamped 16KB–8MB).
+CACHE_REDIS_CMD_TIMEOUT_MS=
+CACHE_REDIS_MAX_VALUE_BYTES=
+
# Optional: Error monitoring
SENTRY_DSN=
diff --git a/ISSUES.md b/ISSUES.md
index d6963470b..c3a845408 100644
--- a/ISSUES.md
+++ b/ISSUES.md
@@ -14,8 +14,42 @@ contain work that is still open.
## Open
-_No open production issues._
+The 2026-07-04 production log export (10h window, ~14.7k lines) surfaced a batch
+of issues. Every code-side defect was fixed in the same day's commit (retention
+coverage, cache flapping, embed WASM OOM, auth 500s, agora uuid 500, custody
+504, holders 429 storm, forge-smoke crash). What remains below requires
+**operator action in deployment environments** — it cannot be fixed from this
+repo:
-The `character-studio/` lint debt (the last open item) was cleared 2026-06-21 —
-`eslint character-studio/src` now reports **0 problems**. Details in the
-[2026-06 archive](docs/internal/ISSUES-ARCHIVE-2026-06.md).
+1. **`JWT_SECRET` unset in production** — every `GET /api/auth/siwe/nonce` and
+ `/api/auth/siws/nonce` failed (122 hits in the window); wallet sign-in is
+ down until it's set. Now surfaces as `503 not_configured` with a deduped ops
+ alert instead of anonymous 500s. Action: set `JWT_SECRET` in the Vercel env
+ (`openssl rand -base64 64`) and redeploy.
+2. **`WALLET_ENCRYPTION_KEY` unset** — custodial agent wallet provisioning is
+ deferred at create time (the secret-box refuses the JWT_SECRET fallback in
+ production, by design). Action: set it (`openssl rand -base64 48`).
+3. **world.three.ws serving UNPROTECTED** — the live Cloud Run revision lost
+ `ADMIN_CODE`; every visitor has build rights (41 warnings across the
+ window). Action: re-run `deploy/world/apply-hardening.sh`.
+4. **`OPENAI_API_KEY` invalid + OpenRouter out of credits** — the brain chain's
+ primary fails ("Incorrect API key provided") and the openrouter mirror
+ rejects with insufficient credits; traffic survives on the free fallback
+ chain (Groq/NIM). Action: rotate the OpenAI key, top up OpenRouter credits.
+5. **Reconstruct lane has no paid fallback** — `/api/avatars/reconstruct`
+ returned 502 whenever the HuggingFace Spaces chain failed because neither
+ `REPLICATE_API_TOKEN` nor `GCP_RECONSTRUCTION_URL` is configured; consider
+ also widening `HF_RECONSTRUCT_SPACES` to include `stabilityai/TripoSR`.
+6. **Neon branch pinned over the storage cap** — 582MB ≥ 470MB for the full
+ window. Retention now prunes four previously-uncovered table families and
+ sweeps orphaned satellites, and its pressure alert names the largest tables.
+ If size stays above the mark after a few cycles, bump the Neon plan or
+ `DB_RETENTION_HIGH_WATER_MB`.
+7. **Helius quota exhaustion** — balances + DAS walks hit "max usage reached"
+ (32 warnings). Cadence pressure was cut code-side (holders snapshot now has
+ one scheduler + a 10-min 429 cooldown); if throttling persists, bump the
+ Helius plan.
+
+The `character-studio/` lint debt (the last open item of the prior batch) was
+cleared 2026-06-21 — `eslint character-studio/src` now reports **0 problems**.
+Details in the [2026-06 archive](docs/internal/ISSUES-ARCHIVE-2026-06.md).
diff --git a/api/_lib/cache.js b/api/_lib/cache.js
index 3fc313662..908a20022 100644
--- a/api/_lib/cache.js
+++ b/api/_lib/cache.js
@@ -119,9 +119,16 @@ function redisCmdTimeoutMs() {
// 3s-stall-plus-warning on every single request.
const CIRCUIT_FAIL_THRESHOLD = 5;
const CIRCUIT_COOLDOWN_MS = 60_000;
+// A chronically degraded store re-arms the fixed cooldown forever — one trial +
+// one open/close log pair per minute, hundreds per day (the July 2026 export:
+// 381 circuit opens in 10h). Escalate the cooldown ×2 per consecutive re-arm up
+// to a ceiling, so a store that stays down settles at one probe per 10 minutes
+// while a genuinely transient blip still recovers within the 60s base window.
+const COOLDOWN_MAX_MS = 600_000;
let circuitFailures = 0;
let circuitOpenUntil = 0; // epoch ms; 0 = closed
let circuitTrialInFlight = false;
+let circuitRearms = 0; // consecutive re-opens without an intervening success
// SET-path write suppression. The shared circuit breaker above keys off
// CONSECUTIVE command failures across all ops, but the production failure mode is
@@ -140,6 +147,7 @@ const SET_FAIL_THRESHOLD = 5;
const SET_SUPPRESS_MS = 60_000;
let setFailures = 0;
let setSuppressedUntil = 0; // epoch ms; 0 = writing normally
+let setRearms = 0; // consecutive suppression re-arms without a successful SET
// Cumulative counters since this instance came up. Gauges (circuitOpen,
// setSuppressed) say "is it degraded right now"; these totals give the health
@@ -173,13 +181,19 @@ function circuitRecordSuccess() {
circuitFailures = 0;
circuitOpenUntil = 0;
circuitTrialInFlight = false;
+ circuitRearms = 0;
+}
+
+function escalatedCooldownMs(baseMs, rearms) {
+ return Math.min(COOLDOWN_MAX_MS, baseMs * 2 ** Math.min(10, rearms));
}
function circuitRecordFailure() {
circuitTrialInFlight = false;
if (circuitOpenUntil !== 0) {
- // A half-open trial failed — Redis still down, re-arm the cooldown.
- circuitOpenUntil = Date.now() + CIRCUIT_COOLDOWN_MS;
+ // A half-open trial failed — Redis still down, re-arm an escalated cooldown.
+ circuitRearms++;
+ circuitOpenUntil = Date.now() + escalatedCooldownMs(CIRCUIT_COOLDOWN_MS, circuitRearms);
return;
}
circuitFailures++;
@@ -299,18 +313,35 @@ export async function cacheSet(key, value, ttlSeconds = 60) {
}
try {
const payload = JSON.stringify(value);
+ // An oversized value over Upstash REST is a guaranteed timeout from a
+ // non-co-located region: it can never finish inside the command deadline,
+ // so it would burn the failure streak and flap the suppression gate all
+ // day without ever landing. Keep it memory-only and leave the streak to
+ // reflect the store's real health.
+ if (payload.length > env.CACHE_REDIS_MAX_VALUE_BYTES) {
+ // Memo the value too: with Redis healthy a GET is a clean miss (null),
+ // not an error, so it would never consult the memory fallback — the memo
+ // is what keeps near-term reads coherent with this write.
+ memoPut(key, value);
+ warnThrottled('set-size', `[cache] value for "${key}" exceeds ${env.CACHE_REDIS_MAX_VALUE_BYTES} bytes — memory-only (raise CACHE_REDIS_MAX_VALUE_BYTES to override)`);
+ return memSet(key, value, ttlSeconds);
+ }
await redisCmd(['SET', key, payload, 'EX', String(ttlSeconds)]);
if (setSuppressedUntil !== 0) warnThrottled('set-gate', '[cache] redis SET recovered — resuming cache writes');
setFailures = 0;
setSuppressedUntil = 0;
+ setRearms = 0;
memoPut(key, value); // keep the memo coherent with what we just wrote
} catch (err) {
readMemo.delete(key);
memSet(key, value, ttlSeconds);
if (err?.circuitOpen) return; // shared breaker already logged the open transition
if (setSuppressedUntil !== 0) {
- // A post-window trial failed — Redis writes still down, re-arm quietly.
- setSuppressedUntil = now + SET_SUPPRESS_MS;
+ // A post-window trial failed — writes still down. Re-arm quietly with an
+ // escalated window so a chronically degraded store settles at one trial
+ // per 10 minutes instead of flapping every 60s.
+ setRearms++;
+ setSuppressedUntil = now + escalatedCooldownMs(SET_SUPPRESS_MS, setRearms);
return;
}
setFailures++;
diff --git a/api/_lib/custody-proof.js b/api/_lib/custody-proof.js
index 184f5e94d..920dfabc4 100644
--- a/api/_lib/custody-proof.js
+++ b/api/_lib/custody-proof.js
@@ -34,6 +34,18 @@ const MEMO_PROGRAM_ID = new PublicKey('MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfc
const ANCHOR_KIND = 'threews.custody.v1';
const TX_TIMEOUT_MS = 20_000;
+// Wall-clock budget for the snapshot phase (balance + ledger-head reads). When
+// public RPC is rate-limited, the rotating fetch can sweep the whole endpoint
+// chain per read — sequential and unbounded, N wallets × sweep once blew clean
+// past the function's maxDuration and 504'd the cron (July 2026). Wallets not
+// read before the deadline are skipped this epoch exactly like an RPC failure:
+// never attested with a guessed balance, picked up again next epoch. Budget +
+// TX_TIMEOUT_MS + persistence must stay under the route's maxDuration (120s).
+const SNAPSHOT_BUDGET_MS = 80_000;
+// Read balances in small concurrent batches: enough to cut wall-clock ~5×,
+// small enough not to worsen the very 429s the rotating fetch is dodging.
+const BALANCE_READ_CONCURRENCY = 5;
+
// The balances are read on the network the custodial wallets actually operate on
// (mainnet). The root commitment is a hash with no value, so it is anchored on
// the cheaper devnet by default — still a real, independently-fetchable on-chain
@@ -124,32 +136,48 @@ export async function runAttestationEpoch({ anchor = true } = {}) {
const epochNum = Number(epoch);
// Build leaves in a stable order (wallets are already ordered by agent id).
+ // Reads run in small concurrent batches under a wall-clock budget; results
+ // are assembled in the original wallet order so the tree stays deterministic.
+ const deadline = startedAt + SNAPSHOT_BUDGET_MS;
const leaves = [];
let totalLamports = 0n;
let rpcFailures = 0;
- for (const w of wallets) {
- const lamports = await readLamports(conn, w.address);
- // An RPC failure must not silently attest a wrong (zero) balance. Skip the
- // wallet this epoch rather than committing an unverifiable leaf; it is
- // included again next epoch once RPC recovers.
- if (lamports == null) { rpcFailures++; continue; }
- const balanceLamports = String(lamports);
- const ledgerHead = await ledgerHeadFor(w.agentId, SNAPSHOT_NETWORK);
- const leafHash = await computeLeafHash({
- agentId: w.agentId,
- address: w.address,
- balanceLamports,
- ledgerHead,
- epoch: epochNum,
- });
- leaves.push({
- agentId: w.agentId,
- address: w.address,
- balanceLamports,
- ledgerHead,
- leafHash,
- });
- totalLamports += BigInt(lamports);
+ for (let i = 0; i < wallets.length; i += BALANCE_READ_CONCURRENCY) {
+ if (Date.now() >= deadline) {
+ // Out of snapshot time — skip the remaining wallets this epoch (same
+ // contract as an RPC failure: never attest a balance we didn't read).
+ rpcFailures += wallets.length - i;
+ break;
+ }
+ const batch = wallets.slice(i, i + BALANCE_READ_CONCURRENCY);
+ const results = await Promise.all(batch.map(async (w) => {
+ const lamports = await readLamports(conn, w.address);
+ // An RPC failure must not silently attest a wrong (zero) balance. Skip
+ // the wallet this epoch rather than committing an unverifiable leaf; it
+ // is included again next epoch once RPC recovers.
+ if (lamports == null) return null;
+ const balanceLamports = String(lamports);
+ const ledgerHead = await ledgerHeadFor(w.agentId, SNAPSHOT_NETWORK);
+ const leafHash = await computeLeafHash({
+ agentId: w.agentId,
+ address: w.address,
+ balanceLamports,
+ ledgerHead,
+ epoch: epochNum,
+ });
+ return {
+ agentId: w.agentId,
+ address: w.address,
+ balanceLamports,
+ ledgerHead,
+ leafHash,
+ };
+ }));
+ for (const leaf of results) {
+ if (leaf == null) { rpcFailures++; continue; }
+ leaves.push(leaf);
+ totalLamports += BigInt(leaf.balanceLamports);
+ }
}
const tree = await buildMerkleTree(leaves.map((l) => l.leafHash));
diff --git a/api/_lib/env.js b/api/_lib/env.js
index 42df65a31..f547c4ddb 100644
--- a/api/_lib/env.js
+++ b/api/_lib/env.js
@@ -325,6 +325,22 @@ export const env = {
return Math.min(30_000, Math.max(500, Math.round(n)));
},
+ // Largest value (serialized bytes) the cache will send to Upstash REST
+ // (api/_lib/cache.js). A multi-hundred-KB JSON body over REST is the classic
+ // guaranteed-timeout write: it can't complete inside CACHE_REDIS_CMD_TIMEOUT_MS
+ // from a non-co-located region, so it burns the SET failure streak and flaps
+ // the write-suppression gate all day (the July 2026 log export: ~1.9k SET
+ // timeouts in 10h). Values over the cap go to the in-memory fallback only.
+ // Clamped to [16KB, 8MB]; default 256KB — comfortably under Upstash's request
+ // limits and large enough for every legitimate cached payload observed.
+ get CACHE_REDIS_MAX_VALUE_BYTES() {
+ const raw = opt('CACHE_REDIS_MAX_VALUE_BYTES');
+ if (raw == null || String(raw).trim() === '') return 262_144;
+ const n = Number(raw);
+ if (!Number.isFinite(n)) return 262_144;
+ return Math.min(8_388_608, Math.max(16_384, Math.round(n)));
+ },
+
// ── Upstash quota-burn visibility (api/_lib/redis-usage.js) ──────────────
// The free plan ceils at 500k commands/month; when it is exhausted every
// critical limiter fails closed and all paid forge + x402 flows 503 (the
diff --git a/api/_providers/huggingface.js b/api/_providers/huggingface.js
index 4015264ca..a6aedd901 100644
--- a/api/_providers/huggingface.js
+++ b/api/_providers/huggingface.js
@@ -214,7 +214,14 @@ async function consumeSseUntilComplete(response) {
return;
}
if (pendingEvent === 'error') {
- errorMessage = dataStr || 'inference reported error';
+ // Gradio emits `data: null` on its error event when the Space dies
+ // without a message — free-tier GPU quota exhausted or the Space
+ // sleeping/rebuilding. Passing that through produced the useless
+ // "inference failed: null" in production logs; name the likely
+ // cause instead so the failover log line is diagnosable.
+ errorMessage = dataStr && dataStr !== 'null' && dataStr !== '""'
+ ? dataStr
+ : 'Space error event with no detail (typically GPU quota exhausted or Space sleeping)';
return;
}
// heartbeat / generating / unknown: ignore
diff --git a/api/cron/three-holders-snapshot.js b/api/cron/three-holders-snapshot.js
index 8718147b1..27252f855 100644
--- a/api/cron/three-holders-snapshot.js
+++ b/api/cron/three-holders-snapshot.js
@@ -22,6 +22,15 @@ import { constantTimeEquals } from '../_lib/crypto.js';
import { refreshThreeHolderSnapshot } from '../_lib/coin/three-holders.js';
import { isRpcRateLimited } from '../_lib/coin/holders.js';
import { isDbUnavailableError } from '../_lib/db.js';
+import { cacheGet, cacheSet } from '../_lib/cache.js';
+
+// After a rate-limited scan, hold off further refresh attempts for this long.
+// The per-page retries inside fetchHolderBalances already burn ~90s against a
+// throttled Helius before giving up; retrying again on the very next tick just
+// extends the throttle window. The snapshot serves stale-but-good data in the
+// meantime, so a pause costs nothing but ends the 429 storm.
+const RATE_LIMIT_COOLDOWN_KEY = 'three-holders:rate-limit-cooldown';
+const RATE_LIMIT_COOLDOWN_S = 600;
// Vercel cron invokes with `Authorization: Bearer <CRON_SECRET>`; manual probes
// may use `X-Cron-Secret: <CRON_SECRET>`. Accept either, constant-time.
@@ -49,6 +58,11 @@ export default wrapCron(async (req, res) => {
return json(res, 200, { ok: false, reason: 'HELIUS_API_KEY unset', refreshed: false });
}
+ const cooling = await cacheGet(RATE_LIMIT_COOLDOWN_KEY);
+ if (cooling) {
+ return json(res, 200, { ok: true, refreshed: false, skipped: 'rate_limit_cooldown' });
+ }
+
const started = Date.now();
try {
const result = await refreshThreeHolderSnapshot();
@@ -79,6 +93,11 @@ export default wrapCron(async (req, res) => {
|| /terminated|fetch failed|ECONNRESET|ETIMEDOUT|EAI_AGAIN|socket hang up|429|rate.?limit|too many requests|network|password authentication failed|table unavailable/i.test(msg);
if (transient) console.warn('[three-holders-snapshot] refresh deferred (transient upstream):', msg);
else console.error('[three-holders-snapshot] refresh failed:', msg);
+ // A throttle means Helius needs breathing room, not an immediate retry —
+ // park the refresh for the cooldown window so successive ticks skip cheaply.
+ if (isRpcRateLimited(err) || /429|rate.?limit|too many requests/i.test(msg)) {
+ await cacheSet(RATE_LIMIT_COOLDOWN_KEY, { at: Date.now() }, RATE_LIMIT_COOLDOWN_S);
+ }
return json(res, 200, { ok: false, refreshed: false, error: msg });
}
});
diff --git a/public/changelog.json b/public/changelog.json
index bd27211e6..ed285e8cb 100644
--- a/public/changelog.json
+++ b/public/changelog.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-07-04T21:51:09.061Z",
+ "generated_at": "2026-07-04T22:01:41.514Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json + data/changelog.json",
"site": {
"name": "three.ws",
diff --git a/public/features.json b/public/features.json
index cd0d776f4..543c83e2c 100644
--- a/public/features.json
+++ b/public/features.json
@@ -1,5 +1,5 @@
{
- "generated_at": "2026-07-04T21:51:09.049Z",
+ "generated_at": "2026-07-04T22:01:41.502Z",
"generated_by": "scripts/build-page-index.mjs from data/pages.json",
"site": {
"name": "three.ws",
diff --git a/tests/agora-read-model.test.js b/tests/agora-read-model.test.js
index b50225e16..b22c5b6cf 100644
--- a/tests/agora-read-model.test.js
+++ b/tests/agora-read-model.test.js
@@ -232,14 +232,23 @@ describe('passport', () => {
});
it('404s an unknown citizen', async () => {
- const { status, body } = await call('passport', { query: { id: 'ghost' } });
+ const { status, body } = await call('passport', { query: { id: '00000000-0000-4000-8000-00000000dead' } });
+ expect(status).toBe(404);
+ expect(body.error).toBe('not_found');
+ });
+
+ it('404s a non-uuid id without touching the database (probe strings must not 500)', async () => {
+ const { status, body } = await call('passport', { query: { id: 'verification-probe-citizen' } });
expect(status).toBe(404);
expect(body.error).toBe('not_found');
});
it('returns the projection + activity for a found citizen (on-chain best-effort, null pda ⇒ no RPC)', async () => {
+ // agora_citizens.id is a uuid column — the fixture must use one, matching
+ // what production Postgres would accept (a bare 'c1' throws 22P02 there).
+ const cid = '11111111-1111-4111-8111-111111111111';
H.passportRow = {
- id: 'c1', kind: 'agent', display_name: 'Aria', profession: 'scribe', capability_bits: 4,
+ id: cid, kind: 'agent', display_name: 'Aria', profession: 'scribe', capability_bits: 4,
status: 'idle', agenc_agent_id: 'abc', agenc_agent_pda: null, agenc_cluster: 'devnet',
pos_x: 0, pos_z: 0, home_x: 0, home_z: 0, reputation: 3,
stake_lamports: 0, earned_three_atomic: 0, tasks_completed: 0, tasks_posted: 0,
@@ -250,7 +259,7 @@ describe('passport', () => {
tx_signature: 'sig', proof_hash: null, deliverable_url: null, rep_before: null, rep_after: 3,
created_at: '2026-07-02T00:00:00Z',
}];
- const { status, body } = await call('passport', { query: { id: 'c1' } });
+ const { status, body } = await call('passport', { query: { id: cid } });
expect(status).toBe(200);
expect(body.ok).toBe(true);
expect(body.citizen.displayName).toBe('Aria');
diff --git a/tests/cache-circuit-breaker.test.js b/tests/cache-circuit-breaker.test.js
index 2ed7685f3..512fedd5f 100644
--- a/tests/cache-circuit-breaker.test.js
+++ b/tests/cache-circuit-breaker.test.js
@@ -103,4 +103,67 @@ describe('cache circuit breaker', () => {
await cacheGet('setgate:after-get');
expect(fetchMock.mock.calls.length).toBeGreaterThan(callsBefore); // GET still went out
});
+
+ it('keeps oversized values memory-only without burning the SET failure streak', async () => {
+ // A multi-hundred-KB JSON body over Upstash REST is a guaranteed timeout
+ // from a non-co-located region — sending it would poison the failure streak
+ // and flap the suppression gate (the July 2026 log export). The size guard
+ // must route it to memory without any network call or streak side effects.
+ vi.resetModules();
+ const { cacheGet, cacheSet } = await import('../api/_lib/cache.js');
+ const fetchMock = vi.fn(async () => ({ ok: true, json: async () => ({ result: 'OK' }) }));
+ globalThis.fetch = fetchMock;
+ const warn = vi.spyOn(console, 'warn').mockImplementation(() => {});
+
+ const oversized = { blob: 'x'.repeat(300_000) }; // > 256KB default cap
+ await cacheSet('size:big', oversized, 30);
+ expect(fetchMock).not.toHaveBeenCalled(); // never sent to the network
+ // Near-term reads stay coherent via the read memo — no network round-trip.
+ expect(await cacheGet('size:big')).toEqual(oversized);
+ expect(fetchMock).not.toHaveBeenCalled();
+ const sizeWarnings = warn.mock.calls.filter((c) => String(c[0]).includes('memory-only'));
+ expect(sizeWarnings).toHaveLength(1);
+
+ // A normal-sized value still goes to Redis — the guard is per-value.
+ await cacheSet('size:small', { v: 1 }, 30);
+ expect(fetchMock).toHaveBeenCalledTimes(1);
+ });
+
+ it('escalates the suppression window on consecutive failed trial SETs', async () => {
+ // A chronically dead SET path must settle into long cooldowns (one trial
+ // per ~10 minutes), not re-arm the 60s window forever — the flapping that
+ // produced hundreds of degraded/recovered pairs per day in production.
+ vi.resetModules();
+ vi.useFakeTimers();
+ try {
+ const { cacheSet } = await import('../api/_lib/cache.js');
+ const fetchMock = vi.fn(async () => { throw new Error('The operation was aborted due to timeout'); });
+ globalThis.fetch = fetchMock;
+ vi.spyOn(console, 'warn').mockImplementation(() => {});
+
+ // Trip the SET suppression gate (threshold 5).
+ for (let i = 0; i < 5; i++) await cacheSet(`esc:${i}`, { v: i }, 30);
+ const callsAtTrip = fetchMock.mock.calls.length;
+ expect(callsAtTrip).toBe(5);
+
+ // First window (60s): a trial goes out after it elapses and fails →
+ // the gate re-arms with an ESCALATED window (120s).
+ await vi.advanceTimersByTimeAsync(61_000);
+ await cacheSet('esc:trial-1', { v: 1 }, 30);
+ expect(fetchMock.mock.calls.length).toBe(callsAtTrip + 1);
+
+ // 61s later we are inside the escalated 120s window — no trial admitted.
+ await vi.advanceTimersByTimeAsync(61_000);
+ await cacheSet('esc:still-suppressed', { v: 1 }, 30);
+ expect(fetchMock.mock.calls.length).toBe(callsAtTrip + 1);
+
+ // Another 61s (122s total since re-arm) — the escalated window elapsed,
+ // the next trial is admitted.
+ await vi.advanceTimersByTimeAsync(61_000);
+ await cacheSet('esc:trial-2', { v: 1 }, 30);
+ expect(fetchMock.mock.calls.length).toBe(callsAtTrip + 2);
+ } finally {
+ vi.useRealTimers();
+ }
+ });
});
diff --git a/vercel.json b/vercel.json
index 615bd01e8..042d236bb 100644
--- a/vercel.json
+++ b/vercel.json
@@ -6,7 +6,7 @@
"NODE_OPTIONS": "--no-deprecation"
},
"functions": {
- "api/cron/{economy-tick,copy-fanout,mirror-fanout,signal-fanout,three-holders-snapshot,x402-autonomous-loop,pulse-tick,coin-intel-observe,launcher-tick,reflect-sweep,solana-autodeploy,db-retention}.js": {
+ "api/cron/{economy-tick,copy-fanout,mirror-fanout,signal-fanout,three-holders-snapshot,x402-autonomous-loop,pulse-tick,coin-intel-observe,launcher-tick,reflect-sweep,solana-autodeploy,db-retention,custody-attest}.js": {
"maxDuration": 120
},
"api/cron/{strategy-fanout,gmgn-seed}.js": {