diff --git a/doc/connections/GITHUB.md b/doc/connections/GITHUB.md index 90f206b0a17..9718e709f8b 100644 --- a/doc/connections/GITHUB.md +++ b/doc/connections/GITHUB.md @@ -131,10 +131,20 @@ installation-health failure, not as token expiry. ## Repository access GitHub can return `403 Resource not accessible by integration` inside an MCP tool -error even when the connection itself is healthy. A failed tool approval shows +error even when the connection itself is healthy. When the target repository belongs +to an account or organization where the Paperclip GitHub App is installed (or the +connected user's own personal account), a failed tool approval shows **GitHub access needed** and **Manage GitHub access**, which opens that connection's Permissions page. Check the connected account and the App's access to the intended -account and repository there. The original provider error remains in the action's +account and repository there. When a managed GitHub App write targets an external +organization or account outside the App's installations, Paperclip blocks approval +cards before asking the user to approve a doomed write and classifies runtime +integration `403` denials as `github_repo_outside_app_installations` instead of +`github_access_denied`. Failed cards and agent continuation instructions explain +that refreshing access cannot grant write permission to external repositories where +the App is not installed, and advise posting directly on GitHub, using a personal +access token connection, or having an organization administrator install the App. +The original provider error remains in the action's error details and diagnostic record. Paperclip does not replay the write or hide other working tools. Saved GitHub approval errors receive the same presentation. The agent's continuation wake carries server-written next steps and tells it diff --git a/server/src/__tests__/tool-gateway-service.test.ts b/server/src/__tests__/tool-gateway-service.test.ts index 396392a861d..2514f0f122c 100644 --- a/server/src/__tests__/tool-gateway-service.test.ts +++ b/server/src/__tests__/tool-gateway-service.test.ts @@ -2057,6 +2057,7 @@ describeEmbeddedPostgres("tool gateway service", () => { it.each([ { method: "managed", errorCode: "github_access_denied", sourceKey: "github" }, + { method: "managed", errorCode: "github_repo_outside_app_installations", sourceKey: "github" }, { method: "mcp-key", errorCode: "github_access_denied", sourceKey: "github" }, { method: "foreign", errorCode: "github_access_denied", sourceKey: "github" }, { method: "managed", errorCode: "tool_error", sourceKey: "github" }, @@ -2100,21 +2101,28 @@ describeEmbeddedPostgres("tool gateway service", () => { const payload = wakeup.mock.calls[0][1].payload; const instructions: string = payload.toolAction.instructions; // Retrying or re-approving hits the same GitHub refusal. - const trustedGitHubDenial = errorCode === "github_access_denied" || (sourceKey === "github" && method !== "foreign"); - expect(instructions).toMatch(trustedGitHubDenial ? /do not retry.*until GitHub access is repaired/i : /did not complete successfully/); - // Concrete next step the agent can relay to the user. - if (!trustedGitHubDenial) { - expect(instructions).not.toMatch(/GitHub App|Refresh access|replace.*token/); - } else if (method === "managed") { - expect(instructions).toContain("github.com/new"); - expect(instructions).toMatch(/Refresh access/); - } else if (method === "mcp-key") { - expect(instructions).toMatch(/token.*permissions/i); - expect(instructions).toMatch(/replace.*token/i); - expect(instructions).not.toMatch(/GitHub App|Refresh access/); + const outsideApp = errorCode === "github_repo_outside_app_installations"; + const trustedGitHubDenial = outsideApp || errorCode === "github_access_denied" || (sourceKey === "github" && method !== "foreign"); + if (outsideApp) { + expect(instructions).toMatch(/do not retry/i); + expect(instructions).toMatch(/not installed/i); + expect(instructions).not.toMatch(/select Refresh access|Add More Repos on GitHub/i); } else { - expect(instructions).toMatch(/authentication method/); - expect(instructions).not.toMatch(/GitHub App|Refresh access/); + expect(instructions).toMatch(trustedGitHubDenial ? /do not retry.*until GitHub access is repaired/i : /did not complete successfully/); + // Concrete next step the agent can relay to the user. + if (!trustedGitHubDenial) { + expect(instructions).not.toMatch(/GitHub App|Refresh access|replace.*token/); + } else if (method === "managed") { + expect(instructions).toContain("github.com/new"); + expect(instructions).toMatch(/Refresh access/); + } else if (method === "mcp-key") { + expect(instructions).toMatch(/token.*permissions/i); + expect(instructions).toMatch(/replace.*token/i); + expect(instructions).not.toMatch(/GitHub App|Refresh access/); + } else { + expect(instructions).toMatch(/authentication method/); + expect(instructions).not.toMatch(/GitHub App|Refresh access/); + } } expect(payload.paperclipAgentMessage.text).toContain(instructions); // Provider text stays in the untrusted result, not in trusted instructions. diff --git a/server/src/__tests__/tool-gateway.test.ts b/server/src/__tests__/tool-gateway.test.ts index f5a4342cf3b..072ae189b28 100644 --- a/server/src/__tests__/tool-gateway.test.ts +++ b/server/src/__tests__/tool-gateway.test.ts @@ -898,6 +898,181 @@ describeEmbeddedPostgres("tool gateway acceptance", () => { } finally { await remote.close(); } }); + it("blocks approval cards for managed GitHub writes outside installed orgs and distinguishes external-org vs installed-org 403s", async () => { + const company = await createCompany(db); + const agent = await createAgent(db, company.id); + const { run } = await createIssueAndRun(db, company.id, agent.id); + const remote = await startFakeRemoteMcpServer(({ body }) => { + const args = (body?.params as { arguments?: { owner?: string; repo?: string; issueRef?: string } } | undefined)?.arguments; + const owner = args?.owner ?? (args?.issueRef === "external-org-issue-42" ? "external-org" : "unknown"); + const repo = args?.repo ?? (args?.issueRef === "external-org-issue-42" ? "public-repo" : "unknown"); + const url = `https://api.github.com/repos/${owner}/${repo}/issues`; + return { body: { + jsonrpc: "2.0", id: body?.id, result: { + content: [{ type: "text", text: `failed to create issue: POST ${url}: 403 Resource not accessible by integration []` }], + isError: true, + }, + } }; + }); + try { + const { application, connection, catalogEntry } = await createRemoteMcpTool(db, company.id, { + url: remote.url, applicationKey: "github", toolName: "create_issue", riskLevel: "write", + connectionConfig: { sourceTemplateKey: "github", connectionMethodKey: "managed" }, + }); + await db.update(toolCatalogEntries).set({ inputSchema: { + type: "object", + properties: { owner: { type: "string" }, repo: { type: "string" }, title: { type: "string" }, issueRef: { type: "string" } }, + required: ["title"], + additionalProperties: false, + } }).where(eq(toolCatalogEntries.id, catalogEntry.id)); + await db.update(connectionGrants).set({ + providerTenant: { + github: { + userId: "1", + login: "octocat", + installationCount: 1, + repositoryCount: 1, + repositorySelection: "selected", + installationIds: ["9"], + installationOwnerLogins: ["acme"], + repositories: [{ id: "10", fullName: "acme/site", installationId: "9" }], + }, + }, + }).where(eq(connectionGrants.connectionId, connection.id)); + const toolName = expectedConnectedToolName({ + applicationKey: application.applicationKey, + connectionId: connection.id, + toolName: catalogEntry.toolName, + }); + await allowToolsForAgent(db, company.id, agent.id, [toolName]); + await db.insert(toolPolicies).values({ + companyId: company.id, + name: "Review GitHub writes", + policyType: "require_approval", + selectors: { connectionId: connection.id }, + priority: 10, + }); + const gateway = createTestToolGatewayService(db); + const session = await gateway.createSession({ companyId: company.id, agentId: agent.id, runId: run.id }); + + // 1. Pre-check before posting an approval card: external org fails cleanly without wasting an approval. + const precheckError = await gateway.executeTool({ + sessionToken: session.token, + tool: toolName, + parameters: { owner: "external-org", repo: "public-repo", title: "Bug report" }, + }).catch((err) => err); + expect(precheckError).toMatchObject({ reasonCode: "github_repo_outside_app_installations" }); + expect(precheckError.message).toMatch(/not installed/i); + expect(precheckError.message).not.toMatch(/select Refresh access|Add More Repos on GitHub/i); + expect(remote.requests).toHaveLength(0); + expect(await db.select().from(toolActionRequests).where(eq(toolActionRequests.companyId, company.id))).toHaveLength(0); + expect(await db.select().from(issueThreadInteractions).where(eq(issueThreadInteractions.companyId, company.id))).toHaveLength(0); + + // 2. Installed org missing a repo grant STILL creates an approval card and classifies 403 as github_access_denied. + const installedOrgParams = { owner: "acme", repo: "unselected-repo", title: "Internal issue" }; + await expect(gateway.executeTool({ + sessionToken: session.token, + tool: toolName, + parameters: installedOrgParams, + })).rejects.toMatchObject({ reasonCode: "approval_required" }); + const [installedAction] = await db.select().from(toolActionRequests).where(eq(toolActionRequests.companyId, company.id)); + expect(installedAction).toBeDefined(); + await db.update(issueThreadInteractions).set({ status: "accepted", resolvedAt: new Date() }) + .where(eq(issueThreadInteractions.id, installedAction!.interactionId!)); + await db.update(toolActionRequests).set({ status: "approved", resolvedAt: new Date() }) + .where(eq(toolActionRequests.id, installedAction!.id)); + const installedFailure = await gateway.executeTool({ + sessionToken: session.token, + tool: toolName, + parameters: installedOrgParams, + approvedActionRequestId: installedAction!.id, + }).catch((err) => err); + expect(installedFailure).toMatchObject({ reasonCode: "github_access_denied" }); + expect(installedFailure.message).toContain("Refresh access"); + const [installedCard] = await db.select().from(issueThreadInteractions) + .where(eq(issueThreadInteractions.id, installedAction!.interactionId!)); + expect(installedCard!.result).toMatchObject({ toolAction: { status: "failed", errorCode: "github_access_denied" } }); + + // 3. Direct runtime 403 on an external org (e.g. without require_approval policy) classifies as github_repo_outside_app_installations + // for both direct gateway execution and MCP HTTP protocol callers. + await db.delete(toolPolicies).where(eq(toolPolicies.companyId, company.id)); + const directExternalFailure = await gateway.executeTool({ + sessionToken: session.token, + tool: toolName, + parameters: { owner: "external-org", repo: "public-repo", title: "Direct bug" }, + }).catch((err) => err); + expect(directExternalFailure).toMatchObject({ reasonCode: "github_repo_outside_app_installations" }); + expect(directExternalFailure.message).toMatch(/not installed/i); + expect(directExternalFailure.message).not.toMatch(/select Refresh access|Add More Repos on GitHub/i); + + const profile = await allowToolsForAgent(db, company.id, agent.id, [toolName]); + const named = await gateway.createNamedGateway({ companyId: company.id, + body: { name: "GitHub external org", profileId: profile.id } }); + const token = await gateway.createNamedGatewayToken({ companyId: company.id, gatewayId: named.id, + body: { name: "Test", clientLabel: "Test", ownerNote: "" } }); + const mcpResponse = await request(createGatewayRouteApp(db, gateway)).post(named.endpointPath) + .set("authorization", `Bearer ${token.token}`) + .send({ jsonrpc: "2.0", id: 1, method: "tools/call", params: { name: toolName, arguments: { owner: "external-org", repo: "public-repo", title: "MCP bug" } } }) + .expect(200); + expect(mcpResponse.body.result.isError).toBe(true); + expect(mcpResponse.body.result.content[0].text).toMatch(/not installed/i); + expect(mcpResponse.body.result.content[0].text).not.toMatch(/select Refresh access|Add More Repos on GitHub/i); + + // 4. If an approval card executes when the target owner only becomes visible in GitHub's 403 URL, + // approveActionRequest classifies and persists github_repo_outside_app_installations onto the card. + await db.insert(toolPolicies).values({ + companyId: company.id, + name: "Review GitHub writes again", + policyType: "require_approval", + selectors: { connectionId: connection.id }, + priority: 10, + }); + await expect(gateway.executeTool({ + sessionToken: session.token, + tool: toolName, + parameters: { title: "Opaque ref bug", issueRef: "external-org-issue-42" }, + })).rejects.toMatchObject({ reasonCode: "approval_required" }); + const actionsBeforeRefresh = await db.select().from(toolActionRequests).where(eq(toolActionRequests.companyId, company.id)); + const externalAction = actionsBeforeRefresh.find((row) => row.id !== installedAction!.id); + expect(externalAction).toBeDefined(); + await expect(gateway.approveActionRequest({ + companyId: company.id, + actionRequestId: externalAction!.id, + actor: { userId: "reviewer" }, + })).resolves.toMatchObject({ status: "failed" }); + const [externalCard] = await db.select().from(issueThreadInteractions) + .where(eq(issueThreadInteractions.id, externalAction!.interactionId!)); + expect(externalCard!.result).toMatchObject({ + toolAction: { status: "failed", errorCode: "github_repo_outside_app_installations" }, + }); + + // 5. After an org admin installs the App on external-org and access refreshes, retrying the previously + // pre-checked write posts an approval card cleanly (no stale idempotency replay from step 1). + await db.update(connectionGrants).set({ + providerTenant: { + github: { + userId: "1", + login: "octocat", + installationCount: 2, + repositoryCount: 2, + repositorySelection: "selected", + installationIds: ["9", "11"], + installationOwnerLogins: ["acme", "external-org"], + repositories: [ + { id: "10", fullName: "acme/site", installationId: "9" }, + { id: "12", fullName: "external-org/public-repo", installationId: "11" }, + ], + }, + }, + }).where(eq(connectionGrants.connectionId, connection.id)); + await expect(gateway.executeTool({ + sessionToken: session.token, + tool: toolName, + parameters: { owner: "external-org", repo: "public-repo", title: "Bug report" }, + })).rejects.toMatchObject({ reasonCode: "approval_required" }); + } finally { await remote.close(); } + }); + it("returns a JSON-RPC reconciliation error instead of repeating an unverifiable legacy write", async () => { const company = await createCompany(db); const remote = await startFakeRemoteMcpServer(({ body }) => ({ diff --git a/server/src/routes/tool-gateway.ts b/server/src/routes/tool-gateway.ts index f4853ed5254..51a5adad273 100644 --- a/server/src/routes/tool-gateway.ts +++ b/server/src/routes/tool-gateway.ts @@ -15,6 +15,7 @@ import { } from "@paperclipai/shared/validators/tool-access"; import { assertBoard, assertBoardOrAgent, assertCompanyAccess, getActorInfo } from "./authz.js"; import { ToolGatewayHttpError, type ToolGatewayService } from "../services/tool-gateway.js"; +import { isGitHubAccessErrorCode } from "../services/tool-access/github-access-errors.js"; import { forbidden, HttpError } from "../errors.js"; import { accessService } from "../services/index.js"; import { authorizationDeniedDetails } from "../services/authorization.js"; @@ -246,7 +247,7 @@ async function handleMcpGatewayProtocol( // Provider tool failures are MCP tool results, not successful calls or // protocol errors. The service has already recorded the failed invocation. if (req.body?.method === "tools/call" && - (err.reasonCode === "tool_error" || err.reasonCode === "github_access_denied")) { + (err.reasonCode === "tool_error" || isGitHubAccessErrorCode(err.reasonCode))) { res.json({ jsonrpc: "2.0", id, diff --git a/server/src/services/agent-task-run-telemetry.ts b/server/src/services/agent-task-run-telemetry.ts index eb75de4fec0..c4d97cd283e 100644 --- a/server/src/services/agent-task-run-telemetry.ts +++ b/server/src/services/agent-task-run-telemetry.ts @@ -53,6 +53,7 @@ const FAILURE_CAUSE_BY_ERROR_CODE: Record = { user_secret_definition_missing: "missing_access", user_secret_definition_inactive: "missing_access", github_access_denied: "missing_access", + github_repo_outside_app_installations: "missing_access", github_repo_not_accessible: "missing_access", github_auth_required: "missing_access", project_access_denied: "missing_access", diff --git a/server/src/services/continuation-cause.ts b/server/src/services/continuation-cause.ts index f9ffd23c748..8a87a06dbb3 100644 --- a/server/src/services/continuation-cause.ts +++ b/server/src/services/continuation-cause.ts @@ -16,7 +16,7 @@ export const PERSON_OWNED_FAILURE_CODES = [ // A credential, secret or access the person must share. "configuration_incomplete", "slack_configuration_incomplete", "signing_secret_unconfigured", "user_secret_missing", "user_secret_definition_missing", "user_secret_definition_inactive", - "github_access_denied", "github_repo_not_accessible", "github_auth_required", "project_access_denied", + "github_access_denied", "github_repo_outside_app_installations", "github_repo_not_accessible", "github_auth_required", "project_access_denied", "permission_denied", "responsible_user_unauthorized", "oauth_access_projection_disabled", "acpx_auth_required", "codex_auth_required", "claude_auth_required", "provider_auth_failed", "hermes_gateway_auth_failed", // A configuration choice the person must change. diff --git a/server/src/services/tool-access/github-access-errors.test.ts b/server/src/services/tool-access/github-access-errors.test.ts index 60bf7b42f58..09f78153ad5 100644 --- a/server/src/services/tool-access/github-access-errors.test.ts +++ b/server/src/services/tool-access/github-access-errors.test.ts @@ -1,5 +1,11 @@ import { describe, expect, it } from "vitest"; -import { githubAccessDeniedInstructions, githubAccessError, projectGitHubActionResult } from "./github-access-errors.js"; +import { + findUnreachableManagedGitHubTarget, + githubAccessDeniedInstructions, + githubAccessError, + githubAccessErrorInstructions, + projectGitHubActionResult, +} from "./github-access-errors.js"; describe("GitHub tool access failures", () => { it.each(["integration", "personal access token"])("classifies GitHub's %s permission denial", kind => { @@ -59,4 +65,156 @@ describe("GitHub tool access failures", () => { expect(unknown).toMatch(/authentication method/); expect(unknown).not.toMatch(/GitHub App|Refresh access/); }); + + it("classifies 403 denials on external orgs outside managed GitHub App installations separately from installed-org denials", () => { + const githubGrant = { + login: "octocat", + installationOwnerLogins: ["acme"], + repositories: [{ id: "10", fullName: "acme/app", installationId: "9" }], + }; + expect(githubAccessError( + "github", + "POST https://api.github.com/repos/external-org/public-repo/issues: 403 Resource not accessible by integration []", + { + connectionMethodKey: "managed", + githubGrant, + toolName: "mcp.github:create_issue", + parameters: { owner: "external-org", repo: "public-repo", title: "Bug" }, + }, + )).toEqual({ errorCode: "github_repo_outside_app_installations" }); + + // Accessible org missing a specific repo selection remains github_access_denied. + expect(githubAccessError( + "github", + "POST https://api.github.com/repos/acme/unselected-repo/issues: 403 Resource not accessible by integration []", + { + connectionMethodKey: "managed", + githubGrant, + toolName: "mcp.github:create_issue", + parameters: { owner: "acme", repo: "unselected-repo", title: "Bug" }, + }, + )).toEqual({ errorCode: "github_access_denied" }); + + // User's own personal account remains repairable via Manage GitHub access. + expect(githubAccessError( + "github", + "POST https://api.github.com/repos/octocat/personal-repo/issues: 403 Resource not accessible by integration []", + { + connectionMethodKey: "managed", + githubGrant, + toolName: "mcp.github:create_issue", + parameters: { owner: "octocat", repo: "personal-repo", title: "Bug" }, + }, + )).toEqual({ errorCode: "github_access_denied" }); + + // PAT connections and missing snapshots keep github_access_denied. + expect(githubAccessError( + "github", + "POST https://api.github.com/repos/external-org/public-repo/issues: 403 Resource not accessible by personal access token []", + { + connectionMethodKey: "mcp-key", + githubGrant, + toolName: "mcp.github:create_issue", + parameters: { owner: "external-org", repo: "public-repo", title: "Bug" }, + }, + )).toEqual({ errorCode: "github_access_denied" }); + expect(githubAccessError( + "github", + "POST https://api.github.com/repos/external-org/public-repo/issues: 403 Resource not accessible by integration []", + { + connectionMethodKey: "managed", + githubGrant: null, + toolName: "mcp.github:create_issue", + parameters: { owner: "external-org", repo: "public-repo", title: "Bug" }, + }, + )).toEqual({ errorCode: "github_access_denied" }); + }); + + it("pre-checks managed GitHub writes against installed accounts without blocking installed orgs, personal accounts, or upstream fork sources", () => { + const githubGrant = { + login: "octocat", + installationOwnerLogins: ["Acme"], + }; + const unreachable = findUnreachableManagedGitHubTarget({ + sourceTemplateKey: "github", + connectionMethodKey: "managed", + githubGrant, + toolName: "mcp.github:add_issue_comment", + parameters: { owner: "vercel", repo: "next.js", issue_number: 1, body: "hi" }, + }); + expect(unreachable).toMatchObject({ owner: "vercel", repo: "next.js" }); + expect(unreachable?.message).toContain("vercel/next.js"); + expect(unreachable?.message).toMatch(/not installed/i); + expect(unreachable?.message).not.toMatch(/select Refresh access|Add More Repos on GitHub/i); + + // repository: "owner/repo" format is also detected. + expect(findUnreachableManagedGitHubTarget({ + sourceTemplateKey: "github", + connectionMethodKey: "managed", + githubGrant, + toolName: "mcp.github:create_issue", + parameters: { repository: "external-org/public-repo", title: "Bug" }, + })).toMatchObject({ owner: "external-org", repo: "public-repo" }); + + // Installed org (case-insensitive) and user's own personal account are allowed. + expect(findUnreachableManagedGitHubTarget({ + sourceTemplateKey: "github", + connectionMethodKey: "managed", + githubGrant, + toolName: "mcp.github:create_issue", + parameters: { owner: "acme", repo: "other-repo", title: "Bug" }, + })).toBeNull(); + expect(findUnreachableManagedGitHubTarget({ + sourceTemplateKey: "github", + connectionMethodKey: "managed", + githubGrant, + toolName: "mcp.github:create_issue", + parameters: { owner: "OctoCat", repo: "my-repo", title: "Bug" }, + })).toBeNull(); + + // fork_repository reads from owner/repo and writes to organization (or personal account). + expect(findUnreachableManagedGitHubTarget({ + sourceTemplateKey: "github", + connectionMethodKey: "managed", + githubGrant, + toolName: "mcp.github:fork_repository", + parameters: { owner: "vercel", repo: "next.js", organization: "acme" }, + })).toBeNull(); + expect(findUnreachableManagedGitHubTarget({ + sourceTemplateKey: "github", + connectionMethodKey: "managed", + githubGrant, + toolName: "mcp.github:fork_repository", + parameters: { owner: "vercel", repo: "next.js", organization: "other-org" }, + })).toMatchObject({ owner: "other-org" }); + + // PAT connections and missing snapshots are not pre-blocked. + expect(findUnreachableManagedGitHubTarget({ + sourceTemplateKey: "github", + connectionMethodKey: "mcp-key", + githubGrant, + toolName: "mcp.github:create_issue", + parameters: { owner: "vercel", repo: "next.js" }, + })).toBeNull(); + expect(findUnreachableManagedGitHubTarget({ + sourceTemplateKey: "github", + connectionMethodKey: "managed", + githubGrant: { login: "octocat", installationOwnerLogins: [] }, + toolName: "mcp.github:create_issue", + parameters: { owner: "vercel", repo: "next.js" }, + })).toBeNull(); + }); + + it("gives accurate non-refresh instructions for github_repo_outside_app_installations", () => { + const text = githubAccessErrorInstructions( + "github_repo_outside_app_installations", + "mcp.github:create_issue", + "managed", + { owner: "external-org", repo: "public-repo" }, + ); + expect(text).toMatch(/Do not retry/); + expect(text).toMatch(/not installed/i); + expect(text).toMatch(/directly on GitHub|personal access token/i); + expect(text).not.toMatch(/select Refresh access|Add More Repos on GitHub/i); + }); }); diff --git a/server/src/services/tool-access/github-access-errors.ts b/server/src/services/tool-access/github-access-errors.ts index 191c1495d89..c0b3a5a8a21 100644 --- a/server/src/services/tool-access/github-access-errors.ts +++ b/server/src/services/tool-access/github-access-errors.ts @@ -1,12 +1,191 @@ import type { RequestConfirmationResult } from "@paperclipai/shared"; +export const GITHUB_ACCESS_DENIED_ERROR_CODE = "github_access_denied" as const; +export const GITHUB_REPO_OUTSIDE_APP_INSTALLATIONS_ERROR_CODE = "github_repo_outside_app_installations" as const; + +export type GitHubAccessErrorCode = + | typeof GITHUB_ACCESS_DENIED_ERROR_CODE + | typeof GITHUB_REPO_OUTSIDE_APP_INSTALLATIONS_ERROR_CODE; + +export function isGitHubAccessErrorCode(code: unknown): code is GitHubAccessErrorCode { + return code === GITHUB_ACCESS_DENIED_ERROR_CODE + || code === GITHUB_REPO_OUTSIDE_APP_INSTALLATIONS_ERROR_CODE; +} + +export interface GitHubAccessSnapshot { + login?: unknown; + installationOwnerLogins?: unknown; +} + +export interface GitHubTarget { + owner: string; + repo?: string; +} + +const GITHUB_OWNER_RE = /^[A-Za-z0-9](?:[A-Za-z0-9-]{0,38})$/; +const GITHUB_REPO_RE = /^(?!\.{1,2}$)[A-Za-z0-9_.-]{1,100}$/; +const GITHUB_API_REPO_URL_RE = /\bhttps:\/\/api\.github\.com\/repos\/([A-Za-z0-9][A-Za-z0-9-]{0,38})\/([A-Za-z0-9_.-]{1,100})(?=[/:?\s]|$)/i; +const GITHUB_API_ORG_URL_RE = /\bhttps:\/\/api\.github\.com\/orgs\/([A-Za-z0-9][A-Za-z0-9-]{0,38})(?=[/:?\s]|$)/i; + +function asRecord(value: unknown): Record { + return value !== null && typeof value === "object" && !Array.isArray(value) + ? value as Record + : {}; +} + +function githubOperation(toolName: string): string { + return (toolName.split(/[.:/]/).pop() ?? "").trim().toLowerCase().replace(/-/g, "_"); +} + +function validOwner(value: unknown): string | null { + if (typeof value !== "string") return null; + const trimmed = value.trim(); + return GITHUB_OWNER_RE.test(trimmed) ? trimmed : null; +} + +function validRepo(value: unknown): string | null { + if (typeof value !== "string") return null; + const trimmed = value.trim(); + return GITHUB_REPO_RE.test(trimmed) ? trimmed : null; +} + +function parseFullName(value: unknown): GitHubTarget | null { + if (typeof value !== "string") return null; + const parts = value.trim().split("/"); + if (parts.length !== 2) return null; + const owner = validOwner(parts[0]); + const repo = validRepo(parts[1]); + return owner && repo ? { owner, repo } : null; +} + +/** Extract the write target owner (and repository when known) from structured + * GitHub tool parameters, or as a fallback from a GitHub REST API URL in a 403 + * error message. For `fork_repository`, `owner`/`repo` is the upstream source + * repo rather than the write destination, so only `organization`/`org` counts. */ +export function extractGitHubTarget( + toolName: string, + parameters: unknown, + providerMessage?: unknown, +): GitHubTarget | null { + const op = githubOperation(toolName); + const params = asRecord(parameters); + if (op === "create_repository" || op === "fork_repository") { + const org = validOwner(params.organization ?? params.org); + if (org) return { owner: org }; + if (typeof providerMessage === "string") { + const orgMatch = GITHUB_API_ORG_URL_RE.exec(providerMessage.slice(0, 4000)); + const matchedOrg = validOwner(orgMatch?.[1]); + if (matchedOrg) return { owner: matchedOrg }; + } + return null; + } + + const owner = validOwner(params.owner); + if (owner) { + const repo = validRepo(params.repo ?? params.repository_name ?? params.repositoryName); + return repo ? { owner, repo } : { owner }; + } + + for (const key of ["repository", "repo", "repoFullName", "fullName"] as const) { + const parsed = parseFullName(params[key]); + if (parsed) return parsed; + } + + const org = validOwner(params.organization ?? params.org); + if (org) return { owner: org }; + + if (typeof providerMessage === "string") { + const snippet = providerMessage.slice(0, 4000); + const repoMatch = GITHUB_API_REPO_URL_RE.exec(snippet); + if (repoMatch) { + const matchedOwner = validOwner(repoMatch[1]); + const matchedRepo = validRepo(repoMatch[2]); + if (matchedOwner && matchedRepo) return { owner: matchedOwner, repo: matchedRepo }; + } + const orgMatch = GITHUB_API_ORG_URL_RE.exec(snippet); + const matchedOrg = validOwner(orgMatch?.[1]); + if (matchedOrg) return { owner: matchedOrg }; + } + + return null; +} + +function normalizedInstalledOwners(githubGrant: GitHubAccessSnapshot | null | undefined): { + login: string; + installedOwners: string[]; + installedOwnerSet: Set; +} | null { + if (!githubGrant) return null; + const login = validOwner(githubGrant.login); + if (!login || !Array.isArray(githubGrant.installationOwnerLogins)) return null; + const seen = new Set(); + const installedOwners: string[] = []; + for (const entry of githubGrant.installationOwnerLogins) { + const owner = validOwner(entry); + if (!owner) continue; + const key = owner.toLowerCase(); + if (seen.has(key)) continue; + seen.add(key); + installedOwners.push(owner); + } + if (installedOwners.length === 0) return null; + return { login, installedOwners, installedOwnerSet: seen }; +} + +/** Check whether a managed GitHub App call targets an account/organization + * outside the Paperclip GitHub App's installed accounts (and not the user's + * own personal account). Refreshing access cannot grant write access to + * third-party orgs where the App is not installed. */ +export function findUnreachableManagedGitHubTarget(input: { + sourceTemplateKey: unknown; + connectionMethodKey: unknown; + githubGrant: GitHubAccessSnapshot | null | undefined; + toolName: string; + parameters?: unknown; + providerMessage?: unknown; +}): { owner: string; repo?: string; installedOwners: string[]; message: string } | null { + if (input.sourceTemplateKey !== "github" || input.connectionMethodKey !== "managed") return null; + const snapshot = normalizedInstalledOwners(input.githubGrant); + if (!snapshot) return null; + const target = extractGitHubTarget(input.toolName, input.parameters, input.providerMessage); + if (!target) return null; + const targetOwnerLower = target.owner.toLowerCase(); + if (targetOwnerLower === snapshot.login.toLowerCase() || snapshot.installedOwnerSet.has(targetOwnerLower)) { + return null; + } + return { + ...target, + installedOwners: snapshot.installedOwners, + message: githubOutsideAppInstallationsInstructions(target, snapshot.installedOwners), + }; +} + /** GitHub reports repository permission failures inside successful MCP HTTP * responses. Do not infer that every 403 is an access problem (rate limits also * use 403), or echo provider response text into the repair instructions. */ -export function githubAccessError(sourceTemplateKey: unknown, message: unknown) { +export function githubAccessError( + sourceTemplateKey: unknown, + message: unknown, + context?: { + connectionMethodKey?: unknown; + githubGrant?: GitHubAccessSnapshot | null; + toolName?: string; + parameters?: unknown; + }, +): { errorCode: GitHubAccessErrorCode } | null { if (sourceTemplateKey !== "github" || typeof message !== "string" || !/\b403\s+Resource not accessible by (?:integration|personal access token)\b/i.test(message.slice(0, 4000))) return null; - return { errorCode: "github_access_denied" as const }; + if (context && findUnreachableManagedGitHubTarget({ + sourceTemplateKey, + connectionMethodKey: context.connectionMethodKey, + githubGrant: context.githubGrant, + toolName: context.toolName ?? "", + parameters: context.parameters, + providerMessage: message, + })) { + return { errorCode: GITHUB_REPO_OUTSIDE_APP_INSTALLATIONS_ERROR_CODE }; + } + return { errorCode: GITHUB_ACCESS_DENIED_ERROR_CODE }; } /** Upgrade already saved tool errors using verified connection identity. Retain @@ -19,6 +198,24 @@ export function projectGitHubActionResult(sourceTemplateKey: unknown, result: Re return failure ? { ...result, toolAction: { ...action, ...failure } } : result; } +/** Trusted, server-authored next steps when a managed GitHub App connection + * targets an organization or repository outside the App's installations. + * Never echoes raw provider text. */ +export function githubOutsideAppInstallationsInstructions( + target?: GitHubTarget | null, + installedOwners?: string[], +): string { + const safeTarget = target && validOwner(target.owner) + ? (target.repo && validRepo(target.repo) ? `${target.owner}/${target.repo}` : target.owner) + : null; + const safeInstalled = (installedOwners ?? []).filter((owner) => validOwner(owner) !== null); + const targetPhrase = safeTarget ? ` for ${safeTarget}` : ""; + const installedPhrase = safeInstalled.length > 0 + ? ` (currently installed on: ${safeInstalled.join(", ")})` + : ""; + return `GitHub cannot run this action${targetPhrase} because the Paperclip GitHub App is not installed on that organization or account${installedPhrase}. Do not retry or request approval for the same call on this managed GitHub App connection. Never automatically replay an approved write. Refreshing access cannot grant write permission to repositories outside the Paperclip GitHub App's installations. Explain this to the user and offer the drafted content so they can post directly on GitHub, note that a personal access token (PAT) GitHub connection is required to write to external repositories where the App cannot be installed, or—only if they administer that organization—ask an organization admin to install the Paperclip GitHub App there first.`; +} + /** Trusted, server-authored next steps for the agent after GitHub denied an * approved action. Access must be repaired before another attempt. The * provider text stays in the untrusted result, never in these instructions. */ @@ -36,3 +233,16 @@ export function githubAccessDeniedInstructions(toolName: string, connectionMetho } return `${base} Tell the user which account or repository you need. Ask them to give the Paperclip GitHub App access from the GitHub connection's Permissions page and select Refresh access. Continue after they confirm.`; } + +export function githubAccessErrorInstructions( + errorCode: GitHubAccessErrorCode, + toolName: string, + connectionMethodKey: unknown = null, + target?: GitHubTarget | null, + installedOwners?: string[], +): string { + if (errorCode === GITHUB_REPO_OUTSIDE_APP_INSTALLATIONS_ERROR_CODE) { + return githubOutsideAppInstallationsInstructions(target, installedOwners); + } + return githubAccessDeniedInstructions(toolName, connectionMethodKey); +} diff --git a/server/src/services/tool-action-delivery.ts b/server/src/services/tool-action-delivery.ts index 62365177ae3..8f7d15f1310 100644 --- a/server/src/services/tool-action-delivery.ts +++ b/server/src/services/tool-action-delivery.ts @@ -25,7 +25,11 @@ import { } from "@paperclipai/db"; import type { heartbeatService } from "./heartbeat.js"; import type { RequestConfirmationResult } from "@paperclipai/shared"; -import { githubAccessDeniedInstructions, projectGitHubActionResult } from "./tool-access/github-access-errors.js"; +import { + githubAccessErrorInstructions, + isGitHubAccessErrorCode, + projectGitHubActionResult, +} from "./tool-access/github-access-errors.js"; import { toolSourceTemplateKeySql } from "./tool-access/source-template-key.js"; const terminalStatuses: Array = [ @@ -237,6 +241,7 @@ export function toolActionDeliveryService( reason?: string; toolAction?: { resultSummary?: string; errorMessage?: string; errorCode?: string | null }; } | null; + const effectiveErrorCode = result?.toolAction?.errorCode ?? invocation.errorCode; const instructions = request.status === "executed" ? "The approved action already ran. Do not call it again; continue with the recorded result. Process the result and answer the user in your own words. Do not paste the raw tool or transport JSON unless the user asks for it." @@ -245,8 +250,8 @@ export function toolActionDeliveryService( : request.status === "expired" || request.status === "cancelled" ? "The review is no longer available. Do not execute the stored request. Explain the recorded outcome before requesting another review." - : (result?.toolAction?.errorCode ?? invocation.errorCode) === "github_access_denied" - ? githubAccessDeniedInstructions(invocation.toolName, connectionMethodKey) + : isGitHubAccessErrorCode(effectiveErrorCode) + ? githubAccessErrorInstructions(effectiveErrorCode, invocation.toolName, connectionMethodKey) : "The approved action did not complete successfully. Do not automatically replay it; inspect the recorded outcome first."; return { toolName: invocation.toolName.slice(0, 256), diff --git a/server/src/services/tool-gateway.ts b/server/src/services/tool-gateway.ts index 06fe6295ea3..459f2bf4870 100644 --- a/server/src/services/tool-gateway.ts +++ b/server/src/services/tool-gateway.ts @@ -40,7 +40,13 @@ import { currentConnectionToolDefinition } from "./connectors/paperclip-defined- import { composeConnectionInstructions } from "./connection-instructions.js"; import { googleWorkspaceToolTarget, googleWorkspaceGrantedScopes, isGoogleWorkspaceToolGranted } from "@paperclipai/shared"; import { isInsufficientConnectionScope, INSUFFICIENT_CONNECTION_SCOPE_MESSAGE } from "./connection-permission-errors.js"; -import { githubAccessDeniedInstructions, githubAccessError } from "./tool-access/github-access-errors.js"; +import { + extractGitHubTarget, + findUnreachableManagedGitHubTarget, + githubAccessError, + githubAccessErrorInstructions, + isGitHubAccessErrorCode, +} from "./tool-access/github-access-errors.js"; import { githubDefaultOwnerApplies, githubDefaultOwnerArguments } from "./tool-access/github-default-owner.js"; import { toolSourceTemplateKeySql } from "./tool-access/source-template-key.js"; import { usesClientCredentials } from "./tool-access/oauth/client-credentials.js"; @@ -5798,6 +5804,26 @@ export function createToolGatewayService( return githubDefaultOwnerArguments(entry.toolName, projected, grant?.providerTenant?.github); } + async function checkManagedGitHubWriteReachability( + session: ToolGatewaySession, + tool: ToolGatewayDescriptor, + parameters: unknown, + ) { + if (tool.providerType !== "mcp_remote_http" && tool.providerType !== "provider_rest") return null; + const resolved = await resolveConnectedRemoteTool(session, tool).catch(() => null); + if (!resolved || resolved.sourceTemplateKey !== "github") return null; + const connectionMethodKey = resolved.connection.config.connectionMethodKey ?? resolved.connection.transportConfig.connectionMethodKey; + if (connectionMethodKey !== "managed") return null; + const grant = await resolveConnectionGrant(session, resolved.connection, false).catch(() => null); + return findUnreachableManagedGitHubTarget({ + sourceTemplateKey: resolved.sourceTemplateKey, + connectionMethodKey, + githubGrant: grant?.providerTenant?.github, + toolName: resolved.entry.toolName, + parameters, + }); + } + async function approvedManagedArgumentsRemainCurrent( session: ToolGatewaySession, tool: ToolGatewayDescriptor, @@ -7534,12 +7560,18 @@ export function createToolGatewayService( transport: "mcp_http" | "local_stdio" | "cognee_cloud" = "mcp_http", spawnedLocalProcess = false, sourceTemplateKey?: string | null, + githubContext?: { + connectionMethodKey?: unknown; + githubGrant?: { login?: unknown; installationOwnerLogins?: unknown } | null; + toolName?: string; + parameters?: unknown; + }, ) { const record = asRecord(result); if (!record) throw malformedRemoteMcpResponse(); const providerContent = normalizeMcpContent(record.content); const githubFailure = record.isError === true - ? githubAccessError(sourceTemplateKey, providerContent) : null; + ? githubAccessError(sourceTemplateKey, providerContent, githubContext) : null; const googleWorkspacePermissionDenied = record.isError === true && (sourceTemplateKey === "gmail" || @@ -9116,14 +9148,28 @@ export function createToolGatewayService( request: resultElicitation, }); } + const connectionMethodKey = connection.config.connectionMethodKey ?? connection.transportConfig.connectionMethodKey; const result = normalizeMcpToolResult( callResult, "mcp_http", false, sourceTemplateKey, + sourceTemplateKey === "github" + ? { connectionMethodKey, githubGrant: grant.providerTenant?.github, toolName: entry.toolName, parameters } + : undefined, ); - const failureInstructions = result.errorCode === "github_access_denied" - ? githubAccessDeniedInstructions(entry.toolName, connection.config.connectionMethodKey ?? connection.transportConfig.connectionMethodKey) + const failureInstructions = isGitHubAccessErrorCode(result.errorCode) + ? githubAccessErrorInstructions( + result.errorCode, + entry.toolName, + connectionMethodKey, + result.errorCode === "github_repo_outside_app_installations" + ? extractGitHubTarget(entry.toolName, parameters) + : null, + result.errorCode === "github_repo_outside_app_installations" + ? grant.providerTenant?.github?.installationOwnerLogins + : undefined, + ) : undefined; await markCallHealth( "ok", @@ -10319,9 +10365,10 @@ export function createToolGatewayService( }); const providerResult = asRecord(resultValidation.value); if (providerResult?.error) { - throw new ToolGatewayHttpError(providerResult.errorCode === "github_access_denied" ? 403 : 502, + const githubCode = isGitHubAccessErrorCode(providerResult.errorCode) ? providerResult.errorCode : null; + throw new ToolGatewayHttpError(githubCode ? 403 : 502, toolResultErrorMessage(providerResult, connectedMcpExecution.failureInstructions), - providerResult.errorCode === "github_access_denied" ? "github_access_denied" : "tool_error", + githubCode ?? "tool_error", { execution: connectedMcpExecution.execution, ...connectedToolErrorDetails(connectedMcpExecution, providerResult) }); } } catch (err) { @@ -11205,13 +11252,15 @@ export function createToolGatewayService( promptInjectionMode: "block", classifier: resultClassifier(session, tool, invocation.id, { approvedAction: true }), }); const resultRecord = asRecord(resultValidation.value); - if (resultRecord?.error) + if (resultRecord?.error) { + const githubCode = isGitHubAccessErrorCode(resultRecord.errorCode) ? resultRecord.errorCode : null; throw new ToolGatewayHttpError( - resultRecord.errorCode === "github_access_denied" ? 403 : 502, + githubCode ? 403 : 502, toolResultErrorMessage(resultRecord, connectedMcpExecution?.failureInstructions), - resultRecord.errorCode === "github_access_denied" ? "github_access_denied" : "tool_execution_failed", + githubCode ?? "tool_execution_failed", connectedToolErrorDetails(connectedMcpExecution, resultRecord), ); + } const now = new Date(); await db .update(toolInvocations) @@ -13975,6 +14024,87 @@ export function createToolGatewayService( if (accessDecision.allowed && tool.providerType === "paperclip_slack_chat" && SLACK_TOOLS.some(t => t.name === tool.upstreamToolName && t.risk === "approval")) { accessDecision = { ...accessDecision, allowed: false, decision: "require_approval", reasonCode: "requires_approval_policy", explanation: "Slack destructive actions, channel creation and invitations require approval." }; } + const unreachableGitHubTarget = accessDecision.decision === "require_approval" && tool.risk !== "read" + ? await checkManagedGitHubWriteReachability(session, tool, effectiveParameters) + : null; + if (unreachableGitHubTarget) { + const deniedAt = new Date(); + const [deniedInvocation] = await db + .insert(toolInvocations) + .values({ + companyId: session.companyId, + idempotencyKey: null, + actorType: decisionInput.actor.actorType, + actorId: decisionInput.actor.actorId, + agentId: session.agentId, + issueId: session.issueId, + runId: session.runId, + gatewayId: session.gatewayId ?? null, + applicationId: tool.applicationId ?? null, + connectionId: tool.connectionId ?? null, + catalogEntryId: tool.catalogEntryId ?? null, + providerType: tool.providerType, + applicationKey: tool.applicationKey ?? null, + upstreamToolName: tool.upstreamToolName ?? null, + riskLevel: tool.risk, + toolName: tool.name, + argumentsHash: toolRequestIdentityHash(effectiveParameters, options.toolActionSigningSecret), + argumentsSummary: effectiveArgumentsSummary, + policyDecision: "deny", + policyExplanation: accessDecision.policyExplanation ?? null, + matchedPolicyIds: accessDecision.matchedPolicyIds, + approvalState: "not_required", + status: "denied", + errorCode: "github_repo_outside_app_installations", + errorMessage: unreachableGitHubTarget.message, + completedAt: deniedAt, + }) + .returning({ id: toolInvocations.id }); + invocationId = deniedInvocation.id; + void emitConnectionInvoked(db, invocationId); + await writeToolCallEvent({ + invocationId, + session, + eventType: "call_denied", + outcome: "denied", + toolName: tool.name, + policyDecision: "deny", + reasonCode: "github_repo_outside_app_installations", + errorMessage: unreachableGitHubTarget.message, + argumentsSummary: effectiveArgumentsSummary, + tool, + }); + await writeAudit({ + session, + companyId: session.companyId, + agentId: session.agentId, + runId: session.runId, + issueId: session.issueId, + action: "tool_gateway.call_denied", + details: { + invocationId, + decision: "deny", + reasonCode: "github_repo_outside_app_installations", + matchedPolicyIds: accessDecision.matchedPolicyIds, + tool: tool.name, + virtualToolName, + targetToolName: virtualToolName ? tool.name : undefined, + ...toolAuditMetadata(tool), + argumentsSummary: effectiveArgumentsSummary, + }, + }); + throw new ToolGatewayHttpError( + 403, + unreachableGitHubTarget.message, + "github_repo_outside_app_installations", + { + invocationId, + tool: tool.name, + decision: "deny", + matchedPolicyIds: accessDecision.matchedPolicyIds, + }, + ); + } const recorded = await recordToolInvocation( decisionInput, accessDecision, @@ -14223,10 +14353,11 @@ export function createToolGatewayService( ? asRecord(resultValidation.value) : null; if (validatedMcpResult?.error) { + const githubCode = isGitHubAccessErrorCode(validatedMcpResult.errorCode) ? validatedMcpResult.errorCode : null; throw new ToolGatewayHttpError( - validatedMcpResult.errorCode === "github_access_denied" ? 403 : 502, + githubCode ? 403 : 502, toolResultErrorMessage(validatedMcpResult, connectedMcpExecution?.failureInstructions), - validatedMcpResult.errorCode === "github_access_denied" ? "github_access_denied" : "tool_error", + githubCode ?? "tool_error", { execution: connectedMcpExecution?.execution, ...connectedToolErrorDetails(connectedMcpExecution, validatedMcpResult) }, ); } diff --git a/ui/src/components/IssueThreadInteractionCard.test.tsx b/ui/src/components/IssueThreadInteractionCard.test.tsx index e30ba777a2e..6830f6bd2fe 100644 --- a/ui/src/components/IssueThreadInteractionCard.test.tsx +++ b/ui/src/components/IssueThreadInteractionCard.test.tsx @@ -1538,6 +1538,30 @@ describe("IssueThreadInteractionCard tool-action card", () => { expect(host.textContent).not.toContain("Approve & run"); }); + it("explains an unreachable external repository without offering misleading Manage GitHub access advice", () => { + const interaction = { ...failedToolActionInteraction, + payload: { ...failedToolActionInteraction.payload, toolAction: { + ...failedToolActionInteraction.payload.toolAction!, appDisplayName: "GitHub", + toolName: "mcp.github:create_issue", toolDisplayName: "Create issue", + } }, + result: { ...failedToolActionInteraction.result!, toolAction: { + ...failedToolActionInteraction.result!.toolAction!, errorCode: "github_repo_outside_app_installations", + errorMessage: "failed to create issue: POST https://api.github.com/repos/external-org/public-repo/issues: 403 Resource not accessible by integration []", + } }, + }; + const host = renderCard({ interaction }); + const alert = host.querySelector('[role="alert"]'); + expect(alert?.textContent).toContain("Repository outside GitHub App access"); + expect(alert?.textContent).toMatch(/not installed/i); + expect(alert?.textContent).toMatch(/post on GitHub directly|personal access token/i); + expect(host.textContent).not.toContain("GitHub access needed"); + expect(host.textContent).not.toContain("Manage GitHub access"); + expect(host.textContent).not.toContain("Retry"); + expect(host.textContent).not.toContain("Approve & run"); + expect(host.textContent).toContain(interaction.result.toolAction.errorMessage); + expect(host.querySelector("details")?.hasAttribute("open")).toBe(false); + }); + it("renders the expired state without decision controls", () => { const host = renderCard({ interaction: expiredToolActionInteraction }); diff --git a/ui/src/components/IssueThreadInteractionCard.tsx b/ui/src/components/IssueThreadInteractionCard.tsx index cc3e09be9f2..061c8681362 100644 --- a/ui/src/components/IssueThreadInteractionCard.tsx +++ b/ui/src/components/IssueThreadInteractionCard.tsx @@ -1974,6 +1974,13 @@ function ToolActionResolution({ {detail ?
Error details

{detail}

: null} ; } + if (state === "failed" && result?.errorCode === "github_repo_outside_app_installations") { + return
+

+

The Paperclip GitHub App is not installed on this repository’s organization or account, so refreshing access cannot grant write permission here. Post on GitHub directly, use a personal access token connection, or have an administrator of that organization install the Paperclip GitHub App.

+ {detail ?
Error details

{detail}

: null} +
; + } const status = <> {labels[state]} diff --git a/ui/storybook/stories/questions-and-approvals/connection-reviews.stories.tsx b/ui/storybook/stories/questions-and-approvals/connection-reviews.stories.tsx index bfd4c03df43..5034af75519 100644 --- a/ui/storybook/stories/questions-and-approvals/connection-reviews.stories.tsx +++ b/ui/storybook/stories/questions-and-approvals/connection-reviews.stories.tsx @@ -356,6 +356,20 @@ export const GitHubAccessNeeded: Story = { } }, }]} />, }; +export const GitHubRepoOutsideAppAccess: Story = { + render: () => , +}; export const Declined: Story = { render: () => , };