Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/api/src/postgres/integration-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export class IntegrationService {
const connectionsPromise = this.connections.all(["linear", "clickup", "exe:", "amp:", "cloudflare-tail:"]);
const [connections, tails] = await Promise.all([connectionsPromise, this.tails(connectionsPromise)]);
const linear = connections.get("linear"), clickup = connections.get("clickup");
const exeConnections = [...connections].filter(([kind]) => kind.startsWith("exe:")).map(([kind, value]) => { const agentKind = value?.agentKind; return { connectionId: kind.slice(4), credentialStatus: "connected" as const, accountTags: tags(value?.availableTags ?? value?.tags), ...(agentKind ? { agentKind } : {}), models: (agentKind && (value?.modelsByAgent?.[agentKind] ?? value?.models)) ?? [], efforts: agentKind ? effortOptions[agentKind as keyof typeof effortOptions] ?? [] : [] }; });
const exeConnections = [...connections].filter(([kind]) => kind.startsWith("exe:")).map(([kind, value]) => { const agentKind = value?.agentKind; return { connectionId: kind.slice(4), credentialStatus: "connected" as const, accountTags: [...new Set([...tags(value?.availableTags), ...tags(value?.tags)])].sort((a, b) => a.localeCompare(b)), ...(agentKind ? { agentKind } : {}), models: (agentKind && (value?.modelsByAgent?.[agentKind] ?? value?.models)) ?? [], efforts: agentKind ? effortOptions[agentKind as keyof typeof effortOptions] ?? [] : [] }; });
const ampConnections = [...connections].filter(([kind]) => kind.startsWith("amp:")).map(([kind, value]) => ({ connectionId: kind.slice(4), project: text(value?.project) ?? "Unnamed Amp project", ...(text(value?.apiBaseUrl) ? { apiBaseUrl: text(value.apiBaseUrl) } : {}) }));
return { linear: linear ? { organizationName: text(linear.organizationName) ?? null, viewerEmail: text(linear.viewerEmail) ?? null } : null, clickup: clickup ? { teamName: text(clickup.teamName) ?? null } : null, exe: exeConnections[0] ?? null, exeConnections, ampConnections, cloudflareTail: { count: tails.length, installations: tails } };
}
Expand Down
9 changes: 9 additions & 0 deletions packages/api/test/loading-parallel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,15 @@ describe("independent loading", () => {
connections.resolve(new Map()); counts.resolve({ rows: [] });
expect(await result).toMatchObject({ exeConnections: [], ampConnections: [], cloudflareTail: { count: 0, installations: [] } });
});

it("keeps configured exe.dev tags visible when inventory refresh omits them", async () => {
vi.spyOn(ConnectionRepository.prototype, "all").mockResolvedValue(new Map([
["exe:vm", { availableTags: ["current"], tags: ["anarack", "current"], agentKind: "codex" }],
]));
vi.spyOn(IntegrationService.prototype, "tails").mockResolvedValue([]);
const result = await new IntegrationService({ pool: { query: vi.fn(async () => ({ rows: [] })) } } as any, "tenant", "key").status();
expect(result.exeConnections[0].accountTags).toEqual(["anarack", "current"]);
});
it("propagates a failed integration read without leaving an unhandled sibling promise", async () => {
vi.spyOn(ConnectionRepository.prototype, "all").mockRejectedValue(new Error("Connection read failed"));
const query = vi.fn(async () => ({ rows: [] }));
Expand Down
Loading