Repository navigation
fix(agents): names work once trinity- is reserved for the 12 and names are unique - #1573
DealAppSeo wants to merge 4 commits into
Conversation
Prepares the code for the 2026-11-16 SQL (applied separately by Sean), which gives the trinity- prefix back only to the 12 original agents and adds a case-insensitive unique index on repid_agents.agent_name. Everything here works both before and after that SQL runs. - repid.ts / route.ts: a name lookup tries the exact name and the trinity- form, instead of only the trinity- form. External agents lose the prefix. - agents-external.ts: a taken name returns 409, keyed on the index name, so a duplicate wallet address is still reported as the 500 it was. - agents.ts: each human gets its own name (human-<12 hex>) instead of "HUMAN"; it is independent of the human's private id. - agent-performance.ts: the leaderboard excludes humans by is_human instead of by the name HUMAN. - CLAUDE.md: what the prefix means now, and that the index must be checked. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The single .in() query broke every test double that only implements eq(). Exact name first, then the trinity- form, the same order fetchAgentRow uses. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Strix Security Review✅ No open security findings. All previously reported findings have been resolved. PR summary: This PR resolves agent names canonical-first (`trinity-<name>`, then the exact name) across the score-card, LLM-completion, passport and task-bridge lookups, gives every human row a random `human-<hex>` name instead of `HUMAN`, returns 409 when registration hits the new unique agent-name index, and filters humans off the leaderboard by `is_human`. Review summaryThe changed identity handling holds up: the three name resolvers now try the canonical 1 resolved findingRuled out (6)
Review history (3)
Review 3 on this PR · Reviewed by Strix |
Strix (PR #1573): exact-name-first let a row holding only "sophia" outrank trinity-sophia in /repid/:id, /v1/llm/complete attribution and the passport. All three resolvers now try the trinity- form first, then the exact name. The passport had the same order before this PR; fixed with the rest. New test: both "trinity-shofet" and a plain "shofet" exist; the passport for "shofet" must be the original. It fails on the old order and passes now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@strix-security please re-review 6e58863 (lookup order now puts the |
Strix (PR #1573): the task bridge looked up only the trinity- form of a task's agent name. trinity_tasks' own trigger still prefixes every name it stores, so once the companion SQL strips the prefix from non-original agents, their tasks would be skipped. The bridge now tries the trinity- form first (the 12), then the bare name. The passport comment names all four resolvers. New test: a task recorded as trinity-foo, agent row named foo, is scored. It fails without the fallback and passes now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
@strix-security please re-review e31b95b (task bridge now tries the |
There was a problem hiding this comment.
The changed identity handling holds up: the three name resolvers now try the canonical trinity- form first and fall back to the exact name, the passport and repid score-card surfaces return only already-public data, the LLM-completion attribution comparison fails closed on a mismatch, the new duplicate-name 409 branch runs before any write and leaves the anti-spam dedup and rate limits untouched, and the per-human name is 48 bits of CSPRNG output that is never used as a credential. The previously reported T12 task-score misattribution is fixed: pollCompletedTasks now falls back to the bare name and the new test pins that a trinity-foo task is scored to the agent now named foo. Nothing new was confirmed; the leads that were checked and rejected were the swallowed lookup error on duplicate names, resolver divergence with the untouched x402/caps/owner gates, human rows on the leaderboard, self-asserted is_human at registration, unproven wallet binding, and the unescaped agent name in the card SVG. One thing worth passing back to the author, not a security issue: the human insert never sets is_human, so the new .eq('is_human', false) leaderboard filter does not do what the description claims — its only consumer is currently unreachable, so it has no security effect today.
Reviewed by Strix
Configure security review settings
Owner action
You merge (Sean). MAJOR: it is the code half of a prod schema change and renames. Do not auto-merge.
Order:
repid_agents.agent_name, givestrinity-back only to the 12 original agents, and strips it from every other agent.Everything in this PR works both before and after the SQL runs, so step 2 can sit for as long as needed.
What changes
src/routes/repid.ts,src/routes/route.ts,src/services/agent-passport.ts: a name lookup tries thetrinity-form first, then the exact name. Until now repid/route tried only thetrinity-form, which stops finding other agents once they lose the prefix. Thetrinity-form goes first so a row holding only a bare slug likesophiacan never outrank an original (Strix finding; the passport had the reverse order before this PR).src/routes/agents-external.ts: a name another agent already has returns 409. It matches on the index name, so a duplicate wallet address is still the 500 it was.src/routes/agents.ts: each human gets its own name (human-<12 hex>) instead of every human beingHUMAN. The name is independent of the human's private id.src/analytics/agent-performance.ts: the agent leaderboard drops humans byis_human, not by the nameHUMAN. Side effect: the two human rows not namedHUMANalso leave the agent leaderboard.CLAUDE.md: what the prefix means, and that the unique index has to be checked before anyone relies on it.Checked
trinity-shofetand a plainshofetpresent, the passport forshofetis the original. It fails on the old order and passes now.tsc --noEmitclean. The 11 suites that touch these routes and the passport: 155/155 pass..in()query; that broke every test double that only mocks.eq(), so it is two.eq()lookups now.🤖 Generated with Claude Code