fix(ui): show readable connector action names in the Activity feed (#22659)

## Thinking Path

> - Paperclip is the open source app people use to manage AI agents for
work
> - Connectors let agents use outside apps, such as Google Workspace.
The company Activity page records each connector event.
> - #22630 gave Google Workspace actions readable names on the Review
and Permissions tabs.
> - The Activity page still showed internal names. A Gmail call read
"used mcp google workspace 7f3c2a10 gmail get message on". The short ID
in that text comes from the connection ID.
> - Some connector rows also showed raw event names or entity types,
such as "tool connection content deleted" or "tool_application".
> - Users must not see internal names or IDs. Google's app reviewers
will also look at this page.
> - This pull request makes these Activity rows use the same readable
action name as the other pages, and plain sentences for connection
events.
> - The benefit is that people and reviewers can read what each
connector event did.

## Linked Issues or Issue Description

Refs #22630

**What happened?**
On the company Activity page (Apps & tools filter), connector rows
showed internal names. A Google tool call read "used mcp google
workspace 7f3c2a10 gmail get message on". An app removal read "tool
application archived tool_application". Stored content deletion read
"tool connection content deletion requested". Connection removal did not
say what happened to Google access.

**Expected behavior**
Each row reads as a plain sentence. Google actions use the readable name
from the Permissions page, for example "used Gmail: Get message on the
connection". No row shows a `service__tool` name, an underscore name or
an ID in its main text.

**Steps to reproduce**
1. Connect Google Workspace and let an agent read a Gmail message.
2. Remove the connection.
3. Open Activity and pick "Apps & tools".

**Paperclip version or commit**
master at 624a78fd5d.

## What Changed

- `ui/src/lib/activity-format.ts`: tool call rows now name the action
from `upstreamToolName` first, then the gateway name without its
`mcp.<app>-<id>.` namespace. They use `googleWorkspaceToolTitle` from
`packages/shared`, the same helper as `actionLabel` on the Permissions
page. A `toolTitle` in the details wins when it is there. Other tools
keep the old readable fallback.
- New verbs for `tool_gateway.call_failed` ("could not use"),
`tool_gateway.call_deferred` ("could not finish using"),
`tool_application.archived` ("removed"),
`tool_connection.content_deletion_requested`,
`tool_connection.content_deleted`, `issue.connection_content_deleted`
and `issue.connection_content_deletion_incomplete`.
- New `formatActivityEntityLabel`: an app removal shows the app name
(for example "Google Workspace"). A connection removal with a Google
access result says "the Google Workspace connection". Other entity types
read as words ("a run", "the organization") instead of the raw type.
- New `formatActivityOutcome`: an app removal says "Its last connection
was removed."
- A connection removal or a credential revocation says what happened to
Google access. The feed uses `googleAccessRemovalNotice`, the same text
as the removal toast, for example "Paperclip's access to this Google
account was also ended at Google."
- `ui/src/pages/audit/AuditFeed.tsx`: the row uses these labels and
shows the outcome sentence under the main line.
- No API, schema or server change.

| Row | Before | After |
| --- | --- | --- |
| Tool call completed | used mcp google workspace 7f3c2a10 gmail get
message on the connection | used Gmail: Get message on the connection |
| Tool call denied | was blocked from using mcp google workspace
7f3c2a10 gmail get message on | was blocked from using Gmail: Get
message on |
| Approval requested | asked to use mcp google workspace 7f3c2a10 gmail
get message on | asked to use Gmail: Get message on |
| Tool call failed | tool gateway call failed | could not use Gmail: Get
message on (only the gateway name: could not use gmail get message on) |
| Tool call deferred | tool gateway call deferred | could not finish
using Gmail: Get message on |
| Connection removed | removed the connection | removed the Google
Workspace connection. Paperclip's access to this Google account was also
ended at Google. |
| App removed | tool application archived tool_application | removed
Google Workspace. Its last connection was removed. |
| Content deletion asked | tool connection content deletion requested
the connection | asked to delete stored content from the connection |
| Content deleted | tool connection content deleted the connection |
deleted stored content from the connection |
| Task content deleted | issue connection content deleted PAP-1 |
deleted connected app content from PAP-1 |

## Verification

- Red, then green: `ui/src/lib/activity-format.test.ts` (new "connected
app activity" tests) and `ui/src/pages/audit/AuditFeed.test.tsx` ("shows
connected Google activity as plain sentences without internal names or
IDs"). The rows use real UUIDs and a real gateway tool name. The feed
test renders 11 connector rows. It checks that the main text of each row
has no `__`, no underscore name, no UUID and no short connection ID.
- Before the fix: 7 tests failed, for example `expected 'used mcp google
workspace 7f3c2a10 gm…' to be 'used Gmail: Get message on'`.
- After the fix: `npx vitest run src/lib/activity-format.test.ts
src/pages/audit/` passes (69 tests).
- `pnpm --filter @paperclipai/ui typecheck` passes.
- `pnpm verify` selected 2,983 of 3,857 Vitest files (conservative
selection for a `ui/src/lib` change). I stopped it and use required CI
for broad coverage.

## Risks

- Low risk. Only display text in the Activity feed changes.
- The small mono action name on each row (for example
`tool_gateway.call_completed`) stays. `DESIGN.md` principle 6 says
machine values use the monospace style. Nothing marks it as a debug-only
item.
- `AuditFeed.production.tsx` (the old design snapshot that
`AgentDetail.production` uses) gets the new verbs but keeps its own
entity text. This change does not edit that snapshot.

## Model Used

- Claude Opus 5.5 (`claude-opus-5-5`), in Claude Code with tool use
(shell, file edit, test runs).

## Checklist

- [x] I have included a thinking path that traces from project context
to this change
- [x] I have specified the model used (with version and capability
details)
- [x] I have checked ROADMAP.md and confirmed this PR does not duplicate
planned core work
- [x] I have searched GitHub for duplicate or related PRs and linked
them above
- [x] I have either (a) linked existing issues with `Fixes: #` / `Closes
#` / `Refs #` OR (b) described the issue in-PR following the relevant
issue template
- [x] I have not referenced internal/instance-local Paperclip issues or
links (only public GitHub `#NNN` / `github.com/paperclipai/paperclip`
URLs)
- [x] My branch name describes the change (e.g. `docs/...`, `fix/...`)
and contains no internal Paperclip ticket id or instance-derived details
- [x] I have run tests locally and they pass
- [x] I have added or updated tests where applicable
- [x] I have updated relevant documentation to reflect my changes
- [x] I have considered and documented any risks above
- [ ] All Paperclip CI gates are green
- [ ] Greptile is 5/5 with no open P2s, recommendations, or follow-ups
- [x] I will address all Greptile and reviewer comments before
requesting merge

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
DottaandClaude Opus 5.5 authored and GitHub committed 2026-11-23 18:55:16 +00:00
1 parent fd6317de23
commit f3a5367b41
5 files changed
+223 -13

No files matched your search

@@ -16,6 +16,7 @@ const openGoogleAccountConnections: ToastAction = {
export function googleAccessRemovalNotice(
providerAccess: ManagedGoogleAccessRemoval | null | undefined,
removed: "connection" | "credentials" = "connection",
): GoogleAccessRemovalNotice | null {
if (providerAccess?.provider !== "google") return null;
if (providerAccess.result === "ended") {
@@ -36,7 +37,7 @@ export function googleAccessRemovalNotice(
}
return {
tone: "warn",
body: "Paperclip removed the connection but couldn't end its access at Google. You can remove Paperclip from your Google account's third-party connections.",
body: `Paperclip removed the ${removed} but couldn't end its access at Google. You can remove Paperclip from your Google account's third-party connections.`,
action: openGoogleAccountConnections,
};
}
+88 -1
View File
@@ -1,6 +1,11 @@
import type { Agent } from "@paperclipai/shared";
import { describe, expect, it } from "vitest";
import { formatActivityVerb, formatIssueActivityAction } from "./activity-format";
import {
formatActivityEntityLabel,
formatActivityOutcome,
formatActivityVerb,
formatIssueActivityAction,
} from "./activity-format";
describe("activity formatting", () => {
const agentMap = new Map<string, Agent>([
@@ -161,4 +166,86 @@ describe("activity formatting", () => {
"Run finished without a next step - recovery escalated",
);
});
describe("connected app activity", () => {
const connectionId = "7f3c2a10-5b4e-4d2a-9c1f-0e8d6b5a4c3d";
const gatewayName = "mcp.google-workspace-7f3c2a10:gmail-get-message";
const internalName = /__|[a-z]_[a-z]|[0-9a-f]{8}-[0-9a-f]{4}|7f3c2a10/i;
it("names Google Workspace actions with the same label as the Permissions page", () => {
const details = { tool: gatewayName, upstreamToolName: "gmail__get_message", connectionId };
expect(formatActivityVerb("tool_gateway.call_completed", details)).toBe("used Gmail: Get message on");
expect(formatActivityVerb("tool_gateway.call_completed", { ...details, source: "test" })).toBe("tested Gmail: Get message on");
expect(formatActivityVerb("tool_gateway.call_denied", details)).toBe("was blocked from using Gmail: Get message on");
expect(formatActivityVerb("tool_gateway.approval_requested", details)).toBe("asked to use Gmail: Get message on");
expect(formatActivityVerb("tool_gateway.call_completed", { ...details, toolTitle: "Read a message" }))
.toBe("used Gmail: Read a message on");
for (const action of [
"tool_gateway.call_completed", "tool_gateway.call_allowed", "tool_gateway.call_denied",
"tool_gateway.approval_requested", "tool_gateway.call_failed", "tool_gateway.call_deferred",
]) {
expect(formatActivityVerb(action, details)).not.toMatch(internalName);
}
});
it("keeps a readable name for other tools", () => {
expect(formatActivityVerb("tool_gateway.call_completed", { tool: "get_repository" })).toBe("used get repository on");
expect(formatActivityVerb("tool_gateway.call_completed", { tool: "create_issue", toolTitle: "Create issue" }))
.toBe("used Create issue on");
expect(formatActivityVerb("tool_gateway.call_denied", {})).toBe("was blocked from using an app action on");
});
it("describes failed and delayed calls in words", () => {
const details = { upstreamToolName: "calendar__list_events" };
expect(formatActivityVerb("tool_gateway.call_failed", details)).toBe("could not use Calendar: List events on");
expect(formatActivityVerb("tool_gateway.call_deferred", details)).toBe("could not finish using Calendar: List events on");
expect(formatActivityVerb("tool_gateway.call_deferred", { ...details, source: "test" })).toBe("could not finish testing Calendar: List events on");
});
it("drops the connection namespace when a row has only the gateway tool name", () => {
const verb = formatActivityVerb("tool_gateway.call_failed", { tool: gatewayName, connectionId });
expect(verb).toBe("could not use gmail get message on");
expect(verb).not.toMatch(internalName);
});
it("drops the length-bound hash from a long gateway tool name", () => {
const verb = formatActivityVerb("tool_gateway.call_failed", {
tool: "mcp.app-gallery-github-connection:create-repository-0123456789abcdef",
connectionId,
});
expect(verb).toBe("could not use create repository on");
});
it("names a Google connection when its removal reports Google access", () => {
const providerAccess = { provider: "google", result: "ended", outcomes: [] };
expect(formatActivityVerb("tool_connection.archived", { transport: "remote_http", providerAccess })).toBe("removed");
expect(formatActivityEntityLabel("tool_connection", { providerAccess })).toBe("the Google Workspace connection");
expect(formatActivityEntityLabel("tool_connection", { transport: "remote_http" })).toBe("the connection");
expect(formatActivityOutcome("tool_connection.archived", { providerAccess })).toBeNull();
});
it("reads app removal as a sentence with the app's name", () => {
const details = { type: "mcp", name: "Google Workspace", reason: "last_connection_removed" };
expect(formatActivityVerb("tool_application.archived", details)).toBe("removed");
expect(formatActivityEntityLabel("tool_application", details)).toBe("Google Workspace");
expect(formatActivityOutcome("tool_application.archived", details)).toBe("Its last connection was removed.");
expect(formatActivityEntityLabel("tool_application", {})).toBe("the app");
expect(formatActivityEntityLabel("heartbeat_run", {})).toBe("a run");
expect(formatActivityEntityLabel("company", {})).toBe("the organization");
});
it("describes stored content deletion in words", () => {
expect(formatActivityVerb("tool_connection.content_deletion_requested")).toBe("asked to delete stored content from");
expect(formatActivityVerb("tool_connection.content_deleted")).toBe("deleted stored content from");
expect(formatActivityVerb("issue.connection_content_deleted")).toBe("deleted connected app content from");
expect(formatActivityVerb("issue.connection_content_deletion_incomplete")).toBe("partly deleted connected app content from");
expect(formatIssueActivityAction("issue.connection_content_deleted")).toBe("deleted connected app content");
expect(formatIssueActivityAction("issue.connection_content_deletion_incomplete"))
.toBe("partly deleted connected app content; some is still in use");
});
it("reads connect and reconnect rows without internal names", () => {
expect(formatActivityVerb("tool_app.connected", { galleryKey: "google_workspace", applicationId: connectionId })).toBe("connected");
expect(formatActivityVerb("tool_app.reconnected", { healthStatus: "healthy" })).toBe("reconnected");
});
});
});
+54 -7
View File
@@ -1,4 +1,4 @@
import type { Agent } from "@paperclipai/shared";
import { googleWorkspaceToolTitle, type Agent } from "@paperclipai/shared";
import type { CompanyUserProfile } from "./company-members";
import { formatReviewPolicyValue } from "./review-policy";
@@ -132,6 +132,7 @@ const ACTIVITY_ROW_VERBS: Record<string, string> = {
"tool_app.oauth_access_finalized": "finished credential access for",
"tool_app.finished": "finished setup for",
"tool_app.reconnected": "reconnected",
"tool_application.archived": "removed",
"tool_connection.created": "created",
"tool_connection.updated": "updated",
"tool_connection.archived": "removed",
@@ -143,6 +144,10 @@ const ACTIVITY_ROW_VERBS: Record<string, string> = {
"tool_connection.grant_revoked": "revoked credentials from",
"tool_connection.grant_delegated": "delegated credentials for",
"tool_connection.grant_delegation_revoked": "revoked credential delegation for",
"tool_connection.content_deletion_requested": "asked to delete stored content from",
"tool_connection.content_deleted": "deleted stored content from",
"issue.connection_content_deleted": "deleted connected app content from",
"issue.connection_content_deletion_incomplete": "partly deleted connected app content from",
};
const ISSUE_ACTIVITY_LABELS: Record<string, string> = {
@@ -212,8 +217,53 @@ const ISSUE_ACTIVITY_LABELS: Record<string, string> = {
"issue.thread_interaction_expired": "expired the request",
"issue.thread_interaction_item_verdicts_submitted": "submitted verdicts on the request",
"issue.stalled_review_decided": "recorded a review verdict",
"issue.connection_content_deleted": "deleted connected app content",
"issue.connection_content_deletion_incomplete": "partly deleted connected app content; some is still in use",
};
const ENTITY_LABELS: Record<string, string> = {
company: "the organization",
agent: "an agent",
goal: "a goal",
project: "a project",
routine: "a routine",
heartbeat_run: "a run",
approval: "an approval",
tool_connection: "the connection",
tool_application: "the app",
};
function readText(value: unknown): string | null {
return typeof value === "string" && value.trim() ? value.trim() : null;
}
function googleProviderAccessResult(details: ActivityDetails): string | null {
const access = asRecord(details?.providerAccess);
return access?.provider === "google" ? readText(access.result) : null;
}
function formatToolLabel(details: ActivityDetails): string {
const name = readText(details?.upstreamToolName)
?? readText(details?.tool)?.replace(/^(?:mcp|app)\.[^:]*:|^(?:mcp|app)\.[a-z0-9-]*-[0-9a-f]{8}\./, "").replace(/-[0-9a-f]{16}$/, "");
const title = readText(details?.toolTitle);
if (!name) return title ?? "an app action";
return googleWorkspaceToolTitle(name, title) ?? name.replace(/[._-]+/g, " ");
}
export function formatActivityEntityLabel(entityType: string, details?: Record<string, unknown> | null): string {
const name = readText(details?.name);
if (entityType === "tool_application" && name) return name;
if (entityType === "tool_connection" && googleProviderAccessResult(details)) return "the Google Workspace connection";
return ENTITY_LABELS[entityType] ?? entityType.replace(/[._]+/g, " ");
}
export function formatActivityOutcome(action: string, details?: Record<string, unknown> | null): string | null {
if (action === "tool_application.archived" && details?.reason === "last_connection_removed") {
return "Its last connection was removed.";
}
return null;
}
/**
* `issue.stalled_review_decided` carries the verb the actor chose, so the line
* names the verdict ("approved the review") rather than the generic action.
@@ -471,17 +521,14 @@ export function formatActivityVerb(
options: ActivityFormatOptions = {},
): string {
if (action.startsWith("tool_gateway.")) {
const rawTool = typeof details?.tool === "string"
? details.tool
: typeof details?.upstreamToolName === "string"
? details.upstreamToolName
: "an app action";
const tool = rawTool.replace(/[._-]+/g, " ");
const tool = formatToolLabel(details);
const isTest = details?.source === "test";
if (action === "tool_gateway.call_completed") return `${isTest ? "tested" : "used"} ${tool} on`;
if (action === "tool_gateway.call_allowed") return `${isTest ? "started a test of" : "was allowed to use"} ${tool} on`;
if (action === "tool_gateway.call_denied") return `was blocked from using ${tool} on`;
if (action === "tool_gateway.approval_requested") return `asked to use ${tool} on`;
if (action === "tool_gateway.call_failed") return `could not ${isTest ? "test" : "use"} ${tool} on`;
if (action === "tool_gateway.call_deferred") return `could not finish ${isTest ? "testing" : "using"} ${tool} on`;
if (action === "tool_gateway.session_created") return "opened an app session for";
if (action === "tool_gateway.session_rejected") return "was blocked from opening an app session for";
if (action === "tool_gateway.discovery") return "discovered app actions for";
+62
View File
@@ -246,6 +246,68 @@ describe("AuditFeed", () => {
expect(container.textContent).toContain("tool_gateway.call_completed");
});
it("shows connected Google activity as plain sentences without internal names or IDs", async () => {
const connectionId = "7f3c2a10-5b4e-4d2a-9c1f-0e8d6b5a4c3d";
const applicationId = "1b2c3d4e-5f60-4718-8293-a4b5c6d7e8f9";
const google = { tool: "mcp.google-workspace-7f3c2a10:gmail-get-message", upstreamToolName: "gmail__get_message", connectionId, applicationId };
const providerAccess = { provider: "google", result: "ended", outcomes: ["revoked"] };
const row = (id: string, overrides: Record<string, unknown>) => record({
id, actorType: "user", actorId: "user-1", agentId: null, runId: null, responsibleUserId: null,
entityType: "tool_connection", entityId: connectionId,
entity: { issue: null, comment: null, document: null }, ...overrides,
});
listAgentActionsMock.mockResolvedValue({
items: [
row("evt-used", { actorType: "agent", actorId: "agent-1", agentId: "agent-1", action: "tool_gateway.call_completed", entityType: "agent", entityId: "agent-1", details: google }),
row("evt-denied", { actorType: "agent", actorId: "agent-1", agentId: "agent-1", action: "tool_gateway.call_denied", entityType: "agent", entityId: "agent-1", details: { ...google, decision: "deny", reasonCode: "policy_denied" } }),
row("evt-held", { actorType: "agent", actorId: "agent-1", agentId: "agent-1", action: "tool_gateway.approval_requested", entityType: "agent", entityId: "agent-1", details: { ...google, decision: "require_approval" } }),
row("evt-connected", { action: "tool_app.connected", details: { galleryKey: "google_workspace", applicationId } }),
row("evt-reconnected", { action: "tool_app.reconnected", details: { healthStatus: "healthy" } }),
row("evt-removed", { action: "tool_connection.archived", details: { transport: "remote_http", grantsRevoked: 1, providerAccess } }),
row("evt-app-removed", { action: "tool_application.archived", entityType: "tool_application", entityId: applicationId, details: { type: "mcp", name: "Google Workspace", reason: "last_connection_removed" } }),
row("evt-content-requested", { action: "tool_connection.content_deletion_requested", details: { toolCalls: 3 } }),
row("evt-content-deleted", { actorType: "system", actorId: null, action: "tool_connection.content_deleted", details: { toolCalls: 3 } }),
row("evt-failed", { actorType: "agent", actorId: "agent-1", agentId: "agent-1", action: "tool_gateway.call_failed", entityType: "agent", entityId: "agent-1", details: { tool: google.tool, connectionId, reasonCode: "prompt_injection_blocked" } }),
row("evt-credential-revoked", { action: "tool_connection.grant_revoked", details: { connectionId, kind: "oauth", providerAccess: { provider: "google", result: "not_ended", outcomes: ["broker_error"] } } }),
],
nextCursor: null,
accessTier: "full",
});
await render({ actionDomain: "tool_" });
const rows = Array.from(container.querySelectorAll('ul[aria-label="Audit activity"] > li'));
expect(rows).toHaveLength(11);
const primary = rows.map((li) => {
const copy = li.cloneNode(true) as HTMLElement;
copy.querySelectorAll(".font-mono, time").forEach((node) => node.remove());
const walker = document.createTreeWalker(copy, NodeFilter.SHOW_TEXT);
const parts: string[] = [];
while (walker.nextNode()) parts.push(walker.currentNode.textContent ?? "");
return parts.join(" ").replace(/\s+/g, " ");
});
for (const text of primary) {
expect(text).not.toMatch(/__|[a-z]_[a-z]|[0-9a-f]{8}-[0-9a-f]{4}|7f3c2a10/i);
}
expect(primary[0]).toContain("used Gmail: Get message on");
expect(primary[1]).toContain("was blocked from using Gmail: Get message on");
expect(primary[2]).toContain("asked to use Gmail: Get message on");
expect(primary[3]).toContain("connected the connection");
expect(primary[4]).toContain("reconnected the connection");
expect(primary[5]).toContain("removed the Google Workspace connection");
expect(primary[5]).toContain("Paperclip's access to this Google account was also ended at Google.");
expect(primary[6]).toContain("removed Google Workspace");
expect(primary[6]).toContain("Its last connection was removed.");
expect(primary[7]).toContain("asked to delete stored content from the connection");
expect(primary[8]).toContain("deleted stored content from the connection");
expect(primary[9]).toContain("could not use gmail get message on the connection");
expect(primary[10]).toContain("revoked credentials from the Google Workspace connection");
expect(primary[10]).toContain("couldn't end its access at Google");
expect(primary[10]).toContain("Paperclip removed the credentials");
expect(primary[10]).not.toContain("removed the connection but");
expect(rows[0].textContent).toContain("tool_gateway.call_completed");
});
it("shows case history with case links and the acting agent's avatar", async () => {
listAgentActionsMock.mockResolvedValue({
items: [record({
+17 -4
View File
@@ -2,7 +2,7 @@ import { AgentAvatar } from "@/components/AgentAvatar";
import { useEffect, useMemo, useState } from "react";
import { useInfiniteQuery, useQuery } from "@tanstack/react-query";
import { Download, ScrollText, ShieldAlert } from "lucide-react";
import type { Agent, CaseWorkflowTransition } from "@paperclipai/shared";
import type { Agent, CaseWorkflowTransition, ManagedGoogleAccessRemoval } from "@paperclipai/shared";
import { Link, useCaseHref } from "@/lib/router";
import { Button } from "@/components/ui/button";
import { Card, CardContent } from "@/components/ui/card";
@@ -18,7 +18,7 @@ import { Tabs, TabsList, TabsTrigger } from "@/components/ui/tabs";
import { Identity } from "@/components/Identity";
import { cn, relativeTime } from "@/lib/utils";
import { queryKeys } from "@/lib/queryKeys";
import { formatActivityVerb } from "@/lib/activity-format";
import { formatActivityEntityLabel, formatActivityOutcome, formatActivityVerb } from "@/lib/activity-format";
import { buildCompanyUserProfileMap, type CompanyUserProfile } from "@/lib/company-members";
import { auditApi, type AuditActionRecord, type AuditActionFilters } from "@/api/audit";
import { agentsApi } from "@/api/agents";
@@ -28,6 +28,7 @@ import { describeError } from "@/api/errors";
import { QueryErrorState, useQueryView } from "@/components/QueryView";
import { useToastActions } from "@/context/ToastContext";
import { instanceSettingsApi } from "@/api/instanceSettings";
import { googleAccessRemovalNotice } from "@/features/connections/googleAccessRemoval";
const PAGE_SIZE = 50;
const ALL = "__all";
@@ -200,12 +201,22 @@ function AuditEntityNode({ record }: { record: AuditActionRecord }) {
if (connectionId) {
return (
<Link to={`/apps/${connectionId}/permissions`} className="font-medium text-primary hover:underline">
the connection
{formatActivityEntityLabel("tool_connection", record.details)}
</Link>
);
}
// Non-linkable entities (company, agent, goal, …) — show a plain descriptor.
return <span className="text-muted-foreground">{record.entityType}</span>;
return <span className="text-muted-foreground">{formatActivityEntityLabel(record.entityType, record.details)}</span>;
}
function auditOutcome(record: AuditActionRecord): string | null {
if (record.action === "tool_connection.archived" || record.action === "tool_connection.grant_revoked") {
return googleAccessRemovalNotice(
record.details?.providerAccess as ManagedGoogleAccessRemoval | undefined,
record.action === "tool_connection.grant_revoked" ? "credentials" : "connection",
)?.body ?? null;
}
return formatActivityOutcome(record.action, record.details);
}
function AuditRow({
@@ -220,6 +231,7 @@ function AuditRow({
casesEnabled: boolean;
}) {
const verb = formatActivityVerb(record.action, record.details, { agentMap, userProfileMap });
const outcome = auditOutcome(record);
const responsible = record.responsibleUserId ? userProfileMap.get(record.responsibleUserId) : null;
// Suppress the "on behalf of" chip when the human actor *is* the responsible user.
const showOnBehalf = Boolean(
@@ -242,6 +254,7 @@ function AuditRow({
<span className="text-muted-foreground">{verb}</span>
<AuditEntityNode record={record} />
</div>
{outcome ? <p className="text-muted-foreground">{outcome}</p> : null}
{excerpt ? (
<p className="line-clamp-2 border-l-2 border-border pl-2 text-muted-foreground">
“{excerpt}”