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(world-health): report world.three.ws as down instead of unknown

nirholas118649a47fd0
diff --git a/api/_lib/ops/subsystem-health.js b/api/_lib/ops/subsystem-health.js
index 533e9f772..04a085b9e 100644
--- a/api/_lib/ops/subsystem-health.js
+++ b/api/_lib/ops/subsystem-health.js
@@ -340,6 +340,9 @@ async function checkWorld() {
if (age > WORLD_STALE_MS) {
return { ...base, status: 'unknown', detail: 'world-health report is stale' };
}
+ if (parked.status === 'down') {
+ return { ...base, status: 'down', detail: (parked.problems || []).join('; ') || 'world unreachable' };
+ }
if (parked.protected === false) {
return {
...base,
diff --git a/api/cron/world-health.js b/api/cron/world-health.js
index 8458147c8..5ba84202a 100644
--- a/api/cron/world-health.js
+++ b/api/cron/world-health.js
@@ -93,14 +93,24 @@ export default wrapCron(async (req, res) => {
sendOpsAlert('World DOWN', `${WORLD_STATUS_URL} returned HTTP ${r.status}`, {
signature: 'world-health:status-http',
});
+ await cacheSet(
+ WORLD_HEALTH_CACHE_KEY,
+ { status: 'down', protected: null, problems: [`HTTP ${r.status}`], missingCount: 0, checkedAt: Date.now() },
+ WORLD_HEALTH_TTL_S,
+ ).catch(() => {});
return json(res, 200, { status: 'down', protected: null, blueprintCount: 0, reason: `HTTP ${r.status}` });
}
status = await r.json();
} catch (e) {
const reason = e?.name === 'TimeoutError' ? 'timeout' : e?.message || 'unreachable';
- sendOpsAlert('World DOWN', `${WORLD_STATUS_URL} unreachable — ${reason}`, {
+ sendOpsAlert('World DOWN', `${WORLD_STATUS_URL} unreachable - ${reason}`, {
signature: 'world-health:status-unreachable',
});
+ await cacheSet(
+ WORLD_HEALTH_CACHE_KEY,
+ { status: 'down', protected: null, problems: [reason], missingCount: 0, checkedAt: Date.now() },
+ WORLD_HEALTH_TTL_S,
+ ).catch(() => {});
return json(res, 200, { status: 'down', protected: null, blueprintCount: 0, reason });
}
diff --git a/prompts/finish/_context/production-100-OWNER-ACTIONS.md b/prompts/finish/_context/production-100-OWNER-ACTIONS.md
index 9cce72b1c..cbb0f27db 100644
--- a/prompts/finish/_context/production-100-OWNER-ACTIONS.md
+++ b/prompts/finish/_context/production-100-OWNER-ACTIONS.md
@@ -84,6 +84,7 @@ on it; some resolve themselves as other work lands.
| 65 | **Apply the payment-session policy-upgrades migration, then ship it with the next deploy** (added 2026-10-15 by the triage-lane deep sweep, order 518-integrate-19 close-out). `api/_lib/migrations/20261015100000_payment_session_policy_upgrades.sql` adds `approval_threshold_usdc`, `blocked_hosts` and `per_rail_daily_usdc` to `payment_sessions`, the signed-verdict columns (`policy_digest`, `verdict_code`, `verdict_signature`, `verdict_signed_at`) to `payment_session_executions`, and the new `payment_session_rail_reservations` table backing the rolling-window per-rail cap. `npm run db:status` lists it as one of the pending migrations today. Not yet an active production bug (the code half, `api/_lib/pay/spend-governor.js` and `api/pay/simulate.js`'s shared `policy.js`, is still only on `evolve`/this worktree, not deployed), but it must be applied in the same window as that code deploys: the governor's atomic enforcement and the simulator's parity check both read and write these columns unconditionally, so deploying the code first against the unmigrated table would 500 every payment-session create/execute call with Postgres `42703 undefined_column`. Apply with `node scripts/apply-migrations.mjs --apply --file 20261015100000_payment_session_policy_upgrades.sql` (or `npm run db:migrate`, which applies every pending migration immediately with no dry run) before or together with the deploy that ships `655b5a491`. Row 63 (above) covers the separate `PAY_VERDICT_HMAC_KEY` env var this same feature uses for signing; that row is independent of this migration and already works on a fallback secret. | one migration apply, timed with the deploy | Lets the new payment-session governance knobs (blocked hosts, approval threshold, per-rail daily caps) and tamper-evident signed verdicts go live without a schema mismatch | [docs/payment-sessions.md](../../docs/payment-sessions.md) |
| 66 | **DONE 2026-10-23, applied by the order 522 close-out.** **Apply the x402 outbound-receipts resolved-columns migration** (added 2026-10-15, order 522-integrate-23 close-out). `api/_lib/migrations/20261015110000_x402_outbound_resolved.sql` adds `resolved_payer`, `resolved_payee`, `resolved_mint`, `resolved_amount_atomics`, `resolved_decimals`, `resolved_fee_lamports`, `resolved_slot`, `resolved_block_time`, `resolved_at` and `resolve_error` to `payment_session_executions`, plus a partial index (`pse_user_settled_resolved`) for the settled-and-unresolved lookup. `npm run db:status` lists it as pending today. Not an active production bug yet: zero outbound-spend rows exist in `payment_session_executions` right now, so nothing has tried to resolve one. It becomes load-bearing the moment the new `GET /api/x402/outbound-receipts` endpoint (`api/x402/outbound-receipts.js`, `api/_lib/x402/outbound-receipts.js`) is deployed and a real agent spend lands: `resolveAndCacheRow()`'s UPDATE would fail with Postgres `42703 undefined_column` the first time anyone views that row. Apply with `node scripts/apply-migrations.mjs --apply --file 20261015110000_x402_outbound_resolved.sql` (or `npm run db:migrate`) before or together with the deploy that ships this feature. Independent of row 65's migration; both are currently pending in the same `npm run db:status` list and can be applied in the same pass. | one migration apply, timed with the deploy | Lets the Receipt Vault's new Outbound tab cache chain-verified settlement data instead of erroring the first time it resolves a real row | [docs/payment-sessions.md](../../docs/payment-sessions.md) |
| 67 | Deploy `workers/model-triposplat` (`gcloud builds submit --config workers/model-triposplat/cloudbuild.yaml`, stage weights with `stage-assets.sh`), set `MODEL_TRIPOSPLAT_URL` on `three-ws-api` with `--update-env-vars`, then run `POST /api/forge-splat` on a real photo and open the returned splat in `/splat`. Added 2026-10-23, order 081 close-out. | minutes | Image-to-splat Forge lane live (order 081 DoD line 2) | `workers/model-triposplat/README.md` |
+| 68 | world.three.ws has been unreachable since the backing Cloud Run service `hyperfy-world` was deleted via the Cloud Run API by `[email protected]` at 2026-10-23T02:48:38Z (confirmed via `gcloud logging read 'protoPayload.methodName="google.cloud.run.v1.Services.DeleteService"'`), a deliberate recent action, not drift. The `world.three.ws` domain mapping is itself still healthy and provisioned; it now points at a service that no longer exists, which is why it answers a generic 404 instead of a branded error. Decide: redeploy (`bash deploy/world/apply-hardening.sh`, fully scripted and idempotent, documented in `deploy/world/README.md`) or formally retire the surface (remove the domain mapping and any in-product links to it). `/api/healthz` now correctly reports this as `world: down` instead of masking it as `unknown` (order 413). | decision | world.three.ws restoration or retirement | `deploy/world/README.md` |
Deleted 2026-09-01: the former row 5 (`WALLET_ENCRYPTION_KEY_PREVIOUS` policy), which
declared itself "delete on reading" and had outlived that by three weeks.
diff --git a/tests/subsystem-health.test.js b/tests/subsystem-health.test.js
index c2728a0f5..2ff9e237b 100644
--- a/tests/subsystem-health.test.js
+++ b/tests/subsystem-health.test.js
@@ -13,7 +13,7 @@
import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import { gatherSubsystemHealth, classifySniperBeat } from '../api/_lib/ops/subsystem-health.js';
-import { cacheSet } from '../api/_lib/cache.js';
+import { cacheSet, cacheDel } from '../api/_lib/cache.js';
// Env the ring + x402-config checks read. Save/restore so cases don't leak.
const ENV_KEYS = [
@@ -171,6 +171,21 @@ describe('gatherSubsystemHealth', () => {
expect(world.hint).toMatch(/ADMIN_CODE/);
});
+ it('reports world as DOWN from a parked world-health outcome', async () => {
+ await cacheSet(
+ 'world:health',
+ { status: 'down', protected: null, problems: ['HTTP 503'], missingCount: 0, checkedAt: Date.now() },
+ 3600,
+ );
+ const health = await gatherSubsystemHealth({ probeDb: false });
+ const world = sub(health, 'world');
+ expect(world.status).toBe('down');
+ expect(world.detail).toMatch(/503/);
+ expect(health.status).toBe('down');
+ expect(health.degraded).toContain('world');
+ await cacheDel('world:health');
+ });
+
it('reports cache as OK on the in-memory backend when no Redis is configured', async () => {
const health = await gatherSubsystemHealth({ probeDb: false });
const cache = sub(health, 'cache');
diff --git a/tests/world-health-asset-sweep.test.js b/tests/world-health-asset-sweep.test.js
index 0eb092149..34027f64f 100644
--- a/tests/world-health-asset-sweep.test.js
+++ b/tests/world-health-asset-sweep.test.js
@@ -27,6 +27,7 @@ vi.mock('../api/_lib/cache.js', () => ({ cacheSet: vi.fn(async () => {}) }));
import handler from '../api/cron/world-health.js';
import { sendOpsAlert } from '../api/_lib/alerts.js';
+import { cacheSet } from '../api/_lib/cache.js';
const SECRET = 'test-cron-secret';
@@ -93,6 +94,7 @@ beforeEach(() => {
warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
logSpy = vi.spyOn(console, 'log').mockImplementation(() => {});
sendOpsAlert.mockReset();
+ cacheSet.mockReset();
});
afterEach(() => {
vi.unstubAllGlobals();
@@ -167,4 +169,30 @@ describe('world-health asset sweep', () => {
expect(body.unreachableAssets).toHaveLength(1);
expect(body.unreachableAssets[0].status).toBe(503);
});
+
+ it('parks a down verdict when /status answers a non-2xx status', async () => {
+ vi.stubGlobal('fetch', vi.fn(async (url) => {
+ if (String(url).endsWith('/status')) return { ok: false, status: 503, json: async () => ({}) };
+ throw new Error('must not HEAD any asset when /status itself failed');
+ }));
+ const body = await run();
+
+ expect(body.status).toBe('down');
+ expect(sendOpsAlert).toHaveBeenCalledTimes(1);
+ expect(sendOpsAlert.mock.calls[0][0]).toBe('World DOWN');
+ expect(cacheSet).toHaveBeenCalledTimes(1);
+ expect(cacheSet.mock.calls[0][0]).toBe('world:health');
+ expect(cacheSet.mock.calls[0][1]).toMatchObject({ status: 'down', protected: null });
+ });
+
+ it('parks a down verdict when /status is unreachable', async () => {
+ vi.stubGlobal('fetch', vi.fn(async () => {
+ throw Object.assign(new Error('timed out'), { name: 'TimeoutError' });
+ }));
+ const body = await run();
+
+ expect(body.status).toBe('down');
+ expect(cacheSet).toHaveBeenCalledTimes(1);
+ expect(cacheSet.mock.calls[0][1]).toMatchObject({ status: 'down', protected: null });
+ });
});