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(custody): keep an unreadable key out of the stranded-funds count

nirholasaadc404b8ad1
diff --git a/api/_lib/custodial-key-health.js b/api/_lib/custodial-key-health.js
index 59328061f..62b00627b 100644
--- a/api/_lib/custodial-key-health.js
+++ b/api/_lib/custodial-key-health.js
@@ -347,6 +347,14 @@ export function buildStrandedPanel(report) {
detail = `${funded} custodial wallet(s) hold ${sol.stranded ?? 0} SOL behind a retired encryption key (platform ${sol.stranded_platform ?? 0}, customer ${sol.stranded_customer ?? 0}).`;
}
+ // A key problem produces a decrypt-failure total that is NOT lost custody, and
+ // publishing it as one would repeat the defect this whole surface exists to
+ // end (a plan that advertises SOL nothing can move). The counts stay, because
+ // "this process failed on N wallets" is a true statement about this process;
+ // the SOL attribution is withheld until a reading can actually support it.
+ const unattributable = reason === 'no_decryption_key' || reason === 'key_mismatch';
+ const attributed = (n) => (unattributable ? null : n ?? 0);
+
return {
status,
reason,
@@ -356,16 +364,16 @@ export function buildStrandedPanel(report) {
undecryptable,
stranded_funded: funded,
stranded_unread: unread,
- sol_stranded: sol.stranded ?? 0,
- sol_stranded_platform: sol.stranded_platform ?? 0,
- sol_stranded_customer: sol.stranded_customer ?? 0,
- customer_wallets_stranded: (report?.top_stranded || []).filter((w) => !w.platform).length,
+ sol_stranded: attributed(sol.stranded),
+ sol_stranded_platform: attributed(sol.stranded_platform),
+ sol_stranded_customer: attributed(sol.stranded_customer),
+ customer_wallets_stranded: unattributable ? null : (report?.top_stranded || []).filter((w) => !w.platform).length,
detail,
// Customer money that cannot be withdrawn is a support obligation, not an
// ops number: the board names the decision doc rather than leaving the
// reader to rediscover that recovery is impossible.
brief: status === 'stranded' && (sol.stranded_customer || 0) > 0 ? 'docs/ops/stranded-wallets.md' : null,
- top_stranded: (report?.top_stranded || []).slice(0, 10).map((w) => ({
+ top_stranded: (unattributable ? [] : report?.top_stranded || []).slice(0, 10).map((w) => ({
address: w.address,
sol: w.sol,
platform: w.platform,
diff --git a/scripts/migrate-plaintext-secrets.mjs b/scripts/migrate-plaintext-secrets.mjs
index 4fe8a341e..887b0bd0b 100755
--- a/scripts/migrate-plaintext-secrets.mjs
+++ b/scripts/migrate-plaintext-secrets.mjs
@@ -422,6 +422,12 @@ async function main() {
if (!updates.length) fail('no var could be prepared; nothing was flipped on the service');
const pairs = updates.map((u) => `${u.name}=${u.secretName}:latest`).join(',');
+ // Cloud Run refuses to retype an env var in place: an update that only sets
+ // --update-secrets on a name that is currently a literal fails with "already
+ // been set with a different type". The literal has to be dropped in the SAME
+ // update, which lands as one revision, so the var is never absent from a
+ // serving container.
+ const removals = updates.map((u) => u.name).join(',');
if (!APPLY) {
const echoFlags = [
ONLY.length ? ` --only ${ONLY.join(',')}` : '',
@@ -431,7 +437,9 @@ async function main() {
FORCE_NEW_VERSION ? ' --force-new-version' : '',
].join('');
console.log(`\nDry run. To apply:\n node scripts/migrate-plaintext-secrets.mjs${echoFlags} --apply`);
- console.log(`\nThe single service update it would run:\n gcloud run services update ${SERVICE} --region ${REGION} --project ${PROJECT} \\\n --update-secrets ${pairs}`);
+ console.log(
+ `\nThe single service update it would run:\n gcloud run services update ${SERVICE} --region ${REGION} --project ${PROJECT} \\\n --remove-env-vars ${removals} \\\n --update-secrets ${pairs}`,
+ );
return;
}
@@ -442,6 +450,7 @@ async function main() {
'update',
SERVICE,
`--region=${REGION}`,
+ `--remove-env-vars=${removals}`,
`--update-secrets=${pairs}`,
'--quiet',
]);