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.

sniper: zombie-arm tripwire + wallet backfill (why the crossing arm never traded)

nirholasf34d83e4b1c3
diff --git a/api/_lib/sniper-loops-health.js b/api/_lib/sniper-loops-health.js
index 8a50dc00d..32886d72f 100644
--- a/api/_lib/sniper-loops-health.js
+++ b/api/_lib/sniper-loops-health.js
@@ -96,6 +96,30 @@ export function classifyLoopHealth(probes, now) {
return { ok, stale };
}
+/**
+ * Fleet integrity: an ENABLED strategy whose agent holds no Solana wallet is a
+ * zombie arm. It passes every status check, receives budget from the evolution
+ * loop, generates candidates, and then every single buy dies at no_wallet. This
+ * is how oracle-strict sat armed on the conviction-50 crossing (the strongest
+ * signal in the July 2026 dataset) for two days without a trade. Pure.
+ *
+ * @param {Array<{label:string|null, strategy_id:string, wallet:string|null, enabled:boolean, daily_budget_lamports?:string|number|null}>} rows
+ * @returns {Array<{label:string, strategy_id:string, budgetSol:number}>} zombie arms
+ */
+export function findWalletlessArms(rows) {
+ const out = [];
+ for (const r of rows || []) {
+ if (r.enabled !== true) continue;
+ if (r.wallet != null && String(r.wallet).trim() !== '') continue;
+ out.push({
+ label: r.label || r.strategy_id,
+ strategy_id: r.strategy_id,
+ budgetSol: Number(r.daily_budget_lamports || 0) / 1e9,
+ });
+ }
+ return out;
+}
+
/** Human line for one stale loop, used in the ops alert body. */
export function describeStale(entry) {
const age = entry.ageMs === Infinity
diff --git a/api/cron/sniper-loops-health.js b/api/cron/sniper-loops-health.js
index 5080ebaf7..a0f780d39 100644
--- a/api/cron/sniper-loops-health.js
+++ b/api/cron/sniper-loops-health.js
@@ -18,7 +18,7 @@ import { env } from '../_lib/env.js';
import { constantTimeEquals } from '../_lib/crypto.js';
import { sql } from '../_lib/db.js';
import { sendOpsAlert } from '../_lib/alerts.js';
-import { LOOPS, classifyLoopHealth, describeStale } from '../_lib/sniper-loops-health.js';
+import { LOOPS, classifyLoopHealth, describeStale, findWalletlessArms } from '../_lib/sniper-loops-health.js';
const NETWORK = 'mainnet';
@@ -56,6 +56,31 @@ export default wrapCron(async (req, res) => {
const broken = probes.filter((p) => p.probeError);
const { ok, stale } = classifyLoopHealth(probes.filter((p) => !p.probeError), Date.now());
+ // Fleet integrity: enabled arms whose agent has no wallet. These pass every
+ // status check and can never trade (every buy dies at no_wallet). Discovered
+ // the hard way: oracle-strict sat armed on the conviction-50 crossing for two
+ // days as exactly this kind of zombie.
+ let zombies = [];
+ try {
+ const rows = await sql`
+ select s.id as strategy_id, s.label, s.enabled, s.daily_budget_lamports,
+ a.meta->>'solana_address' as wallet
+ from agent_sniper_strategies s
+ join agent_identities a on a.id = s.agent_id and a.deleted_at is null
+ where s.network = ${NETWORK} and s.enabled = true
+ `;
+ zombies = findWalletlessArms(rows);
+ } catch (err) {
+ broken.push({ name: 'fleet-integrity', probeError: err?.message || 'query failed' });
+ }
+ if (zombies.length) {
+ await Promise.resolve(sendOpsAlert(
+ `🎯 agent-sniper — ${zombies.length} armed strateg${zombies.length === 1 ? 'y' : 'ies'} have NO WALLET`,
+ zombies.map((z) => `${z.label}: enabled with ${z.budgetSol.toFixed(3)} SOL/day budget and no Solana wallet — every buy dies at no_wallet. Heal with: node scripts/seed-sniper-experiments.mjs --apply --only ${z.label}`).join('\n'),
+ { signature: 'sniper:armed-walletless' },
+ )).catch(() => {});
+ }
+
if (stale.length) {
// One alert per run covering every stale loop, deduped hourly on a stable
// signature so a dead loop pages once an hour until it produces rows again.
@@ -75,10 +100,11 @@ export default wrapCron(async (req, res) => {
}
return json(res, 200, {
- ok: stale.length === 0 && broken.length === 0,
+ ok: stale.length === 0 && broken.length === 0 && zombies.length === 0,
checked: probes.length,
stale: stale.map((s) => ({ name: s.name, last_at: s.lastAt, age_h: s.ageMs === Infinity ? null : Math.round(s.ageMs / 3600_000 * 10) / 10 })),
healthy: ok.map((s) => s.name),
+ walletless_arms: zombies.map((z) => z.label),
probe_errors: broken.map((b) => ({ name: b.name, error: b.probeError })),
});
});
diff --git a/scripts/seed-sniper-experiments.mjs b/scripts/seed-sniper-experiments.mjs
index 211440c8b..678438bc2 100644
--- a/scripts/seed-sniper-experiments.mjs
+++ b/scripts/seed-sniper-experiments.mjs
@@ -274,6 +274,22 @@ for (const arm of ARMS) {
`update agent_sniper_strategies set ${assignments}, updated_at = now() where agent_id = $1 and network = $2`,
[arm.agent, NETWORK, ...cols.map((c) => set[c])],
);
+
+ // Wallet backfill. The reshape path used to assume every armed agent already
+ // held a wallet, and oracle-strict proved it wrong: the arm sat enabled on the
+ // strongest signal in the dataset (the conviction-50 crossing) for two days
+ // while every candidate died at no_wallet, because its agent had no Solana
+ // address. ensureAgentWallet is idempotent (no-ops on a healthy wallet), so
+ // every applied reshape now heals this class of arm instead of skipping it.
+ const { rows: [ident] } = await pool.query(
+ "select user_id, meta->>'solana_address' as addr from agent_identities where id = $1 and deleted_at is null",
+ [arm.agent],
+ );
+ if (ident && !ident.addr) {
+ const { ensureAgentWallet } = await import('../api/_lib/agent-wallet.js');
+ const wallet = await ensureAgentWallet(arm.agent, ident.user_id, { reason: 'sniper_experiment_seed_backfill' });
+ console.log(` wallet BACKFILLED ${wallet.address} (agent was armed but walletless — auto-funder will top it up)`);
+ }
updated++;
}
diff --git a/tests/sniper-postmortem-fixes.test.js b/tests/sniper-postmortem-fixes.test.js
index eb4c4f6f9..96daa4659 100644
--- a/tests/sniper-postmortem-fixes.test.js
+++ b/tests/sniper-postmortem-fixes.test.js
@@ -14,7 +14,7 @@
import { describe, expect, it } from 'vitest';
import { llmVerdictGate } from '../workers/agent-sniper/llm-judge.js';
import { decideLiquidityDecay, updateStaleClock } from '../workers/agent-sniper/exit-logic.js';
-import { LOOPS, classifyLoopHealth, describeStale } from '../api/_lib/sniper-loops-health.js';
+import { LOOPS, classifyLoopHealth, describeStale, findWalletlessArms } from '../api/_lib/sniper-loops-health.js';
describe('llmVerdictGate', () => {
const strat = { llm_min_confidence: 0.65, llm_max_confidence: 0.9, llm_strict_model: false };
@@ -143,3 +143,33 @@ describe('classifyLoopHealth (count rows, not status codes)', () => {
expect(stale).toHaveLength(0);
});
});
+
+describe('findWalletlessArms (the oracle-strict zombie class)', () => {
+ const arm = (over) => ({
+ strategy_id: 'S1', label: 'oracle-strict', enabled: true,
+ wallet: null, daily_budget_lamports: '45957000', ...over,
+ });
+
+ it('flags an enabled arm with no wallet — the exact production failure', () => {
+ const z = findWalletlessArms([arm()]);
+ expect(z).toHaveLength(1);
+ expect(z[0].label).toBe('oracle-strict');
+ expect(z[0].budgetSol).toBeCloseTo(0.045957);
+ });
+
+ it('treats a blank address like a missing one', () => {
+ expect(findWalletlessArms([arm({ wallet: ' ' })])).toHaveLength(1);
+ });
+
+ it('passes funded arms and ignores disabled ones', () => {
+ expect(findWalletlessArms([
+ arm({ wallet: 'HBgNvnffvbKRzE1vgmvTfKLNq2taETKZJDpZRHcAm8Ca' }),
+ arm({ enabled: false }),
+ ])).toHaveLength(0);
+ });
+
+ it('never throws on empty or missing input', () => {
+ expect(findWalletlessArms([])).toEqual([]);
+ expect(findWalletlessArms(null)).toEqual([]);
+ });
+});