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): wire the intel-learn and sniper-evolve ticks to the local proof runner

nirholas3b6c37916062
diff --git a/api/cron/intel-learn.js b/api/cron/intel-learn.js
index 7a00f9cb1..421bf5665 100644
--- a/api/cron/intel-learn.js
+++ b/api/cron/intel-learn.js
@@ -31,7 +31,10 @@ export default wrapCron(async (req, res) => {
// forever (the serial 100/run era ended with an 11-day labeling blackout and a
// 370k backlog). 1500/run ≈ 144k/day: catches up a backlog in days, then
// idles cheaply (the query returns only unlabeled coins).
- const { labeled } = await labelOutcomes({ network: NETWORK, limit: 1500, minAgeMinutes: 60 });
+ // A coin the pump.fun lookup could not answer for is recorded 'unknown', which
+ // is a "we do not know yet", not a verdict. labelOutcomes retries those on a
+ // backoff on top of this budget, and `relabeled` reports how many it rescued.
+ const { labeled, relabeled } = await labelOutcomes({ network: NETWORK, limit: 1500, minAgeMinutes: 60 });
// Retrain once there's enough labeled history. Skips quietly below the floor.
// The sample ceiling keeps the training query's memory bounded (the signals
diff --git a/api/cron/sniper-evolve.js b/api/cron/sniper-evolve.js
index aeff8953f..cda37256a 100644
--- a/api/cron/sniper-evolve.js
+++ b/api/cron/sniper-evolve.js
@@ -17,6 +17,7 @@
// plus the EVOLVE_* tunables read by runEvolve (fleet budget, floors, samples).
import { json, method, wrapCron } from '../_lib/http.js';
+import { isDbUnavailableError } from '../_lib/db.js';
import { runEvolve } from '../../scripts/sniper-evolve.mjs';
import { requireCron } from '../_lib/cron-auth.js';
@@ -38,6 +39,19 @@ export default wrapCron(async (req, res) => {
applied: result.applied,
});
} catch (err) {
- return json(res, 200, { ok: false, error: err.message, log: lines.slice(-8) });
+ // A database outage is the platform-wide case wrapCron already owns: let it
+ // through so the tick heartbeats UNHEALTHY and answers with the same
+ // {ok:false, reason:'db_unavailable'} shape every other cron does. Swallowing
+ // it here answered 200 and left wrapCron writing a SUCCESS heartbeat, which
+ // is precisely how a dead learning loop hides behind a green check (the
+ // failure this fleet's own loops-health watchdog exists to catch).
+ if (isDbUnavailableError(err)) throw err;
+ // Never report a failure with no diagnostic. The neon Pool rejects with an
+ // Error carrying an EMPTY message on a transport-level fault, so the raw
+ // `err.message` shipped `{"ok":false,"error":""}`: an operator reading that
+ // learns only that something went wrong, never what.
+ const detail = err?.message || (err?.name ? `${err.name} (no message)` : String(err) || 'unknown error');
+ console.error('[sniper-evolve] failed:', detail);
+ return json(res, 200, { ok: false, error: detail, log: lines.slice(-8) });
}
});
diff --git a/scripts/cron-local-proof.mjs b/scripts/cron-local-proof.mjs
index 8c8e264c6..c4e254304 100644
--- a/scripts/cron-local-proof.mjs
+++ b/scripts/cron-local-proof.mjs
@@ -240,11 +240,21 @@ async function bootstrapSchema(pool, { passes = 4 } = {}) {
.sort()
.map((f) => path.join('api/_lib/migrations', f));
+ // Transaction-control statements are dropped so each statement autocommits on
+ // its own. Many migrations wrap their body in `begin; … commit;`, and inside
+ // an explicit transaction the FIRST unsatisfiable statement aborts the whole
+ // block: every statement that already succeeded is rolled back and every one
+ // after it fails with "current transaction is aborted". That is how
+ // forge_creations.user_id went missing here while its own ALTER was fine, and
+ // it made a local-only schema gap look like a handler bug.
+ const TX_CONTROL = /^(begin|start\s+transaction|commit|end|rollback)\b/i;
+
let pending = [];
for (const rel of [...base, ...migrations]) {
const abs = path.join(root, rel);
if (!fs.existsSync(abs)) continue;
for (const stmt of splitStatements(fs.readFileSync(abs, 'utf8'))) {
+ if (TX_CONTROL.test(stmt)) continue;
pending.push({ file: rel, stmt });
}
}