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.
JavaScript 3d-generationai-agentsanimationavatardigital-humangenerative-aiglbgltfimage-to-3dllmmcpmcp-servermodel-context-protocolsolanatext-to-3dthreejsweb-componentswebglwebxrx402
docs: reconstruct completion backstop + cron mirror is not self-enforcing
nirholasac1ed5656e32
diff --git a/docs/avatar-reconstruction.md b/docs/avatar-reconstruction.mdindex c42394695..a9c503134 100644--- a/docs/avatar-reconstruction.md+++ b/docs/avatar-reconstruction.md@@ -11,6 +11,35 @@ blendshapes instead of a bare mesh that still needs auto-rigging.- **Worker:** [`workers/avatar-reconstruction/`](../workers/avatar-reconstruction) — FastAPI on a Cloud Run L4 GPU.- **Backend provider:** [`api/_providers/gcp.js`](../api/_providers/gcp.js), selected by `AVATAR_REGEN_PROVIDER=gcp` (see [`api/_lib/regen-provider.js`](../api/_lib/regen-provider.js)).- **User entry points:** the selfie/upload flow and text→avatar prompt flow in [`api/avatars/_actions.js`](../api/avatars/_actions.js) (`POST /api/avatars/reconstruct`).+- **Completion:** normally driven by the browser polling `/api/avatars/regenerate-status`, which runs the finalize stages inline. [`api/cron/reconstruct-sweep.js`](../api/cron/reconstruct-sweep.js) is the server-side backstop for when it isn't — see below.++## Who finishes the job++A reconstruct job is advanced by whoever polls it. The `/create/selfie` page+polls every few seconds, and each poll pulls provider status and runs the shared+finalize stages in [`reconstruct-finalize.js`](../api/_lib/reconstruct-finalize.js).++That made the browser tab load-bearing. Close it mid-build and the worker still+finished the GLB and stored it durably in GCS, but nothing ever collected it: the+job row stayed `queued`/`running` forever and the avatar never reached the user's+library. Production had 26 jobs stranded that way, the oldest from 2026-05-31,+invisible to `db-retention` (which only prunes terminal rows).++`reconstruct-sweep` closes that hole. Every 5 minutes it picks up reconstruct+jobs quiet for over 3 minutes and runs **the same finalize stages** the browser+poll would have, so an abandoned job still lands in the library. Design notes:++- **30-day rescue window**, far longer than the auto-rig sweep's 6 hours. The+ worker's GLBs (GCS) and job state (Firestore) are both durable, so a weeks-old+ abandoned job is still genuinely deliverable to a real user.+- Past that window, and for jobs whose provider is no longer pollable with+ platform credentials, rows are failed out with an honest reason — the open set+ must not grow without bound.+- **BYOK jobs (meshy/tripo) stay browser-driven.** They authenticate with the+ user's own key, which the status poll resolves from request context; a cron has+ no user context to decrypt it. They age out via the same window.+- A provider 404 (`gcp_task_missing`) is terminal here, so a job whose worker+ record is genuinely gone resolves instead of being retried forever.## How it worksdiff --git a/docs/ops/gcp-production.md b/docs/ops/gcp-production.mdindex 7119bf1a2..53ada1712 100644--- a/docs/ops/gcp-production.md+++ b/docs/ops/gcp-production.md@@ -246,9 +246,31 @@ phases.## Crons (Cloud Scheduler)-The 76 schedules in `vercel.json` `crons` are mirrored 1:1 to Cloud Scheduler-jobs in us-central1, named `cron-api-cron-<name>`. All 76 are **ENABLED**-(Vercel's crons died with the deployment, so there is no double-fire risk).+The schedules in `vercel.json` `crons` are mirrored to Cloud Scheduler jobs in+us-central1, mostly named `cron--api-cron-<name>` (a few older ones use a bare+name, so **match by target URI, not by job name**, when auditing). Vercel's crons+died with the deployment, so there is no double-fire risk.++**The mirror is not automatically enforced — verify it after editing `crons`.**+As of 2026-07-25 there were 98 entries in `vercel.json` and 96 scheduler jobs;+five declared crons had **no scheduler job at all** and had therefore never run+in production: `kol-tracker-refresh`, `forge-thumbnail-backfill`,+`forge-off-crown`, `quality-bench`, and `confirm-pending-purchases` (that last+one has no handler file either — it is a phantom entry that would 404, so+nothing is stuck behind it). Declaring a cron in `vercel.json` does nothing on+its own; only the sync script below creates the job.++```bash+# Audit: which declared crons have no scheduler job targeting them?+python3 - <<'EOF'+import json, subprocess+crons = [c['path'] for c in json.load(open('vercel.json'))['crons']]+jobs = json.loads(subprocess.run(['gcloud','scheduler','jobs','list','--location','us-central1',+ '--project','aerial-vehicle-466722-p5','--format=json'], capture_output=True, text=True).stdout)+have = {(j.get('httpTarget') or {}).get('uri','').split('.run.app',1)[-1].split('?')[0] for j in jobs}+print('\n'.join(p for p in crons if p not in have) or 'all mirrored')+EOF+``````bash# Sync after editing crons in vercel.json (idempotent create-or-update):