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(cron): export the job-id derivation without running the scheduler sync on import

nirholas6e12fe666d3c
diff --git a/scripts/create-gcp-scheduler.mjs b/scripts/create-gcp-scheduler.mjs
index a6253fed0..c3b619cdc 100644
--- a/scripts/create-gcp-scheduler.mjs
+++ b/scripts/create-gcp-scheduler.mjs
@@ -29,7 +29,7 @@
// node scripts/create-gcp-scheduler.mjs --env-file <prod.env> # sync config, leave run state alone
// node scripts/create-gcp-scheduler.mjs --env-file <prod.env> --pause # sync + pause EVERY job (stop the fleet)
// node scripts/create-gcp-scheduler.mjs --env-file <prod.env> --resume # sync + resume EVERY job (recover from --pause)
-// gcloud scheduler jobs resume cron-api-cron-uptime-check --location us-central1 # one job
+// gcloud scheduler jobs resume cron--api-cron-uptime-check --location us-central1 # one job
//
// Auth: each job sends `Authorization: Bearer $CRON_SECRET`, exactly what the
// api/cron/* handlers already validate. The secret is read from --env-file or
@@ -54,7 +54,8 @@ const ATTEMPT_DEADLINE = '320s';
/**
* Scheduler job id for a cron path: `/api/cron/economy-tick` →
- * `cron-api-cron-economy-tick`. Job ids allow [a-zA-Z0-9_-], max 500 chars.
+ * `cron--api-cron-economy-tick`. The path's leading slash becomes a hyphen of its
+ * own, hence the double hyphen. Job ids allow [a-zA-Z0-9_-], max 500 chars.
*
* `scripts/check-cron-drift.mjs` imports this rather than re-deriving it: two
* copies that drift by one character make every live job read as MISSING and
diff --git a/tests/cron-scheduler-sync.test.js b/tests/cron-scheduler-sync.test.js
index 0077ede1c..8e371f159 100644
--- a/tests/cron-scheduler-sync.test.js
+++ b/tests/cron-scheduler-sync.test.js
@@ -37,13 +37,17 @@ describe('runStateAction', () => {
});
describe('jobId', () => {
+ // The leading slash of the path becomes a hyphen of its own, so a live job id
+ // carries a DOUBLE hyphen after the prefix. Every hand-typed `gcloud scheduler
+ // jobs pause|run|describe` command that spells it with one hyphen fails with
+ // NOT_FOUND, which is why the exact string is pinned here.
it('matches the ids Cloud Scheduler already holds', () => {
- expect(jobId('/api/cron/economy-tick')).toBe('cron-api-cron-economy-tick');
- expect(jobId('/api/llm/health')).toBe('cron-api-llm-health');
+ expect(jobId('/api/cron/economy-tick')).toBe('cron--api-cron-economy-tick');
+ expect(jobId('/api/llm/health')).toBe('cron--api-llm-health');
});
it('collapses every run of non-alphanumerics to a single hyphen', () => {
- expect(jobId('/api/cron/a__b.c')).toBe('cron-api-cron-a-b-c');
+ expect(jobId('/api/cron/a__b.c')).toBe('cron--api-cron-a-b-c');
});
it('produces one unique, id-legal job per declared cron', () => {