Skip to content

The open-source app everyone uses to manage agents at work

fix(connections): simplify GitHub access details (#12893)

Dotta342c01fee839
diff --git a/ui/src/pages/apps/AppDetail.test.tsx b/ui/src/pages/apps/AppDetail.test.tsx
index 5c44bd4fdc..e5c45cadfc 100644
--- a/ui/src/pages/apps/AppDetail.test.tsx
+++ b/ui/src/pages/apps/AppDetail.test.tsx
@@ -262,6 +262,36 @@ function personalGrant(overrides: Record<string, unknown> = {}) {
};
}
+function dedicatedGitHubGrant(
+ overrides: Record<string, unknown> = {},
+ githubOverrides: Record<string, unknown> = {},
+) {
+ return organizationGrant({
+ id: "grant-agent",
+ kind: "agent",
+ subjectAgentId: "agent-1",
+ subjectUserId: null,
+ isDefault: false,
+ providerTenant: {
+ github: {
+ userId: "123",
+ login: "dottabot",
+ installationCount: 1,
+ repositoryCount: 1,
+ repositorySelection: "selected",
+ installationIds: ["456"],
+ installationOwnerLogins: ["paperclipai"],
+ managementUrl: "https://github.com/settings/installations/456",
+ webhookHealth: "pending",
+ lastWebhookAt: null,
+ lastAccessRefreshAt: "2026-09-05T12:00:00.000Z",
+ ...githubOverrides,
+ },
+ },
+ ...overrides,
+ });
+}
+
function catalogEntry(overrides: Record<string, unknown> = {}) {
return {
id: "catalog-read",
@@ -1425,6 +1455,97 @@ describe("AppDetail", () => {
expect(findButton("Revoke")).toBeUndefined();
});
+ it("shows dedicated GitHub access as compact action rows and links to the agent", async () => {
+ mockParams.tab = "permissions";
+ getConnectionMock.mockResolvedValue(connection({
+ credentialPolicy: "per_agent",
+ authKind: "oauth",
+ }));
+ listConnectionGrantsMock.mockResolvedValue({
+ connection: { id: "conn-1", uid: "conn-1" },
+ grants: [dedicatedGitHubGrant()],
+ capabilities: fullCapabilities(),
+ currentUserId: "user-1",
+ members: [],
+ });
+
+ await renderAppDetail();
+
+ expect(container.querySelector('a[href="/agents/coder"]')?.textContent).toContain("Used only by Coder");
+ expect(container.textContent).toContain("Repositories");
+ expect(container.textContent).toContain("1 selected repositories");
+ expect(container.querySelector(
+ 'a[href="https://github.com/settings/installations/456"]',
+ )?.textContent).toBe("Manage repositories on GitHub");
+ expect(findButton("Refresh access")).toBeTruthy();
+ expect(container.textContent).not.toContain("Installation");
+ expect(container.textContent).not.toContain("Token continuity");
+ expect(container.textContent).not.toContain("Webhook health");
+ expect(container.textContent).not.toContain("Last event");
+ expect(container.textContent).not.toContain("Last access refresh");
+ expect(container.textContent).not.toContain("Shell Git and gh use this account");
+
+ const askFirst = container.querySelector<HTMLButtonElement>('button[aria-label="Read repo: Ask first"]');
+ expect(askFirst).toBeTruthy();
+ await act(async () => {
+ askFirst!.dispatchEvent(new MouseEvent("click", { bubbles: true }));
+ });
+ await flushReact();
+
+ expect(container.textContent).toContain(
+ "Shell Git and gh use this account for the run and are not constrained by per-tool Ask-first controls.",
+ );
+ });
+
+ it("warns about all-repository GitHub access within the repository row", async () => {
+ mockParams.tab = "permissions";
+ getConnectionMock.mockResolvedValue(connection({
+ credentialPolicy: "per_agent",
+ authKind: "oauth",
+ }));
+ listConnectionGrantsMock.mockResolvedValue({
+ connection: { id: "conn-1", uid: "conn-1" },
+ grants: [dedicatedGitHubGrant({}, {
+ repositoryCount: 0,
+ repositorySelection: "all",
+ })],
+ capabilities: fullCapabilities(),
+ currentUserId: "user-1",
+ members: [],
+ });
+
+ await renderAppDetail();
+
+ expect(container.textContent).toContain("All current and future repositories");
+ expect(container.textContent).not.toContain("selected repositories");
+ });
+
+ it.each([
+ ["mixed", "Mixed access; scope varies by installation"],
+ ["none", "No repositories selected"],
+ ] as const)("labels %s GitHub repository access explicitly", async (repositorySelection, expected) => {
+ mockParams.tab = "permissions";
+ getConnectionMock.mockResolvedValue(connection({
+ credentialPolicy: "per_agent",
+ authKind: "oauth",
+ }));
+ listConnectionGrantsMock.mockResolvedValue({
+ connection: { id: "conn-1", uid: "conn-1" },
+ grants: [dedicatedGitHubGrant({}, {
+ repositoryCount: 0,
+ repositorySelection,
+ })],
+ capabilities: fullCapabilities(),
+ currentUserId: "user-1",
+ members: [],
+ });
+
+ await renderAppDetail();
+
+ expect(container.textContent).toContain(expected);
+ expect(container.textContent).not.toContain("selected repositories");
+ });
+
it("persists an empty audience as all organization members", async () => {
mockParams.tab = "permissions";
getConnectionMock.mockResolvedValue(connection({ createdByUserId: "user-1" }));
diff --git a/ui/src/pages/apps/AppDetail.tsx b/ui/src/pages/apps/AppDetail.tsx
index 721f8af971..bde7e92ba9 100644
--- a/ui/src/pages/apps/AppDetail.tsx
+++ b/ui/src/pages/apps/AppDetail.tsx
@@ -602,6 +602,11 @@ export function AppDetail() {
askFirstIds={askFirstIds}
pending={pending}
refreshPending={refreshTools.isPending}
+ permissionChangeWarning={
+ connection.credentialPolicy === "per_agent" && managedIdentityGrant?.providerTenant?.github
+ ? "Shell Git and gh use this account for the run and are not constrained by per-tool Ask-first controls."
+ : undefined
+ }
onSaveAccess={(next) => apply({ access: accessIncludingInstalls(next, install) })}
onRefreshActions={() => refreshTools.mutate()}
onSetActionPermission={(id, next) => apply(actionPermissionMutation(id, next, enabledIds, askFirstIds))}
diff --git a/ui/src/pages/apps/app-detail/IdentitiesSection.tsx b/ui/src/pages/apps/app-detail/IdentitiesSection.tsx
index 25d8cdd2c3..2f49e0c15a 100644
--- a/ui/src/pages/apps/app-detail/IdentitiesSection.tsx
+++ b/ui/src/pages/apps/app-detail/IdentitiesSection.tsx
@@ -1,5 +1,5 @@
import { useEffect, useMemo, useState, type ReactNode } from "react";
-import { Building2, Loader2, UserRound } from "lucide-react";
+import { Building2, Loader2, TriangleAlert, UserRound } from "lucide-react";
import type {
ConnectionAudienceMember,
ConnectionGrant,
@@ -30,8 +30,9 @@ import {
AlertDialogHeader,
AlertDialogTitle,
} from "@/components/ui/alert-dialog";
-import { cn } from "@/lib/utils";
-import { brandChipBadge } from "@/lib/status-colors";
+import { Link } from "@/lib/router";
+import { brandBanner, brandChipBadge } from "@/lib/status-colors";
+import { agentUrl, cn } from "@/lib/utils";
import {
audienceUserIds,
grantAccountLabel,
@@ -98,7 +99,7 @@ export function IdentitiesSection({
credentialPolicy: ToolConnectionCredentialPolicy;
ownerUserId: string | null;
connectedUser: { label: string; image: string | null } | null;
- dedicatedAgent: { id: string; name: string } | null;
+ dedicatedAgent: { id: string; name: string; urlKey?: string | null } | null;
grantsQuery: ConnectionGrantsResponse | undefined;
loading: boolean;
error: boolean;
@@ -178,7 +179,14 @@ export function IdentitiesSection({
<IdentityRow
title={github ? `@${github.login}` : "Dedicated GitHub account"}
status={agentGrant?.status ?? null}
- detail={dedicatedAgent ? `Used only by ${dedicatedAgent.name}` : "Dedicated to one agent"}
+ detail={dedicatedAgent ? (
+ <Link
+ to={agentUrl(dedicatedAgent)}
+ className="transition-colors hover:text-foreground hover:underline"
+ >
+ Used only by {dedicatedAgent.name}
+ </Link>
+ ) : "Dedicated to one agent"}
actions={!agentGrant && dedicatedAgent && capabilities?.canConfigure ? (
<Button size="sm" disabled={connectPending} onClick={() => onConnectAgent(dedicatedAgent.id)}>
{connectPending ? <Loader2 className="mr-1.5 h-3.5 w-3.5 animate-spin" /> : null}
@@ -187,9 +195,6 @@ export function IdentitiesSection({
) : null}
/>
{github ? <GitHubConnectionSummary grant={agentGrant} onRefreshAccess={onRefreshAccess} refreshPending={refreshAccessPending} /> : null}
- <InlineBanner tone="warning" compact>
- Shell Git and gh use this account for the run and are not constrained by per-tool Ask-first controls.
- </InlineBanner>
</section>
);
}
@@ -288,27 +293,45 @@ function GitHubConnectionSummary({
}) {
const github = grant.providerTenant?.github;
if (!github) return null;
+ const repositoryWarning = github.repositorySelection === "all"
+ ? "All current and future repositories"
+ : github.repositorySelection === "mixed"
+ ? "Mixed access; scope varies by installation"
+ : null;
+ const repositorySummary = github.repositorySelection === "none"
+ ? "No repositories selected"
+ : `${github.repositoryCount} selected repositories`;
return (
- <div className="space-y-4 rounded-lg border border-border p-4">
- <div className="grid gap-3 text-sm text-muted-foreground sm:grid-cols-2">
- <p><span className="font-medium text-foreground">Installation</span><br />{github.installationOwnerLogins.join(", ") || "GitHub"}</p>
- <p><span className="font-medium text-foreground">Repositories</span><br />{github.repositoryCount} · {github.repositorySelection === "all" ? "All repositories" : "Selected repositories"}</p>
- <p><span className="font-medium text-foreground">Token continuity</span><br />{grant.providerTenant?.oauth?.accessTokenExpiresAt ? "Automatically refreshed" : "Long-lived"}</p>
- <p><span className="font-medium text-foreground">Webhook health</span><br />{github.webhookHealth === "healthy" ? "Healthy" : github.webhookHealth === "unhealthy" ? "Needs attention" : "Pending first event"}</p>
- <p><span className="font-medium text-foreground">Last event</span><br />{github.lastWebhookAt ? new Date(github.lastWebhookAt).toLocaleString() : "No event received yet"}</p>
- <p><span className="font-medium text-foreground">Last access refresh</span><br />{github.lastAccessRefreshAt ? new Date(github.lastAccessRefreshAt).toLocaleString() : "Not refreshed yet"}</p>
- </div>
- {github.repositorySelection === "all" ? (
- <InlineBanner tone="warning" compact>
- This installation can access every current and future repository in its GitHub account. Selected repositories is the safer default.
- </InlineBanner>
- ) : null}
- <div className="flex flex-wrap gap-2">
+ <div className="divide-y divide-border border-y border-border">
+ <div className="flex flex-wrap items-center justify-between gap-3 py-3">
+ <div className="min-w-0">
+ <div className="text-sm font-medium text-foreground">Repositories</div>
+ {repositoryWarning ? (
+ <div
+ role="note"
+ className={cn(
+ "mt-1 inline-flex items-center gap-1.5 rounded-md border px-2 py-1 text-xs",
+ brandBanner.warning,
+ )}
+ >
+ <TriangleAlert className="h-3.5 w-3.5 shrink-0" aria-hidden="true" />
+ {repositoryWarning}
+ </div>
+ ) : (
+ <div className="text-xs text-muted-foreground">{repositorySummary}</div>
+ )}
+ </div>
{github.managementUrl ? (
<Button asChild size="sm" variant="outline">
<a href={github.managementUrl} target="_blank" rel="noreferrer">Manage repositories on GitHub</a>
</Button>
) : null}
+ </div>
+ <div className="flex flex-wrap items-center justify-between gap-3 py-3">
+ <div className="min-w-0">
+ <div className="text-sm font-medium text-foreground">Refresh access</div>
+ <div className="text-xs text-muted-foreground">Sync repository access from GitHub.</div>
+ </div>
{onRefreshAccess ? (
<Button size="sm" variant="outline" disabled={refreshPending} onClick={onRefreshAccess}>
{refreshPending ? <Loader2 className="mr-1.5 h-3.5 w-3.5 animate-spin" /> : null}
@@ -398,7 +421,7 @@ function IdentityRow({
id?: string;
title: string;
status: ConnectionGrant["status"] | null;
- detail: string | null;
+ detail: ReactNode;
actions: ReactNode;
}) {
return (
diff --git a/ui/src/pages/apps/app-detail/PermissionsPanel.tsx b/ui/src/pages/apps/app-detail/PermissionsPanel.tsx
index a9ee49bd1d..ab26345a47 100644
--- a/ui/src/pages/apps/app-detail/PermissionsPanel.tsx
+++ b/ui/src/pages/apps/app-detail/PermissionsPanel.tsx
@@ -4,6 +4,7 @@ import type { Agent, ToolCatalogEntry, ToolConnectionCapabilities } from "@paper
import { useSearchParams } from "@/lib/router";
import { AgentIcon } from "@/components/AgentIconPicker";
import { AgentMultiSelect } from "@/components/AgentMultiSelect";
+import { InlineBanner } from "@/components/InlineBanner";
import { Button } from "@/components/ui/button";
import { Input } from "@/components/ui/input";
import { RadioCardGroup } from "@/components/ui/radio-card";
@@ -35,6 +36,7 @@ export function PermissionsPanel({
onRefreshActions,
refreshPending,
capabilities,
+ permissionChangeWarning,
}: Pick<
AppDetailSectionProps,
| "appName"
@@ -55,6 +57,7 @@ export function PermissionsPanel({
onRefreshActions: () => void;
refreshPending: boolean;
capabilities: ToolConnectionCapabilities | undefined;
+ permissionChangeWarning?: string;
}) {
const [searchParams] = useSearchParams();
return (
@@ -68,6 +71,7 @@ export function PermissionsPanel({
onSave={onSaveAccess}
/>
<ActionsSection
+ key={connectionId}
connectionId={connectionId}
appName={appName}
readOnly={readOnly}
@@ -79,6 +83,7 @@ export function PermissionsPanel({
refreshPending={refreshPending}
focusId={searchParams.get("focus")}
canConfigure={capabilities?.canConfigure ?? false}
+ permissionChangeWarning={permissionChangeWarning}
onSetPermission={onSetActionPermission}
onReviewQuarantined={onReviewQuarantined}
onRefreshActions={onRefreshActions}
@@ -197,6 +202,7 @@ function ActionsSection({
refreshPending,
focusId,
canConfigure,
+ permissionChangeWarning,
onSetPermission,
onReviewQuarantined,
onRefreshActions,
@@ -212,12 +218,14 @@ function ActionsSection({
refreshPending: boolean;
focusId?: string | null;
canConfigure: boolean;
+ permissionChangeWarning?: string;
onSetPermission: (id: string, next: ActionPermission) => void;
onReviewQuarantined: (enabledIds: string[]) => void;
onRefreshActions: () => void;
}) {
const [query, setQuery] = useState("");
const [kindFilter, setKindFilter] = useState<ActionKindFilter>("all");
+ const [showPermissionChangeWarning, setShowPermissionChangeWarning] = useState(false);
const byName = (a: ToolCatalogEntry, b: ToolCatalogEntry) =>
(a.title ?? a.toolName).localeCompare(b.title ?? b.toolName);
const sortedRead = useMemo(() => [...readOnly].sort(byName), [readOnly]);
@@ -264,6 +272,12 @@ function ActionsSection({
/>
) : null}
+ {permissionChangeWarning && showPermissionChangeWarning ? (
+ <InlineBanner tone="warning" compact>
+ {permissionChangeWarning}
+ </InlineBanner>
+ ) : null}
+
<div className="space-y-2">
<div className="flex flex-wrap items-center gap-2">
<div className="relative min-w-(--sz-12rem) flex-1">
@@ -299,7 +313,10 @@ function ActionsSection({
disabled={disabled}
focusId={focusId}
canConfigure={canConfigure}
- onSetPermission={onSetPermission}
+ onSetPermission={(id, next) => {
+ setShowPermissionChangeWarning(true);
+ onSetPermission(id, next);
+ }}
/>
<ActionGroup
title={`Write (${visibleWrite.length})`}
@@ -311,7 +328,10 @@ function ActionsSection({
disabled={disabled}
focusId={focusId}
canConfigure={canConfigure}
- onSetPermission={onSetPermission}
+ onSetPermission={(id, next) => {
+ setShowPermissionChangeWarning(true);
+ onSetPermission(id, next);
+ }}
/>
</div>
)}