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:
1 parent
c50f17190c
commit
04093c4869
8 files changed
+156
-12
No files matched your search
@@ -127,12 +127,16 @@ export function buildConversations(input: {
|
||||
const items = input.spaces.map((space) => {
|
||||
const last = lastBySpace.get(space.id) ?? null;
|
||||
const isDirect = space.spaceType === "direct";
|
||||
const counterpart = isDirect
|
||||
? resolveCounterpart(membersBySpace.get(space.id) ?? [], input)
|
||||
: null;
|
||||
const members = membersBySpace.get(space.id) ?? [];
|
||||
const counterpart = isDirect ? resolveCounterpart(members, input) : null;
|
||||
// Direct titles derive from the members' CURRENT names — the space name
|
||||
// froze whatever they were called when the conversation was created, so
|
||||
// renames would otherwise never reach the sidebar.
|
||||
const liveNames = isDirect ? resolveMemberNames(members, input) : [];
|
||||
const directTitle = counterpart?.name ?? (liveNames.length > 0 ? liveNames.join(" · ") : space.name);
|
||||
return {
|
||||
space,
|
||||
title: isDirect && counterpart ? counterpart.name : space.name,
|
||||
title: isDirect ? directTitle : space.name,
|
||||
isDirect,
|
||||
counterpart,
|
||||
preview: last ? `${senderName(last, context)}: ${previewText(last)}` : null,
|
||||
@@ -143,6 +147,20 @@ export function buildConversations(input: {
|
||||
return items.sort((a, b) => b.lastActivityAt.localeCompare(a.lastActivityAt));
|
||||
}
|
||||
|
||||
/** Current display names of a space's members, in membership order. */
|
||||
function resolveMemberNames(
|
||||
members: ChatMembershipRecord[],
|
||||
input: { employees: EmployeeRecord[]; agents: AgentRecord[] },
|
||||
): string[] {
|
||||
return members
|
||||
.map((member) => {
|
||||
if (member.principalType === "agent") return input.agents.find((item) => item.id === member.principalId)?.name ?? null;
|
||||
if (member.principalType === "employee") return input.employees.find((item) => item.id === member.principalId)?.displayName ?? null;
|
||||
return null;
|
||||
})
|
||||
.filter((name): name is string => name !== null);
|
||||
}
|
||||
|
||||
/**
|
||||
* The single other party of a direct conversation, from the viewer's seat.
|
||||
* Conversations between two agents have no single counterpart for the
|
||||
|
||||
Reference in new issue
Block a user