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
feat(cron): sync the print orders job into the scheduler fleet
nirholas456ee61eb3c4
diff --git a/scripts/create-gcp-scheduler.mjs b/scripts/create-gcp-scheduler.mjsindex c4ff1993e..fe7d9d90f 100644--- a/scripts/create-gcp-scheduler.mjs+++ b/scripts/create-gcp-scheduler.mjs@@ -42,7 +42,8 @@// api/cron/* handlers already validate. The secret is read from --env-file, then// process.env, then the live three-ws-api Cloud Run service (production's// authoritative copy, and the only source on a machine whose .env lacks it).-// It is never hardcoded.+// When the service stores it as a Secret Manager reference rather than a literal,+// the reference is followed. It is never hardcoded.// `--oidc` additionally attaches a Cloud Scheduler OIDC identity token, the// second lock the edge gate (server/cron-edge-auth.mjs) can verify. It exists@@ -166,7 +167,7 @@ export function cronSecretFromArgs(argv, readFile = (p) => readFileSync(p, 'utf8* Returns null rather than throwing: a caller that also has `--env-file` or a* process env should not be denied by an unrelated gcloud failure.*/-export function cronSecretFromService(describe = defaultDescribeService) {+export function cronSecretFromService(describe = defaultDescribeService, accessVersion = defaultAccessSecretVersion) {let svc;try {svc = JSON.parse(describe());@@ -174,7 +175,36 @@ export function cronSecretFromService(describe = defaultDescribeService) {return null;}const env = svc?.spec?.template?.spec?.containers?.[0]?.env || [];- return env.find((e) => e.name === 'CRON_SECRET')?.value || null;+ const entry = env.find((e) => e.name === 'CRON_SECRET');+ if (!entry) return null;+ if (entry.value) return entry.value;+ // CRON_SECRET is a credential, so it belongs in Secret Manager rather than as+ // a literal on the service (scripts/migrate-plaintext-secrets.mjs moves it+ // there). Once it is a secretKeyRef the service config no longer carries the+ // value, so follow the reference. The payload is returned byte for byte,+ // exactly what the container receives, with no trimming.+ const ref = entry.valueFrom?.secretKeyRef;+ if (!ref?.name) return null;+ try {+ return accessVersion(ref.name, ref.key || 'latest') || null;+ } catch {+ return null;+ }+}++function defaultAccessSecretVersion(secretName, version) {+ return execFileSync(+ 'gcloud',+ [+ 'secrets',+ 'versions',+ 'access',+ version,+ `--secret=${secretName}`,+ `--project=${PROJECT}`,+ ],+ { encoding: 'utf8', maxBuffer: 1024 * 1024, stdio: ['ignore', 'pipe', 'ignore'] },+ );}function defaultDescribeService() {diff --git a/tests/cron-scheduler-sync.test.js b/tests/cron-scheduler-sync.test.jsindex 41bb32143..178d08089 100644--- a/tests/cron-scheduler-sync.test.js+++ b/tests/cron-scheduler-sync.test.js@@ -68,6 +68,44 @@ describe('cronSecretFromService', () => {);});+ // Once the secret is migrated off the service config (production did this on+ // 2026-09-02), the only copy lives in Secret Manager, so the reference has to+ // be followed or every cron repair on a fresh machine dead-ends again.+ it('follows a secret-manager reference to the version the container reads', () => {+ const accessed = [];+ const value = cronSecretFromService(+ service([{ name: 'CRON_SECRET', valueFrom: { secretKeyRef: { name: 'cron-secret', key: 'latest' } } }]),+ (secret, version) => {+ accessed.push([secret, version]);+ return 's3cr3t';+ },+ );+ expect(value).toBe('s3cr3t');+ expect(accessed).toEqual([['cron-secret', 'latest']]);+ });++ // The container receives the payload byte for byte. Trimming here would sign+ // every cron header with a value production never uses.+ it('returns the payload without trimming it', () => {+ expect(+ cronSecretFromService(+ service([{ name: 'CRON_SECRET', valueFrom: { secretKeyRef: { name: 'cron-secret', key: '4' } } }]),+ () => ' padded \n',+ ),+ ).toBe(' padded \n');+ });++ it('returns null when the secret version cannot be read', () => {+ expect(+ cronSecretFromService(+ service([{ name: 'CRON_SECRET', valueFrom: { secretKeyRef: { name: 'cron-secret', key: 'latest' } } }]),+ () => {+ throw new Error('PERMISSION_DENIED');+ },+ ),+ ).toBe(null);+ });+// An unauthenticated gcloud must not deny a caller who passed --env-file.it('returns null instead of throwing when gcloud fails', () => {expect(