fix(telemetry): read each Composio app's outcome and keep links from partial checks

Greptile review: an agent's COMPOSIO_MANAGE_CONNECTIONS add gave every
requested app the same outcome, so an app that was already connected
could be counted as needs_auth, and a response with no result for an
app as succeeded. Read each app's own result with
composioAppSetupResult instead: connected is succeeded, a sign-in link
is needs_auth, and an error or a missing result is failed.

The Composio list check also emitted connection.app_linked only after
the whole batch. A later app that failed in the same check skipped the
event for apps already saved as connected, and the next check saw them
as already connected. Emit right after each committed row.

Tested: connector-telemetry unit tests (mixed per-app outcomes, error
and empty responses) and a composio-app-setup case where a later app
fails after an earlier app is saved as connected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
DottaandClaude Opus 5.5 committed 2026-11-23 10:39:49 -06:00
1 parent 4a22251d93
commit febf2b81a1
5 files changed
+64 -27

No files matched your search

@@ -352,6 +352,14 @@ const support = await getEmbeddedPostgresTestSupport();
expect(appEvents()).toEqual([]);
expect(JSON.stringify(track.mock.calls)).not.toContain("never-store-this-token");
});
it("keeps app_linked for apps saved before a later app in the same check fails", async () => {
const f = await fixture();
f.activate();
f.failToolkit("notion");
track.mockClear();
await expect(f.access.refreshComposioApps(f.connection.id, ["circleback_mcp", "notion"], f.actor)).rejects.toThrow();
expect(appEvents()).toEqual([["connection.app_linked", { provider: "composio", app: aggregatorAppTelemetrySlug("composio", "circleback_mcp") }]]);
});
it("reports a failed app request when Composio does not confirm the new account", async () => {
const f = await fixture();
f.setMutationStatus(500);