From 684d934721f06531e1b97062b026e03350dd5f74 Mon Sep 17 00:00:00 2001 From: "CC (Claude Code)" Date: Mon, 16 Nov 2026 01:25:07 -0800 Subject: [PATCH] docs(owner-budget): three comments that said the wrong thing about #1557's code (review of #1557) - owner-budget.ts: an account is not proof the wallet signed. POST /builder/register makes one behind an API key with no signature, so "only created for a wallet that signed" was false. - routes/agent-spend.ts: loadOwnerBuilder is null when there is no funding account, not "if not a builder"; a human_sbt owner has one with HUMAN_SBT_OWNER_BUDGET_ENABLED=true. - e2e owner-budget-testnet.ts: no_owner_budget surfaces at step 3b only in stake mode; in wallet mode 3b does not run and step R answers it. Comments only; no behaviour change. Co-Authored-By: Claude Opus 5.5 --- scripts/e2e/owner-budget-testnet.ts | 5 +++-- src/routes/agent-spend.ts | 6 +++++- src/services/owner-budget.ts | 11 ++++++++--- 3 files changed, 16 insertions(+), 6 deletions(-) diff --git a/scripts/e2e/owner-budget-testnet.ts b/scripts/e2e/owner-budget-testnet.ts index 1e4216b1..5a854228 100644 --- a/scripts/e2e/owner-budget-testnet.ts +++ b/scripts/e2e/owner-budget-testnet.ts @@ -393,8 +393,9 @@ async function run(execute: boolean): Promise { if (kind === 'human_sbt' && b.body.binding?.human_token_id) { // A proof-of-human wallet binds as human_sbt. Its budget is the stake of the account that holds the // same wallet (step 1), but only where the server has HUMAN_SBT_OWNER_BUDGET_ENABLED=true - // (owner-budget.ts ownerBuilderOfAgent). Not readable from here: step 3b answers no_owner_budget - // where it is off, before any USDC moves. + // (owner-budget.ts ownerBuilderOfAgent). Not readable from here. Where it is off, the first owner-budget + // read answers no_owner_budget before any USDC moves: step 3b in stake mode (the spend-limit route), and + // step R in wallet mode, where 3b does not run. log('3-bind', `${a.name} bound to the owner as a verified human (${b.body.binding.human_token_id}); its budget is account ${builderId}'s stake`, b.body); } else if (kind !== 'builder' || String(b.body.binding?.builder_id) !== builderId) { stop('3-bind', `bound as ${kind} ${b.body.binding?.builder_id ?? b.body.binding?.human_token_id}, not builder ${builderId}.`, b.body); diff --git a/src/routes/agent-spend.ts b/src/routes/agent-spend.ts index c6648b46..b1894997 100644 --- a/src/routes/agent-spend.ts +++ b/src/routes/agent-spend.ts @@ -83,7 +83,11 @@ export interface AgentSpendDeps { /** The wallet bound as this agent's owner, or null if nobody has bound it. */ loadOwnerWallet?: (agentId: string) => Promise; enabled?: () => boolean; - /** The owner's account (builder) whose stake is the shared budget, or null if not a builder. */ + /** + * The owner's account (builder) whose stake is the shared budget, or null if there is none + * (owner-budget.ts ownerBuilderOfAgent): a builder owner's own account, or, only with + * HUMAN_SBT_OWNER_BUDGET_ENABLED=true, the account holding a verified human owner's wallet. + */ loadOwnerBuilder?: (agentId: string) => Promise; ownerBudget?: OwnerBudgetStore; budgetMode?: () => OwnerBudgetMode; diff --git a/src/services/owner-budget.ts b/src/services/owner-budget.ts index 7afefb23..ba7f14fc 100644 --- a/src/services/owner-budget.ts +++ b/src/services/owner-budget.ts @@ -205,9 +205,14 @@ export const supabaseAgentLimits: AgentLimitStore = { * proof-of-human owner could not hold a budget at all and the first live run stopped at bind * (reports/2026-11-16/owner-budget-e2e-execute.attempt1-sbt-wallet.json). With * HUMAN_SBT_OWNER_BUDGET_ENABLED=true it is the account that holds the same wallet. That wallet is - * the binding's, which bind took from human_sbt_registry, never from the caller, and an account is - * only created for a wallet that signed (POST /account/connect). The binding itself is unchanged, so - * the owner's assurance label stays proof-of-human. + * the binding's, which bind took from human_sbt_registry, never from the caller. The binding itself is + * unchanged, so the owner's assurance label stays proof-of-human. + * + * An account for a wallet does NOT prove that wallet signed. A signed connect (POST /account/connect) + * makes one, but so does POST /builder/register, behind an API key and with no signature from the + * wallet. This comment said "only created for a wallet that signed" until 2026-11-16 (review of #1557). + * What funds the budget is the account's stake, not the account; two accounts for one wallet are + * refused below as ambiguous rather than picked between. */ export async function ownerBuilderOfAgent( agentId: string,