Harden the seams a project sweep surfaced

A systematic review of the whole codebase (main process, renderer,
IPC/migration/packaging seams) surfaced four real defects; each is
fixed at its root:

- Legacy catalogue drift: the operator's profile still carried 89
  active skills from the removed ~/.agents import era next to the 228
  built-ins. Catalogue sync now mirrors the bundle - actives whose slug
  the bundle does not ship retire (bindings keep resolving via their
  pinned revisions; retired skills leave list_skills and cannot be
  granted anew)
- Broken-bundle guard: staging now refuses a bundle without the
  humanizer skill, so an empty or quarantined resources folder can
  never trigger the mirror pass into retiring a healthy catalogue
- Duplicate agent names: @mentions, DM routing, and task assignment all
  resolve by name, so createAgent and updateAgent renames now reject a
  name already held by an active agent (case-insensitive); the mention
  resolver still refuses to guess between legacy duplicates
- Stale DM titles: agent-to-agent conversation rows titled themselves
  from the frozen creation-time space name, so renames never reached
  the sidebar; direct titles now derive from members' current names

Verified clean in the same sweep: IPC surface (82 channels, handler +
preload + api aligned), per-migration transactions with rollback,
quota-parking month rollover, retry-budget counting, meeting spot
reuse across floor-plan rebuilds.
This commit is contained in:
ZacharyZhang-NY committed 2026-07-08 23:41:51 -04:00
1 parent c50f17190c
commit 04093c4869
8 files changed
+156 -12

No files matched your search

+26
View File
@@ -62,6 +62,32 @@ describe("identity editing", () => {
h.connection.close();
});
test("rejects renaming or hiring into an existing active agent name", () => {
const h = harness();
h.connection.transaction(() => {
h.organization.createAgent({
orgId: h.orgId, name: "Dana Lee", role: "Engineer", department: "Engineering",
modelProviderId: null, modelId: null, budgetCents: 1000, managerAgentId: h.agentId,
});
});
// Hiring a second "Dana Lee" (any case) is ambiguous for mentions and DMs.
expect(() => h.organization.createAgent({
orgId: h.orgId, name: "dana lee", role: "Designer", department: "Design",
modelProviderId: null, modelId: null, budgetCents: 1000, managerAgentId: h.agentId,
})).toThrow("already exists");
// Renaming the CEO onto that name is equally ambiguous.
expect(() => h.organization.updateAgent({
orgId: h.orgId, agentId: h.agentId, name: "Dana Lee", role: "CEO", title: "CEO",
roleLevel: "c_suite", department: "Executive", budgetCents: 25000, modelProviderId: null, modelId: null,
})).toThrow("already exists");
// Saving without changing the name stays legal.
h.connection.transaction(() => h.organization.updateAgent({
orgId: h.orgId, agentId: h.agentId, name: "CEO", role: "CEO", title: "CEO",
roleLevel: "c_suite", department: "Executive", budgetCents: 25000, modelProviderId: null, modelId: null,
}));
h.connection.close();
});
test("rejects blank names and malformed avatar colors", () => {
const h = harness();
const base = {