mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-26 01:39:51 +01:00
feat(github): graduate GitHub review bots out of experimental (#22996)
## Thinking Path > - Paperclip is the open source app people use to manage AI agents for work > - GitHub Code Review Bot connects an agent to a dedicated GitHub App so it reviews pull requests and responds to GitHub mentions > - The feature was gated behind the default-off `enableGitHubReviewBots` experimental instance setting, hiding the catalog card, setup routes, identity links, and channel creation > - People had to find and flip an instance-level experimental switch before they could connect a GitHub review agent > - This pull request graduates GitHub review bots to a normal always-on feature, keeping `enableGitHubReviewBots` only as a deprecated compatibility key that always resolves to `true` > - The benefit is that every Paperclip instance exposes GitHub Code Review Bot setup, discovery, and management by default without requiring feature flags ## Linked Issues or Issue Description **What existing behavior does this improve?** GitHub Code Review Bot discovery, catalog visibility, setup/management routes, identity-link endpoints, and Agent Channels visibility (`enableGitHubReviewBots`). **Subsystem affected** Cross-cutting (`packages/shared`, `server/`, `ui/`, Storybook, E2E specs, docs). **Current behavior** GitHub Code Review Bot is hidden from Connectors, `connections_search`, chat-endpoint creation, identity-link confirmation, and UI setup/settings routes until an instance admin turns on **Settings → Experimental → GitHub review bots** (`enableGitHubReviewBots`). **Proposed behavior** GitHub Code Review Bot is always available as a standard feature on every instance (self-hosted and Cloud), matching AgentMail and graduated features such as Assistant connections (`enablePublicMcp`) and the AWS connector (`enableAwsConnector`). `enableGitHubReviewBots` stays in schemas and the feature catalog only as a deprecated compatibility key that always normalizes to `true`, ignores stored or Cloud-managed `false` values, and does not reject legacy `false` patches. Experimental chat providers (Slack, Discord, Microsoft Teams, Telegram, iMessage Photon, Speko) remain gated by `enableChatConnectors`. **Reason and benefit** Users can connect and manage GitHub review agents directly from Connectors without an admin enabling an experimental flag first, and Cloud stacks no longer require managed feature-flag overrides to expose GitHub review bots. **Breaking changes** No schema migration or breaking API change. Existing rows, API patches, and Cloud managed configs that still carry `enableGitHubReviewBots` continue to parse cleanly, while the effective value is always `true`. Instances that previously kept `enableGitHubReviewBots` off now display GitHub Code Review Bot in Connectors and allow authorized managers (`tools:manage_connections`) to create GitHub review bot endpoints. ## What Changed - `packages/shared`: marked `enableGitHubReviewBots` as a deprecated compatibility key in types, Zod defaults (`true`), and `INSTANCE_FEATURE_CATALOG` (`cloudDefault: true`, `selfHostedDefault: true`); updated `channelMethodEnabled` in `connector-availability.ts` so `github` is always enabled alongside `agentmail`. - `server` instance settings and Cloud staging: `normalizeExperimentalSettings` always returns `enableGitHubReviewBots: true`; `applyManagedExperimentalOverlay` and `updateExperimental` ignore retired `enableGitHubReviewBots` entries so Cloud managed configs cannot turn it off and legacy `false` patches are not rejected; removed `enableGitHubReviewBots` from `CLOUD_STAGING_EXPERIMENTAL_KEYS`. - `server` chat channels, discovery, and OpenAPI: allowed `github` in `assertChatProviderEnabledForCreate`, `assertIdentityProviderEnabled`, `assertIdentityLinkAccess`, and `connection-intents` discovery without experimental flags while keeping `enableChatConnectors` enforcement for experimental chat providers; updated the OpenAPI endpoint description. - `ui` and Storybook: removed the **GitHub review bots** Experimental settings toggle card; simplified `useChatConnectorsEnabled` and `chatProviderVisible` so `github` and `github-code-review-bot` are always visible; bypassed experimental loading wait for `provider=github` in `ChatConnectorsExperimentalGate`; made the classic Agent Detail Channels tab and `AgentChannelsPanel` empty-state copy always reflect available agent identities; updated `canEnterAppsConnect`, `Browse`, `ConnectionSetupFlow`, and `github-connections.stories.tsx`. - Tests, E2E, runner-e2e, docs, and maps: updated unit, integration, managed-overlay, runner-e2e, and Playwright E2E specs; refreshed `tests/runner-e2e/source-sdk-public-inputs.json`; updated `doc/connections/GITHUB.md`, `doc/connections/GITHUB-REVIEW-BOT.md`, and `maps/feature-map/chat-channels.md`. ## Verification - `pnpm --filter @paperclipai/shared build && pnpm --filter @paperclipai/shared typecheck && pnpm --filter @paperclipai/server typecheck && pnpm --filter @paperclipai/ui typecheck` — passed. - `node scripts/check-maps.mjs && node scripts/storybook-catalog.mjs` — passed. - `pnpm vitest run packages/shared/src/validators/instance.test.ts packages/shared/src/connector-availability.test.ts packages/shared/src/feature-catalog.test.ts server/src/__tests__/instance-settings-service.test.ts server/src/__tests__/instance-settings-managed-overlay.test.ts server/src/__tests__/instance-settings-cloud-defaults.test.ts server/src/routes/chat-channels.identity.test.ts server/src/__tests__/connection-intents-service.test.ts server/src/__tests__/chat-channels/slack-ingress-and-threads.integration.test.ts server/src/__tests__/chat-channels/github-setup-and-access.integration.test.ts` — all passed. - `pnpm vitest run ui/src/pages/apps/app-connect-policy.test.ts ui/src/components/chat/ExternallyConnectedTaskBanner.test.tsx ui/src/features/connections/ConnectionSetupFlow.slack-oauth.test.tsx` — 3 files, 62 tests passed. - `pnpm --dir tests/runner-e2e vitest run github-review-journey.test.ts` — 56 tests passed. - `pnpm verify --explain` — confirmed `tests/runner-e2e/source-sdk-public-inputs.json` is current; exited 2 for broad CI coverage (handled by required GitHub CI gates on this PR). ## Risks - Behavioral shift: instances that had `enableGitHubReviewBots` off now show GitHub Code Review Bot in Connectors and allow authorized users with `tools:manage_connections` to configure GitHub review bots. Existing permission boundaries (`tools:manage_connections`, company scoping, GitHub App OAuth/installation consent) are unchanged. - `useIssueChatBinding` now queries `/api/issues/:issueId/chat-binding` for normal tasks even when `enableChatConnectors` is off so GitHub-bound task banners remain visible; experimental chat bindings remain filtered out by `chatProviderVisible` while `enableChatConnectors` is off. - No database migration is required; stored `enableGitHubReviewBots` JSON values become inert. > For core feature work, check [`ROADMAP.md`](ROADMAP.md) first and discuss it in `#dev` before opening the PR. Feature PRs that overlap with planned core work may need to be redirected — check the roadmap first. See `CONTRIBUTING.md`. ## Model Used - Google Gemini (high reasoning) in Antigravity, with tool use (shell, file edits, test execution). ## 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 - [x] All Paperclip CI gates are green - [x] Greptile is 5/5 with no open P2s, recommendations, or follow-ups - [x] I will address all Greptile and reviewer comments before requesting merge
This commit is contained in:
1 parent
1a1d436cc5
commit
702368ffaf
42 files changed
+172
-167
No files matched your search
@@ -13,10 +13,9 @@ required GitHub checks, read
|
||||
|
||||
The canonical step-by-step operator setup guide lives in
|
||||
[GitHub Review Bots](../../docs/guides/board-operator/github-review-bots.md).
|
||||
Enable **GitHub review bots** in instance **Experimental** settings (this
|
||||
default-off setting is independent of **Chat connectors**; hiding either feature
|
||||
does not pause existing provider delivery), then follow the Quickstart there to
|
||||
choose an agent, create and install the dedicated GitHub App, and verify your
|
||||
Open the **GitHub Code Review Bot** connector from **Connectors** (no
|
||||
experimental setting is required), then follow the Quickstart there to choose
|
||||
an agent, create and install the dedicated GitHub App, and verify your
|
||||
identity. The sections below record internal connector semantics and
|
||||
implementation invariants.
|
||||
|
||||
|
||||
@@ -10,10 +10,9 @@ only in its existing encrypted secret system.
|
||||
**GitHub** connects an account for repository tools, Git, and `gh`, and opens
|
||||
Access → Connect directly. **GitHub Code Review Bot** connects one agent to a
|
||||
GitHub App for pull-request reviews and mentions, and opens Choose agent directly.
|
||||
The bot entry follows **Settings → Experimental → GitHub review bots**
|
||||
(`enableGitHubReviewBots`), which defaults to off. It is independent of Chat
|
||||
connectors: enabling one does not enable the other. Turning off the GitHub
|
||||
setting hides setup and management; existing bots keep running.
|
||||
It is available by default in Connectors and does not require turning on
|
||||
**Chat connectors** or any experimental setting. The legacy
|
||||
`enableGitHubReviewBots` key is kept for compatibility only and is always on.
|
||||
|
||||
Both entries reuse the existing GitHub integrations. Bot endpoints retain the
|
||||
`github` provider identity and existing setup, reconnect, and management URLs;
|
||||
|
||||
@@ -9,7 +9,7 @@ You can run a review bot on any agent, harness, or model supported by Paperclip
|
||||
|
||||
## 1. Quickstart
|
||||
|
||||
Enable **GitHub review bots** in instance **Experimental** settings before starting setup (this default-off setting is independent of **Chat connectors**, and hiding either feature does not pause existing provider delivery). Setup requires zero GitHub Actions YAML in your repository.
|
||||
GitHub Code Review Bot is available in **Connectors** by default with no experimental setting required. Setup requires zero GitHub Actions YAML in your repository.
|
||||
|
||||
### Step 1: Choose an agent
|
||||
|
||||
|
||||
@@ -43,8 +43,8 @@ Use `paperclipai email inboxes --company-id <company-id>`, then `email send --co
|
||||
|
||||
Preconditions: follow the [baseline](./README.md#before-driving-a-journey). Use a
|
||||
test provider account/channel with permission to send messages. Gates differ:
|
||||
AgentMail bypasses the chat-connectors UI gate, GitHub uses
|
||||
`enableGitHubReviewBots`, and other chat providers use `enableChatConnectors`.
|
||||
AgentMail and GitHub bypass the chat-connectors UI gate; other chat providers
|
||||
use `enableChatConnectors`.
|
||||
Setup is covered in [connection setup](./connection-setup.md).
|
||||
|
||||
### `external-thread`
|
||||
|
||||
@@ -53,6 +53,9 @@ describe("native connectors that need a customer-created OAuth app", () => {
|
||||
const slack = getConnectableAppDefinition("slack")!;
|
||||
expect(nativeConnectorRequiresCustomerOAuthApp(slack, {})).toBe(true);
|
||||
expect(nativeConnectorRequiresCustomerOAuthApp(slack, { enableChatConnectors: true })).toBe(false);
|
||||
const githubBot = getConnectableAppDefinition("github-code-review-bot")!;
|
||||
expect(nativeConnectorRequiresCustomerOAuthApp(githubBot, {})).toBe(false);
|
||||
expect(nativeConnectorRequiresCustomerOAuthApp(githubBot, { enableGitHubReviewBots: false })).toBe(false);
|
||||
});
|
||||
|
||||
it("does not flag connectors with a managed, dynamic-registration, or credential path", () => {
|
||||
|
||||
@@ -17,8 +17,7 @@ function channelMethodEnabled(
|
||||
method: ConnectionMethodDef,
|
||||
settings: Partial<InstanceExperimentalSettings> | null | undefined,
|
||||
): boolean {
|
||||
if (method.provider === "agentmail") return true;
|
||||
if (method.provider === "github") return settings?.enableGitHubReviewBots === true;
|
||||
if (method.provider === "agentmail" || method.provider === "github") return true;
|
||||
return settings?.enableChatConnectors === true;
|
||||
}
|
||||
|
||||
|
||||
@@ -129,11 +129,12 @@ export const INSTANCE_FEATURE_CATALOG: Record<InstanceFeatureKey, FeatureCatalog
|
||||
selfHostedDefault: true,
|
||||
},
|
||||
enableGitHubReviewBots: {
|
||||
title: "GitHub review bots",
|
||||
description: "Show GitHub review bot setup and management independently of chat connectors. Existing bots keep running when hidden; GitHub tool connections are unaffected.",
|
||||
title: "GitHub review bots (compatibility)",
|
||||
description:
|
||||
"Deprecated compatibility key. GitHub review bots are always enabled; stored and managed values are ignored.",
|
||||
tier: "managed",
|
||||
cloudDefault: false,
|
||||
selfHostedDefault: false,
|
||||
cloudDefault: true,
|
||||
selfHostedDefault: true,
|
||||
},
|
||||
enableOpenAiDot: {
|
||||
title: "OpenAI Dot",
|
||||
|
||||
@@ -73,7 +73,7 @@ export interface InstanceExperimentalSettings {
|
||||
enableApps: boolean;
|
||||
/** Exposes chat connector setup and Board surfaces; existing delivery continues when hidden. */
|
||||
enableChatConnectors: boolean;
|
||||
/** Show GitHub review bot setup and management independently of chat connectors. */
|
||||
/** @deprecated Compatibility key only. GitHub review bots are always enabled. */
|
||||
enableGitHubReviewBots: boolean;
|
||||
/** @deprecated Compatibility key only. Assistant connections (MCP) are always enabled. */
|
||||
enablePublicMcp: boolean;
|
||||
|
||||
@@ -25,8 +25,10 @@ describe("instance experimental settings validators", () => {
|
||||
}
|
||||
expect(patchInstanceExperimentalSettingsSchema.safeParse({ enablePaperclipNotebook: "true" }).success).toBe(false);
|
||||
});
|
||||
it("defaults GitHub review bots off independently of chat and accepts explicit changes", () => {
|
||||
expect(instanceExperimentalSettingsSchema.parse({ enableChatConnectors: true }).enableGitHubReviewBots).toBe(false);
|
||||
it("defaults the retired GitHub review bots compatibility key on and accepts explicit patches", () => {
|
||||
expect(instanceExperimentalSettingsSchema.parse({}).enableGitHubReviewBots).toBe(true);
|
||||
expect(instanceExperimentalSettingsSchema.parse({ enableChatConnectors: false }).enableGitHubReviewBots).toBe(true);
|
||||
expect(patchInstanceExperimentalSettingsSchema.parse({ enableGitHubReviewBots: false })).toEqual({ enableGitHubReviewBots: false });
|
||||
expect(patchInstanceExperimentalSettingsSchema.parse({ enableGitHubReviewBots: true })).toEqual({ enableGitHubReviewBots: true });
|
||||
});
|
||||
it("defaults chat connectors off independently of Apps and accepts only explicit boolean patches", () => {
|
||||
|
||||
@@ -60,7 +60,10 @@ export const instanceExperimentalSettingsSchema = z.object({
|
||||
enableGrokBot: z.boolean().default(false),
|
||||
enableMuse: z.boolean().default(false),
|
||||
enableChatConnectors: z.boolean().default(false),
|
||||
enableGitHubReviewBots: z.boolean().default(false),
|
||||
// Deprecated compatibility key. GitHub review bots graduated from
|
||||
// Experimental and are always enabled; older stored rows, managed configs
|
||||
// and clients may still send it.
|
||||
enableGitHubReviewBots: z.boolean().default(true),
|
||||
// Compatibility only: old stored and managed values must still parse.
|
||||
enableMcpAggregators: z.boolean().default(true),
|
||||
enableMemoryConnectors: z.boolean().default(false),
|
||||
|
||||
@@ -35,7 +35,7 @@ describeEmbeddedPostgres("chat channels: slack ingress and threads", () => {
|
||||
const { seedCompany, readChatConversationsByEndpointId, readIssueCommentsByIssueId, readChatDeliveriesByEndpointId, readChatDeliveriesById, readIssuesById, readChatPublicationsByEndpointId, readToolConnectionsById, readIssuesByCompanyId, readChatPublicationsByCommentId, readHeartbeatRunsByCompanyId, createService, recordSlackUrlVerification, signedSlackWebhookRequest, chatWakeContext, addSelectedChatFinal, qualifySetupRoundTrip, configuredSlackEndpoint, deliverMessage } = h;
|
||||
const { recordGitHubWebhookVerification, configuredGitHubEndpoint } = gh;
|
||||
|
||||
it("refuses to create a chat endpoint while its provider experiment is off", async () => {
|
||||
it("refuses experimental chat endpoints while chat connectors are off, but always allows GitHub review bots", async () => {
|
||||
const settings = instanceSettingsService(db);
|
||||
const previous = await settings.getExperimental();
|
||||
try {
|
||||
@@ -43,14 +43,17 @@ describeEmbeddedPostgres("chat channels: slack ingress and threads", () => {
|
||||
const fixture = await seedCompany();
|
||||
const { service } = createService();
|
||||
const app = routesApp(db, fixture.companyId, service);
|
||||
for (const provider of ["imessage-photon", "slack", "github"]) {
|
||||
for (const provider of ["imessage-photon", "slack"]) {
|
||||
const response = await request(app).post(`/api/companies/${fixture.companyId}/chat-endpoints`)
|
||||
.send({ provider, assignedAgentId: fixture.assignedAgentId }).expect(403);
|
||||
expect(response.body.error).toContain("/<prefix>/company/settings/instance/experimental");
|
||||
}
|
||||
expect(await service.list(fixture.companyId)).toEqual([]);
|
||||
const githubResponse = await request(app).post(`/api/companies/${fixture.companyId}/chat-endpoints`)
|
||||
.send({ provider: "github", assignedAgentId: fixture.assignedAgentId }).expect(201);
|
||||
expect(githubResponse.body.provider).toBe("github");
|
||||
} finally {
|
||||
await settings.updateExperimental({ enableChatConnectors: previous.enableChatConnectors, enableGitHubReviewBots: previous.enableGitHubReviewBots });
|
||||
await settings.updateExperimental({ enableChatConnectors: previous.enableChatConnectors });
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -232,25 +232,21 @@ describeEmbeddedPostgres("connectionIntentService", () => {
|
||||
}
|
||||
});
|
||||
|
||||
it("discovers GitHub review bots independently from chat connectors", async () => {
|
||||
it("always discovers GitHub review bots while keeping experimental chat connectors gated", async () => {
|
||||
const settings = instanceSettingsService(db);
|
||||
const previous = await settings.getExperimental();
|
||||
const service = connectionIntentService(db);
|
||||
try {
|
||||
await settings.updateExperimental({ enableChatConnectors: false, enableGitHubReviewBots: true });
|
||||
await settings.updateExperimental({ enableChatConnectors: false, enableGitHubReviewBots: false });
|
||||
expect((await service.search(claims, "github")).results).toEqual(expect.arrayContaining([
|
||||
expect.objectContaining({ service: "github-code-review-bot" }),
|
||||
expect.objectContaining({ service: "github" }),
|
||||
]));
|
||||
expect((await service.search(claims, "slack")).results.some(item =>
|
||||
item.methods.some(method => method.purpose === "channel"))).toBe(false);
|
||||
await settings.updateExperimental({ enableChatConnectors: true, enableGitHubReviewBots: false });
|
||||
expect((await service.search(claims, "github")).results.some(item =>
|
||||
item.service === "github-code-review-bot")).toBe(false);
|
||||
} finally {
|
||||
await settings.updateExperimental({
|
||||
enableChatConnectors: previous.enableChatConnectors,
|
||||
enableGitHubReviewBots: previous.enableGitHubReviewBots,
|
||||
});
|
||||
}
|
||||
});
|
||||
@@ -458,6 +454,7 @@ describeEmbeddedPostgres("connectionIntentService", () => {
|
||||
.rejects.toThrow("was not found");
|
||||
expect((await service.search(claims, "github")).results).toEqual([
|
||||
expect.objectContaining({ service: "github", state: "available" }),
|
||||
expect.objectContaining({ service: "github-code-review-bot", state: "available" }),
|
||||
expect.objectContaining({ service: "github-copilot", state: "available" }),
|
||||
]);
|
||||
await expect(service.request(claims, "github")).resolves.toMatchObject({
|
||||
|
||||
@@ -56,7 +56,6 @@ export function createConnectionManagementHarness(
|
||||
vi.stubEnv("PAPERCLIP_SECRETS_MASTER_KEY_FILE", join(server.root, "master.key"));
|
||||
await instanceSettingsService(server.db).updateExperimental({
|
||||
enableChatConnectors: true,
|
||||
enableGitHubReviewBots: true,
|
||||
enableGoogleWorkspaceConnector: true,
|
||||
});
|
||||
}, 90_000);
|
||||
|
||||
@@ -142,10 +142,16 @@ describe("instanceSettingsService managed overlay", () => {
|
||||
expect((await service.get()).experimental).toMatchObject(features);
|
||||
expect((await service.getExperimental()).managedKeys).toMatchObject(
|
||||
Object.fromEntries(Object.keys(features)
|
||||
.filter((key) => key !== "enableApps" && key !== "enableMcpAggregators" && key !== "enablePublicMcp" && key !== "enableAwsConnector")
|
||||
.filter((key) =>
|
||||
key !== "enableApps"
|
||||
&& key !== "enableMcpAggregators"
|
||||
&& key !== "enablePublicMcp"
|
||||
&& key !== "enableAwsConnector"
|
||||
&& key !== "enableGitHubReviewBots")
|
||||
.map((key) => [key, { managed: true, managedBy: "paperclip-cloud" }])),
|
||||
);
|
||||
for (const key of Object.keys(features).filter((key) => key !== "enablePublicMcp" && key !== "enableAwsConnector")) {
|
||||
for (const key of Object.keys(features).filter((key) =>
|
||||
key !== "enablePublicMcp" && key !== "enableAwsConnector" && key !== "enableGitHubReviewBots")) {
|
||||
await expect(service.updateExperimental({ [key]: false })).rejects.toMatchObject({
|
||||
status: 403,
|
||||
details: { code: "settings_operator_managed" },
|
||||
@@ -389,4 +395,31 @@ describe("instanceSettingsService managed overlay", () => {
|
||||
expect(persistedSets[0]!.experimental).not.toHaveProperty("managedKeys");
|
||||
expect(Object.prototype.hasOwnProperty.call(updated.experimental, "managedKeys")).toBe(false);
|
||||
});
|
||||
|
||||
it("ignores Cloud-managed values for retired enableGitHubReviewBots and allows legacy off patches", async () => {
|
||||
const managedOff = JSON.stringify({
|
||||
v: 1,
|
||||
mode: "cloud",
|
||||
catalogVersion: "2026.720.0",
|
||||
features: { enableGitHubReviewBots: false, enableStatusCards: true },
|
||||
plugins: { autoInstall: [] },
|
||||
});
|
||||
const managedOn = JSON.stringify({
|
||||
v: 1,
|
||||
mode: "cloud",
|
||||
catalogVersion: "2026.720.0",
|
||||
features: { enableGitHubReviewBots: true },
|
||||
plugins: { autoInstall: [] },
|
||||
});
|
||||
const { db } = stubDb(settingsRow({ enableGitHubReviewBots: false }));
|
||||
const offSvc = instanceSettingsService(db, { runtimeEnv: managedEnv(managedOff) });
|
||||
const experimental = await offSvc.getExperimental();
|
||||
expect(experimental.enableGitHubReviewBots).toBe(true);
|
||||
expect(experimental.managedKeys?.enableGitHubReviewBots).toBeUndefined();
|
||||
|
||||
const onSvc = instanceSettingsService(db, { runtimeEnv: managedEnv(managedOn) });
|
||||
const updated = await onSvc.updateExperimental({ enableGitHubReviewBots: false });
|
||||
expect(updated.experimental.enableGitHubReviewBots).toBe(true);
|
||||
expect(updated.experimental.managedKeys?.enableGitHubReviewBots).toBeUndefined();
|
||||
});
|
||||
});
|
||||
@@ -93,10 +93,15 @@ describe("instance settings service", () => {
|
||||
const disabled = applyExperimentalSettingsPatch(enabled, { enableChatConnectors: false });
|
||||
expect(disabled).toMatchObject({ enableApps: true, enableChatConnectors: false });
|
||||
});
|
||||
it("keeps GitHub review bots independent across legacy normalization and persistence", () => {
|
||||
expect(normalizeExperimentalSettings({ enableChatConnectors: true })).toMatchObject({ enableChatConnectors: true, enableGitHubReviewBots: false });
|
||||
const saved = applyExperimentalSettingsPatch({}, { enableGitHubReviewBots: true });
|
||||
expect(normalizeExperimentalSettings(JSON.parse(JSON.stringify(saved)))).toMatchObject({ enableChatConnectors: false, enableGitHubReviewBots: true });
|
||||
it("always enables GitHub review bots and ignores stored or patched off values", () => {
|
||||
for (const stored of [undefined, null, {}, { enableChatConnectors: false }, { enableGitHubReviewBots: false }]) {
|
||||
expect(normalizeExperimentalSettings(stored).enableGitHubReviewBots).toBe(true);
|
||||
}
|
||||
const saved = applyExperimentalSettingsPatch({}, { enableGitHubReviewBots: false });
|
||||
expect(normalizeExperimentalSettings(JSON.parse(JSON.stringify(saved)))).toMatchObject({
|
||||
enableChatConnectors: false,
|
||||
enableGitHubReviewBots: true,
|
||||
});
|
||||
});
|
||||
it("ignores retired experimental flags without resetting current settings", () => {
|
||||
expect(normalizeExperimentalSettings({
|
||||
@@ -136,7 +141,7 @@ describe("instance settings service", () => {
|
||||
enableCombinedInboxTasks: false,
|
||||
enableArtifactsV1: true,
|
||||
enableChatConnectors: false,
|
||||
enableGitHubReviewBots: false,
|
||||
enableGitHubReviewBots: true,
|
||||
enableMemoryConnectors: false,
|
||||
enablePaperclipNotebook: false,
|
||||
enableGoogleWorkspaceConnector: false,
|
||||
|
||||
@@ -54,30 +54,24 @@ function fixture(
|
||||
}
|
||||
|
||||
describe("chat identity-link preview authority", () => {
|
||||
it.each([false, undefined])("blocks every identity API when chat rollout is disabled (%s)", async (enabled) => {
|
||||
it.each([false, undefined])("blocks experimental chat identity APIs when chat rollout is disabled (%s)", async (enabled) => {
|
||||
settings.getExperimental.mockResolvedValue({ enableChatConnectors: enabled });
|
||||
const f = fixture();
|
||||
await request(f.app).get("/api/chat-identity-links/preview").query({ token }).expect(403);
|
||||
await request(f.app).post("/api/chat-identity-links/confirm").send({ token }).expect(403);
|
||||
await request(f.app).post("/api/chat-identity-links/request-access").send({ token }).expect(403);
|
||||
expect(f.previewIdentityLink).not.toHaveBeenCalled();
|
||||
expect(f.confirmIdentityLink).not.toHaveBeenCalled();
|
||||
expect(f.requestIdentityAccess).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it.each(["github", "slack"])("uses the token’s verified provider when only GitHub bots are enabled (%s)", async (provider) => {
|
||||
settings.getExperimental.mockResolvedValue({ enableChatConnectors: false, enableGitHubReviewBots: true });
|
||||
it.each(["github", "slack"])("admits GitHub identity links without experimental flags while gating Slack (%s)", async (provider) => {
|
||||
settings.getExperimental.mockResolvedValue({ enableChatConnectors: false });
|
||||
const f = fixture();
|
||||
f.previewIdentityLink.mockResolvedValue({ ...preview, provider } as typeof preview);
|
||||
await request(f.app).get("/api/chat-identity-links/preview").query({ token }).expect(provider === "github" ? 200 : 403);
|
||||
await request(f.app).post("/api/chat-identity-links/confirm").send({ token }).expect(provider === "github" ? 200 : 403);
|
||||
expect(f.confirmIdentityLink.mock.calls.length).toBe(provider === "github" ? 1 : 0);
|
||||
});
|
||||
it("does not admit GitHub links under chat-only opt-in", async () => {
|
||||
const f = fixture();
|
||||
f.previewIdentityLink.mockResolvedValue({ ...preview, provider: "github" } as unknown as typeof preview);
|
||||
await request(f.app).get("/api/chat-identity-links/preview").query({ token }).expect(403);
|
||||
});
|
||||
it("returns the preview to a Board member of its exact company", async () => {
|
||||
const { app, previewIdentityLink } = fixture();
|
||||
const response = await request(app)
|
||||
|
||||
@@ -125,33 +125,28 @@ export function chatChannelRoutes(db: Db, options: ChatChannelRouteOptions) {
|
||||
assertBoard(req);
|
||||
const userId = actorUserId(req);
|
||||
if (!userId) throw badRequest("A signed-in Paperclip user is required");
|
||||
// Enforce rollout here: invited nonmembers cannot read the board's
|
||||
// experimental-settings API. A private token never bypasses this gate.
|
||||
// Enforce rollout per provider after resolving the token: invited nonmembers
|
||||
// cannot read the board's experimental-settings API, and GitHub/AgentMail
|
||||
// links remain available while experimental chat connectors are off.
|
||||
const experimental = await instanceSettingsService(db).getExperimental();
|
||||
if (!experimental.enableChatConnectors && !experimental.enableGitHubReviewBots) {
|
||||
throw forbidden("Chat connectors are not enabled on this instance");
|
||||
}
|
||||
return { userId, experimental };
|
||||
}
|
||||
|
||||
function assertIdentityProviderEnabled(
|
||||
provider: string,
|
||||
experimental: { enableChatConnectors: boolean; enableGitHubReviewBots: boolean },
|
||||
experimental: { enableChatConnectors: boolean },
|
||||
) {
|
||||
const enabled = provider === "agentmail" || (provider === "github"
|
||||
? experimental.enableGitHubReviewBots
|
||||
: experimental.enableChatConnectors);
|
||||
const enabled = provider === "agentmail" || provider === "github" || experimental.enableChatConnectors;
|
||||
if (!enabled) throw forbidden("This connector is not enabled on this instance");
|
||||
}
|
||||
|
||||
function assertChatProviderEnabledForCreate(
|
||||
provider: string,
|
||||
experimental: { enableChatConnectors: boolean; enableGitHubReviewBots: boolean },
|
||||
experimental: { enableChatConnectors: boolean },
|
||||
) {
|
||||
if (provider === "agentmail") return;
|
||||
if (provider === "github" ? experimental.enableGitHubReviewBots : experimental.enableChatConnectors) return;
|
||||
const setting = provider === "github" ? "GitHub review bots" : "Chat connectors";
|
||||
throw forbidden(`${setting} is turned off on this instance, so this chat endpoint cannot be created. An instance admin turns it on in Experimental settings at /<prefix>/company/settings/instance/experimental. Agents cannot change instance settings.`);
|
||||
if (provider === "agentmail" || provider === "github") return;
|
||||
if (experimental.enableChatConnectors) return;
|
||||
throw forbidden("Chat connectors is turned off on this instance, so this chat endpoint cannot be created. An instance admin turns it on in Experimental settings at /<prefix>/company/settings/instance/experimental. Agents cannot change instance settings.");
|
||||
}
|
||||
|
||||
async function assertConnectionManager(
|
||||
|
||||
@@ -2590,7 +2590,7 @@ registry.registerPath({
|
||||
summary: "Create a chat endpoint",
|
||||
description:
|
||||
"Creates one provider bot endpoint bound permanently to one Paperclip agent. Provider setup and verification happen in later calls. "
|
||||
+ "Chat providers need Chat connectors, and GitHub needs GitHub review bots, turned on by an instance admin in Experimental settings at /<prefix>/company/settings/instance/experimental. "
|
||||
+ "Experimental chat providers need Chat connectors turned on by an instance admin in Experimental settings at /<prefix>/company/settings/instance/experimental; AgentMail and GitHub are always available. "
|
||||
+ "While that setting is off, connections_search shows the provider as unavailable and this call is refused; agents cannot change it. Link that page as [Experimental settings](/<prefix>/company/settings/instance/experimental) and reply.",
|
||||
request: {
|
||||
params: z.object({ companyId: z.string().uuid() }),
|
||||
|
||||
@@ -19,7 +19,6 @@ const CLOUD_STAGING_EXPERIMENTAL_KEYS: ReadonlySet<string> = new Set([
|
||||
"enableFastResponses",
|
||||
"enableFirstTaskPlanProposal",
|
||||
"enableCloudTrialInference",
|
||||
"enableGitHubReviewBots",
|
||||
"enableGoogleWorkspaceConnector",
|
||||
"enableAwsConnector",
|
||||
"enableGoalsSidebarLink",
|
||||
|
||||
@@ -531,7 +531,7 @@ export function connectionIntentService(db: Db) {
|
||||
const yieldingServices = new Set<string>();
|
||||
const discoveryMethods = (app: (typeof APP_STORE_DEFINITIONS)[number]) => getAvailableConnectionMethods(app)
|
||||
.filter(method => method.purpose !== "channel" || app.slug === "agentmail"
|
||||
|| (method.provider === "github" ? settings.enableGitHubReviewBots : settings.enableChatConnectors));
|
||||
|| method.provider === "github" || settings.enableChatConnectors);
|
||||
const services = [...APP_STORE_DEFINITIONS.filter(app => isConnectorFeatureEnabled(app, settings)
|
||||
&& discoveryMethods(app).length).map((app) => app.slug),
|
||||
...inventory.connections.filter((connection) =>
|
||||
|
||||
@@ -267,7 +267,8 @@ export function normalizeExperimentalSettings(raw: unknown): InstanceExperimenta
|
||||
enableMuse: parsed.data.enableMuse ?? false,
|
||||
enableGrokBot: parsed.data.enableGrokBot ?? false,
|
||||
enableChatConnectors: parsed.data.enableChatConnectors ?? false,
|
||||
enableGitHubReviewBots: parsed.data.enableGitHubReviewBots ?? false,
|
||||
// GitHub review bots graduated from Experimental; ignore historical off values.
|
||||
enableGitHubReviewBots: true,
|
||||
enableMemoryConnectors: parsed.data.enableMemoryConnectors ?? false,
|
||||
enablePaperclipNotebook: parsed.data.enablePaperclipNotebook ?? false,
|
||||
enableGoogleWorkspaceConnector: parsed.data.enableGoogleWorkspaceConnector ?? false,
|
||||
@@ -330,7 +331,7 @@ export function normalizeExperimentalSettings(raw: unknown): InstanceExperimenta
|
||||
enableMuse: false,
|
||||
enableGrokBot: false,
|
||||
enableChatConnectors: false,
|
||||
enableGitHubReviewBots: false,
|
||||
enableGitHubReviewBots: true,
|
||||
enableMemoryConnectors: false,
|
||||
enablePaperclipNotebook: false,
|
||||
enableGoogleWorkspaceConnector: false,
|
||||
@@ -399,9 +400,15 @@ export function applyManagedExperimentalOverlay(
|
||||
>) {
|
||||
// Existing Cloud stack configs may still carry retired flags. Accept the
|
||||
// document during rollout, but never let retired flags disable Apps, Agent Chat, MCP aggregators,
|
||||
// Assistant connections (MCP) or the AWS connector.
|
||||
if (key === "enableApps" || key === "enableAgentChat" || key === "enableMcpAggregators" || key === "enablePublicMcp"
|
||||
|| key === "enableAwsConnector") continue;
|
||||
// Assistant connections (MCP), the AWS connector, or GitHub review bots.
|
||||
if (
|
||||
key === "enableApps"
|
||||
|| key === "enableAgentChat"
|
||||
|| key === "enableMcpAggregators"
|
||||
|| key === "enablePublicMcp"
|
||||
|| key === "enableAwsConnector"
|
||||
|| key === "enableGitHubReviewBots"
|
||||
) continue;
|
||||
next[key] = value;
|
||||
managedKeys[key] = { managed: true, managedBy: PAPERCLIP_CLOUD_MANAGED_BY };
|
||||
}
|
||||
@@ -645,7 +652,7 @@ export function instanceSettingsService(db: Db, options: InstanceSettingsService
|
||||
updateExperimental: async (patch: PatchInstanceExperimentalSettings): Promise<InstanceSettings> => {
|
||||
for (const [key, enabled] of Object.entries(managedConfig?.features ?? {})) {
|
||||
// Retired always-on keys are ignored on read, so an old client's write must not be rejected.
|
||||
if (key === "enablePublicMcp" || key === "enableAwsConnector") continue;
|
||||
if (key === "enablePublicMcp" || key === "enableAwsConnector" || key === "enableGitHubReviewBots") continue;
|
||||
if (enabled && patch[key as ManagedExperimentalFeatureKey] === false) {
|
||||
throw forbidden(`${key} is enabled by Paperclip Cloud and cannot be disabled on this instance`, {
|
||||
code: "settings_operator_managed",
|
||||
|
||||
@@ -595,7 +595,7 @@ test.describe("Board send delivery refresh", () => {
|
||||
const endpointId = "aaaaaaaa-aaaa-4aaa-8aaa-aaaaaaaaaaaa";
|
||||
const conversationId = "bbbbbbbb-bbbb-4bbb-8bbb-bbbbbbbbbbbb";
|
||||
await page.route("**/api/instance/settings/experimental", (route) =>
|
||||
fulfill(route, { enableChatConnectors: false, enableGitHubReviewBots: true }),
|
||||
fulfill(route, { enableChatConnectors: false }),
|
||||
);
|
||||
await page.route(`**/api/issues/${issue.id}/chat-binding`, (route) =>
|
||||
fulfill(route, {
|
||||
|
||||
@@ -151,7 +151,6 @@ test.describe("native chat adapter UI catalog and management", () => {
|
||||
}, testInfo) => {
|
||||
const mock = await installChatControlPlaneMock(page, provider, seed, {
|
||||
enableChatConnectors: provider.provider !== "github",
|
||||
enableGitHubReviewBots: provider.provider === "github",
|
||||
});
|
||||
|
||||
await page.goto(`/${seed.prefix}/apps`);
|
||||
|
||||
@@ -330,15 +330,14 @@ test.describe("native chat adapter UI", () => {
|
||||
expect(mock.slackCreations).toBe(0);
|
||||
});
|
||||
|
||||
test("GitHub: the default-off gate keeps direct tool setup and fences chat routes", async ({
|
||||
test("GitHub: direct tool setup and GitHub review bot routes stay open while experimental chat routes stay fenced", async ({
|
||||
page,
|
||||
}) => {
|
||||
const github = PROVIDERS.find(
|
||||
(provider) => provider.provider === "github",
|
||||
)!;
|
||||
const mock = await installChatControlPlaneMock(page, github, seed, {
|
||||
enableChatConnectors: true,
|
||||
enableGitHubReviewBots: false,
|
||||
enableChatConnectors: false,
|
||||
});
|
||||
|
||||
await page.goto(`/${seed.prefix}/apps`);
|
||||
@@ -365,12 +364,13 @@ test.describe("native chat adapter UI", () => {
|
||||
).toHaveCount(0);
|
||||
|
||||
await page.goto(`/${seed.prefix}/apps/chat/connect?provider=github`);
|
||||
await expect(page).toHaveURL(new RegExp(`/${seed.prefix}/apps/chat/connect\\?provider=github$`));
|
||||
await expect(page.getByRole("heading", { name: "Choose agent" })).toBeVisible();
|
||||
await page.goto(`/${seed.prefix}/apps/chat/connect?provider=discord`);
|
||||
await expect(page).toHaveURL(new RegExp(`/${seed.prefix}/apps$`));
|
||||
await expect(
|
||||
page.getByRole("heading", { name: "Plugins" }),
|
||||
).toBeVisible();
|
||||
await page.goto(`/${seed.prefix}/apps/chat/endpoint-github/settings`);
|
||||
await expect(page).toHaveURL(new RegExp(`/${seed.prefix}/apps$`));
|
||||
await expect.poll(() => mock.chatEndpointListReads).toBeGreaterThan(0);
|
||||
await expect(page.getByRole("button", { name: "Connect AgentMail", exact: true })).toBeVisible();
|
||||
expect(mock.createdWithAgentId).toBeNull();
|
||||
@@ -402,9 +402,7 @@ test.describe("native chat adapter UI", () => {
|
||||
await expect(agentNavigation.getByRole("link", { name: "Identity", exact: true })).toBeVisible();
|
||||
await expect(agentNavigation.getByRole("link", { name: "Channels", exact: true })).toHaveCount(0);
|
||||
await expect.poll(() => mock.chatEndpointListReads).toBeGreaterThan(0);
|
||||
if (!enabled) {
|
||||
await expect(page.getByText("Connect AgentMail from Connectors.", { exact: true })).toBeVisible();
|
||||
}
|
||||
await expect(page.getByText("Connect an agent identity from Connectors.", { exact: true })).toBeVisible();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
@@ -352,12 +352,11 @@ export async function installChatControlPlaneMock(
|
||||
seed: Seed,
|
||||
{
|
||||
enableChatConnectors,
|
||||
enableGitHubReviewBots = false,
|
||||
resourceCount = 2,
|
||||
photonShared = false,
|
||||
automaticSlack = false,
|
||||
managedSlack = false,
|
||||
}: { enableChatConnectors: boolean; enableGitHubReviewBots?: boolean; resourceCount?: number; photonShared?: boolean; automaticSlack?: boolean; managedSlack?: boolean },
|
||||
}: { enableChatConnectors: boolean; resourceCount?: number; photonShared?: boolean; automaticSlack?: boolean; managedSlack?: boolean },
|
||||
): Promise<ChatMock> {
|
||||
const endpoint = endpointFixture(provider, seed);
|
||||
if (automaticSlack || managedSlack) endpoint.setup.slackSetupMethod = managedSlack ? "managed" : "automatic";
|
||||
@@ -562,7 +561,6 @@ export async function installChatControlPlaneMock(
|
||||
) {
|
||||
await fulfill(route, {
|
||||
enableChatConnectors,
|
||||
enableGitHubReviewBots,
|
||||
enableIsolatedWorkspaces: false,
|
||||
});
|
||||
return;
|
||||
|
||||
@@ -19,8 +19,6 @@ export async function runGitHubReviewFlow(input: {
|
||||
authenticateRegistration?(page: Page): Promise<void>;
|
||||
}) {
|
||||
const { page, github, api, config, resources, evidence } = input;
|
||||
const capabilities = await api.get('/api/instance/settings/experimental');
|
||||
if (capabilities.enableGitHubReviewBots !== true) throw new ConnectionBlock("blocked_target", "github_review_capability_unavailable");
|
||||
const company = await api.get(`/api/companies/${config.target.companyId}`);
|
||||
const agent = await api.get(`/api/agents/${config.agent.id}`);
|
||||
if (company.id !== config.target.companyId || agent.companyId !== company.id || agent.name !== config.agent.name || !["idle", "running"].includes(agent.status)) throw new ConnectionBlock("blocked_target", "configured_review_agent_unavailable");
|
||||
|
||||
@@ -121,7 +121,6 @@ describe("reused target ownership", () => {
|
||||
const setup = parseGitHubReviewJourneyConfig(config());
|
||||
const company = { id: setup.target.companyId, issuePrefix: "QA" };
|
||||
const rows: Record<string, unknown> = {
|
||||
"/api/instance/settings/experimental": { enableGitHubReviewBots: true },
|
||||
[`/api/companies/${company.id}`]: company,
|
||||
[`/api/agents/${setup.agent.id}`]: { companyId: company.id, name: setup.agent.name, status: "idle", defaultEnvironmentId: null, adapterConfig: { model: setup.agent.model } },
|
||||
[`/api/environments/${setup.target.environmentId}`]: { id: setup.target.environmentId, driver: "local", status: "active", config: {} },
|
||||
|
||||
@@ -233,8 +233,8 @@
|
||||
"packages/shared/src/connection-search.ts": "6aa86e3fb28a8e32da1aa99b841aacede055e0bf",
|
||||
"packages/shared/src/connection-setup-state.test.ts": "252f1a1627b80f322385a415df4656f8aa9148e9",
|
||||
"packages/shared/src/connection-setup-state.ts": "becd04545f04d601b4292c9b5cec4b737adc5e69",
|
||||
"packages/shared/src/connector-availability.test.ts": "eea485b72e5163f2d41220b50fa41483c691415e",
|
||||
"packages/shared/src/connector-availability.ts": "82aec0dfb2e9b8cb04e21c4bcd9aab74b087c76a",
|
||||
"packages/shared/src/connector-availability.test.ts": "3176063aceda66949f661466fcb5be352265e5af",
|
||||
"packages/shared/src/connector-availability.ts": "7797798bc989b774e8b6e62748ad689f66ab4193",
|
||||
"packages/shared/src/connector-identity.test.ts": "d58357707faefa7c98bb906cdaeb4db39d31081a",
|
||||
"packages/shared/src/connector-identity.ts": "5ede83c9c5225dbe8af9cf3a49c74e477ef5b955",
|
||||
"packages/shared/src/constants.ts": "3f1500b70505cd586f5430ad1acb1851bf053fb1",
|
||||
@@ -261,7 +261,7 @@
|
||||
"packages/shared/src/external-objects.ts": "a9953c4e3f77f2bad03cb7832914ffc0b1a1266a",
|
||||
"packages/shared/src/fast-response.ts": "a81332a2b46b59c1f6953cfc4da659eae2326beb",
|
||||
"packages/shared/src/feature-catalog.test.ts": "d3e000c039492daad1fe0b7302b34e7c3816a8ce",
|
||||
"packages/shared/src/feature-catalog.ts": "468dbae9dba45b45f1a993de9307c5b6409f513c",
|
||||
"packages/shared/src/feature-catalog.ts": "ee5d2b79ecfb9285326dec314fecccc9b0b4cc7b",
|
||||
"packages/shared/src/frontmatter-runner-contract.test.ts": "cd121330e10aaa9da36c16293bcd9760561b6b41",
|
||||
"packages/shared/src/frontmatter.test.ts": "56635e331c8abca8868da76f23a08e98f20ff07f",
|
||||
"packages/shared/src/frontmatter.ts": "a86e046ce588d2f92d4996122cc2068ec275e89c",
|
||||
@@ -440,7 +440,7 @@
|
||||
"packages/shared/src/types/inbox-dismissal.ts": "58fb7013847396ac9971eb5799dd0bf0486e0371",
|
||||
"packages/shared/src/types/inbox-mine.ts": "1d302b531d34842189704abd2f75f8743d09490d",
|
||||
"packages/shared/src/types/index.ts": "44184c2badaf7cdf46ab5f574e85e0e3fa7a0b60",
|
||||
"packages/shared/src/types/instance.ts": "ba01ade6bf1071ab19419b4c60bc062f05f09212",
|
||||
"packages/shared/src/types/instance.ts": "406736718fa7e8f788d4e963291943d38c16a368",
|
||||
"packages/shared/src/types/issue-tree-control.ts": "75489fffd491b8350b05caf57d7796419797d9df",
|
||||
"packages/shared/src/types/issue.ts": "fe78765782a50faf24e91e76e39846a4ace2cfc5",
|
||||
"packages/shared/src/types/live.ts": "b90e55e4de8600c6fc17d7fa8d89079d4ae655ec",
|
||||
@@ -518,8 +518,8 @@
|
||||
"packages/shared/src/validators/goal.ts": "602724134915e1e83c50115abba36b288c0abd3d",
|
||||
"packages/shared/src/validators/inbox-agent-policy.ts": "29cef157f4d9b564fd813868038aa8c813df4a7b",
|
||||
"packages/shared/src/validators/index.ts": "25a142aeffc3b395993347c2d7bb0538738fefc3",
|
||||
"packages/shared/src/validators/instance.test.ts": "3faa9593a9a05f74429d9b1d2251906a03e9a903",
|
||||
"packages/shared/src/validators/instance.ts": "1c151c58a13a8aedc8ed04b9c07d31f23fd41d40",
|
||||
"packages/shared/src/validators/instance.test.ts": "a8eac3e9a6eed97d6aa4f54e14e77c44720600af",
|
||||
"packages/shared/src/validators/instance.ts": "9cfe716ebf4dc1e24324e162ca096cdacbe97c4a",
|
||||
"packages/shared/src/validators/issue-chat-bootstrap.test.ts": "e1ebb9aa94da22c825bc3ddd32ce2cfc98bfe645",
|
||||
"packages/shared/src/validators/issue-tree-control.ts": "7144ef86a83e008ac0626e1d62a1d6164c46f438",
|
||||
"packages/shared/src/validators/issue.test.ts": "7584bcce33a933ebcb02695b439767163e5ef61a",
|
||||
|
||||
+2
-2
@@ -471,8 +471,8 @@ function AppsConnectEntryRoute({
|
||||
} = {}) {
|
||||
const location = useLocation();
|
||||
const searchParams = new URLSearchParams(location.search);
|
||||
const { enabled: chatConnectorsEnabled, githubEnabled: githubReviewBotsEnabled } = useChatConnectorsEnabled();
|
||||
return canEnterAppsConnect(searchParams, { chatConnectorsEnabled, githubReviewBotsEnabled })
|
||||
const { enabled: chatConnectorsEnabled } = useChatConnectorsEnabled();
|
||||
return canEnterAppsConnect(searchParams, { chatConnectorsEnabled })
|
||||
? <AppsConnect credentialSource={credentialSource} />
|
||||
: <Navigate to="/apps" replace />;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ function ProviderEndpointGate({
|
||||
queryFn: () => chatEndpointsApi.get(endpointId),
|
||||
});
|
||||
const endpointView = useQueryView(endpoint);
|
||||
const { enabled, githubEnabled } = useChatConnectorsEnabled();
|
||||
const { enabled } = useChatConnectorsEnabled();
|
||||
// A cached endpoint keeps gating the page through an outage; only a real
|
||||
// failure with nothing loaded shows the error.
|
||||
if (endpointView.kind === "error")
|
||||
@@ -36,7 +36,7 @@ function ProviderEndpointGate({
|
||||
/>
|
||||
);
|
||||
if (!endpoint.data) return null;
|
||||
return chatProviderVisible(endpoint.data.provider, enabled, githubEnabled) ? (
|
||||
return chatProviderVisible(endpoint.data.provider, enabled) ? (
|
||||
<>{children}</>
|
||||
) : (
|
||||
<Navigate to="/apps" replace />
|
||||
@@ -48,10 +48,10 @@ export function ChatConnectorsExperimentalGate({
|
||||
}: {
|
||||
children: ReactNode;
|
||||
}) {
|
||||
const { enabled, githubEnabled, loaded } = useChatConnectorsEnabled();
|
||||
const { enabled, loaded } = useChatConnectorsEnabled();
|
||||
const [params] = useSearchParams();
|
||||
const { endpointId } = useParams<{ endpointId: string }>();
|
||||
if (!endpointId && params.get("provider") === "agentmail")
|
||||
if (!endpointId && (params.get("provider") === "agentmail" || params.get("provider") === "github"))
|
||||
return <>{children}</>;
|
||||
if (!loaded) return null;
|
||||
if (endpointId)
|
||||
@@ -60,7 +60,7 @@ export function ChatConnectorsExperimentalGate({
|
||||
{children}
|
||||
</ProviderEndpointGate>
|
||||
);
|
||||
return chatProviderVisible(params.get("provider"), enabled, githubEnabled) ? (
|
||||
return chatProviderVisible(params.get("provider"), enabled) ? (
|
||||
<>{children}</>
|
||||
) : (
|
||||
<Navigate to="/apps" replace />
|
||||
|
||||
@@ -27,7 +27,7 @@ export function AgentChannelsPanel({
|
||||
companyId: string;
|
||||
agentId: string;
|
||||
}) {
|
||||
const { enabled, githubEnabled } = useChatConnectorsEnabled();
|
||||
const { enabled } = useChatConnectorsEnabled();
|
||||
const query = useQuery({
|
||||
queryKey: queryKeys.chatEndpoints.list(companyId),
|
||||
queryFn: () => chatEndpointsApi.list(companyId),
|
||||
@@ -35,7 +35,7 @@ export function AgentChannelsPanel({
|
||||
});
|
||||
const endpoints = (query.data ?? []).filter(
|
||||
(endpoint) =>
|
||||
endpoint.assignedAgentId === agentId && endpoint.status !== "archived" && chatProviderVisible(endpoint.provider, enabled, githubEnabled),
|
||||
endpoint.assignedAgentId === agentId && endpoint.status !== "archived" && chatProviderVisible(endpoint.provider, enabled),
|
||||
);
|
||||
return (
|
||||
<section className="max-w-3xl space-y-5">
|
||||
@@ -59,7 +59,7 @@ export function AgentChannelsPanel({
|
||||
<div className="rounded-lg border border-dashed border-border p-5">
|
||||
<p className="text-sm font-medium">No channels connected</p>
|
||||
<p className="mt-1 text-sm text-muted-foreground">
|
||||
{enabled || githubEnabled ? "Connect an agent identity from Connectors." : "Connect AgentMail from Connectors."}
|
||||
Connect an agent identity from Connectors.
|
||||
</p>
|
||||
<Button asChild className="mt-3" variant="outline" size="sm">
|
||||
<Link to="/apps">Open Connectors</Link>
|
||||
|
||||
@@ -41,7 +41,7 @@ vi.mock("@/hooks/useDurableSubmit", async (importOriginal) => {
|
||||
});
|
||||
vi.mock("@/hooks/useChatConnectorsEnabled", async (importOriginal) => ({
|
||||
...await importOriginal<typeof import("@/hooks/useChatConnectorsEnabled")>(),
|
||||
useChatConnectorsEnabled: () => ({ enabled: true, githubEnabled: true, loaded: true }),
|
||||
useChatConnectorsEnabled: () => ({ enabled: true, loaded: true }),
|
||||
}));
|
||||
|
||||
vi.mock("@/api/chatEndpoints", () => ({
|
||||
|
||||
@@ -122,15 +122,15 @@ const filePhaseLabels: Record<ChatFileTransferPhase, string> = {
|
||||
};
|
||||
|
||||
export function useIssueChatBinding(companyId: string, issueId: string) {
|
||||
const { enabled, githubEnabled } = useChatConnectorsEnabled();
|
||||
const queryEnabled = (enabled || githubEnabled) && Boolean(companyId && issueId) && !issueId.startsWith("chat:");
|
||||
const { enabled } = useChatConnectorsEnabled();
|
||||
const queryEnabled = Boolean(companyId && issueId) && !issueId.startsWith("chat:");
|
||||
const query = useQuery({
|
||||
queryKey: ["issue-chat-binding", companyId, issueId],
|
||||
queryFn: () => chatEndpointsApi.getIssueBinding(issueId),
|
||||
enabled: queryEnabled,
|
||||
});
|
||||
return {
|
||||
binding: queryEnabled && chatProviderVisible(query.data?.provider, enabled, githubEnabled) ? (query.data ?? null) : null,
|
||||
binding: queryEnabled && chatProviderVisible(query.data?.provider, enabled) ? (query.data ?? null) : null,
|
||||
isLoading: queryEnabled && query.isLoading,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ vi.mock("@/hooks/useCloudInstance", () => ({
|
||||
useCloudInstance: () => false,
|
||||
}));
|
||||
vi.mock("@/hooks/useChatConnectorsEnabled", () => ({
|
||||
useChatConnectorsEnabled: () => ({ enabled: false, githubEnabled: false }),
|
||||
useChatConnectorsEnabled: () => ({ enabled: false }),
|
||||
chatProviderVisible: () => true,
|
||||
}));
|
||||
vi.mock("@/hooks/useMemoryConnectorsEnabled", () => ({
|
||||
|
||||
@@ -695,7 +695,7 @@ function StandardConnectionSetupFlow({
|
||||
}, [host, routeNavigate]);
|
||||
const routeParams = useParams<{ appKey?: string }>();
|
||||
const { selectedCompany, selectedCompanyId } = useCompany();
|
||||
const { enabled: chatConnectorsEnabled, githubEnabled } = useChatConnectorsEnabled();
|
||||
const { enabled: chatConnectorsEnabled } = useChatConnectorsEnabled();
|
||||
const { enabled: memoryConnectorsEnabled } = useMemoryConnectorsEnabled();
|
||||
const connectorAvailability = useConnectorAvailability();
|
||||
const { setBreadcrumbs } = useBreadcrumbs();
|
||||
@@ -1205,11 +1205,11 @@ function StandardConnectionSetupFlow({
|
||||
const visibleGalleryApps = useMemo(
|
||||
() => (galleryQuery.data?.apps ?? []).filter((app) => (memoryConnectorsEnabled || !isMemoryConnectorId(app.slug))
|
||||
&& connectorAvailability.enabled(app)).filter((app) =>
|
||||
chatProviderVisible(app.slug, chatConnectorsEnabled, githubEnabled) ||
|
||||
chatProviderVisible(app.slug, chatConnectorsEnabled) ||
|
||||
!app.methods.some((method) => method.purpose === "channel") ||
|
||||
appSupportsToolCatalogSetup(app),
|
||||
),
|
||||
[galleryQuery.data, chatConnectorsEnabled, githubEnabled, memoryConnectorsEnabled, connectorAvailability.enabled],
|
||||
[galleryQuery.data, chatConnectorsEnabled, memoryConnectorsEnabled, connectorAvailability.enabled],
|
||||
);
|
||||
const cloudInstance = useCloudInstance();
|
||||
const bundledRequestedDefinition = requestedAppKey
|
||||
|
||||
@@ -10,11 +10,10 @@ import { queryKeys } from "@/lib/queryKeys";
|
||||
|
||||
let detachedClient: QueryClient | null = null;
|
||||
|
||||
/** Independent default-off visibility gates; these do not pause existing provider delivery. */
|
||||
/** Default-off visibility gate for experimental chat connectors; does not pause existing provider delivery. */
|
||||
export function useChatConnectorsEnabled(): {
|
||||
enabled: boolean;
|
||||
loaded: boolean;
|
||||
githubEnabled: boolean;
|
||||
} {
|
||||
const contextClient = useContext(QueryClientContext);
|
||||
const query = useQuery(
|
||||
@@ -28,12 +27,11 @@ export function useChatConnectorsEnabled(): {
|
||||
const { data, isFetched } = query;
|
||||
const view = useQueryView(query);
|
||||
if (!contextClient)
|
||||
return { enabled: false, githubEnabled: false, loaded: true };
|
||||
// Derive the gates from data, not `isError`: cached settings stay visible while a
|
||||
return { enabled: false, loaded: true };
|
||||
// Derive the gate from data, not `isError`: cached settings stay visible while a
|
||||
// refetch is failing; only a no-data failure reports `loaded` without the flag.
|
||||
return {
|
||||
enabled: view.kind !== "error" && data?.enableChatConnectors === true,
|
||||
githubEnabled: view.kind !== "error" && data?.enableGitHubReviewBots === true,
|
||||
loaded: isFetched,
|
||||
};
|
||||
}
|
||||
@@ -42,12 +40,11 @@ export function useChatConnectorsEnabled(): {
|
||||
export function chatProviderVisible(
|
||||
provider: string | null | undefined,
|
||||
chatEnabled: boolean,
|
||||
githubEnabled: boolean,
|
||||
) {
|
||||
return (
|
||||
provider === "agentmail" ||
|
||||
(provider === "github" || provider === "github-code-review-bot"
|
||||
? githubEnabled
|
||||
: chatEnabled)
|
||||
provider === "github" ||
|
||||
provider === "github-code-review-bot" ||
|
||||
chatEnabled
|
||||
);
|
||||
}
|
||||
@@ -97,7 +97,6 @@ import { TooltipProvider } from "@/components/ui/tooltip";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { AgentToolsTab } from "./AgentToolsTab";
|
||||
import { AgentChannelsPanel } from "../components/chat/AgentChannelsPanel";
|
||||
import { useChatConnectorsEnabled } from "@/hooks/useChatConnectorsEnabled";
|
||||
import {
|
||||
isUuidLike,
|
||||
type Agent,
|
||||
@@ -297,10 +296,7 @@ export function AgentDetail() {
|
||||
const location = useLocation();
|
||||
const [actionError, setActionError] = useState<string | null>(null);
|
||||
const [dismissedLeftAgentIds, setDismissedLeftAgentIds] = useState<Set<string>>(() => new Set());
|
||||
const { enabled: chatEnabled, githubEnabled, loaded: chatConnectorsLoaded } = useChatConnectorsEnabled();
|
||||
const chatConnectorsEnabled = chatEnabled || githubEnabled;
|
||||
const activeView = urlRunId ? "runs" as AgentDetailView
|
||||
: urlTab === "channels" && !chatConnectorsEnabled ? "dashboard" : parseAgentDetailView(urlTab ?? null);
|
||||
const activeView = urlRunId ? "runs" as AgentDetailView : parseAgentDetailView(urlTab ?? null);
|
||||
const needsDashboardData = activeView === "dashboard";
|
||||
const needsRunData = activeView === "runs" || Boolean(urlRunId);
|
||||
const shouldLoadHeartbeats = needsDashboardData || needsRunData;
|
||||
@@ -490,7 +486,6 @@ export function AgentDetail() {
|
||||
|
||||
useEffect(() => {
|
||||
if (!agent) return;
|
||||
if (!urlRunId && urlTab === "channels" && !chatConnectorsLoaded) return;
|
||||
if (urlRunId) {
|
||||
if (routeAgentRef !== canonicalAgentRef) {
|
||||
navigate(`/agents/${canonicalAgentRef}/runs/${urlRunId}`, { replace: true });
|
||||
@@ -519,7 +514,7 @@ export function AgentDetail() {
|
||||
navigate(`/agents/${canonicalAgentRef}/${canonicalTab}${location.search}`, { replace: true });
|
||||
return;
|
||||
}
|
||||
}, [agent, routeAgentRef, canonicalAgentRef, urlRunId, urlTab, activeView, navigate, chatConnectorsLoaded, location.search]);
|
||||
}, [agent, routeAgentRef, canonicalAgentRef, urlRunId, urlTab, activeView, navigate, location.search]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!agent?.companyId || agent.companyId === selectedCompanyId) return;
|
||||
@@ -942,7 +937,7 @@ export function AgentDetail() {
|
||||
onValueChange={handleAgentTabChange}
|
||||
>
|
||||
<PageTabBar
|
||||
items={AGENT_DETAIL_TABS.filter((item) => item.value !== "channels" || chatConnectorsEnabled)}
|
||||
items={AGENT_DETAIL_TABS}
|
||||
value={activeView}
|
||||
onValueChange={handleAgentTabChange}
|
||||
/>
|
||||
|
||||
@@ -359,7 +359,7 @@ export function InstanceExperimentalSettings() {
|
||||
<ExperimentalToggleCard
|
||||
title="Chat connectors"
|
||||
description="Connect agents to Slack, Discord, Microsoft Teams, and Telegram conversations."
|
||||
footnote="Turning this off hides experimental chat setup and connected-task controls. Existing chat connections keep running. AgentMail, GitHub review bots, and tool connectors are controlled separately."
|
||||
footnote="Turning this off hides experimental chat setup and connected-task controls. Existing chat connections keep running. AgentMail, GitHub review bots, and tool connectors are unaffected."
|
||||
checked={enableChatConnectors}
|
||||
onCheckedChange={(checked) => toggleMutation.mutate({ enableChatConnectors: checked })}
|
||||
disabled={toggleMutation.isPending}
|
||||
@@ -521,18 +521,6 @@ export function InstanceExperimentalSettings() {
|
||||
ariaLabel="Toggle first task plan proposal experimental setting"
|
||||
/>
|
||||
|
||||
<ExperimentalToggleCard
|
||||
title="GitHub review bots"
|
||||
description="Connect agents to GitHub with their own App identity to review pull requests and respond to issues."
|
||||
footnote="Independent of Chat connectors. Turning this off hides setup and management; existing bots keep running. GitHub tool connections stay available."
|
||||
checked={experimentalQuery.data?.enableGitHubReviewBots === true}
|
||||
onCheckedChange={(checked) => toggleMutation.mutate({ enableGitHubReviewBots: checked })}
|
||||
disabled={toggleMutation.isPending}
|
||||
settingKey="enableGitHubReviewBots"
|
||||
managed={managedKeys.enableGitHubReviewBots}
|
||||
ariaLabel="Toggle GitHub review bots experimental setting"
|
||||
/>
|
||||
|
||||
<ExperimentalToggleCard
|
||||
title="Google Workspace connector (Paperclip)"
|
||||
description="Show the built-in Google Workspace connector for Gmail, Drive, and Calendar while Google verification is pending."
|
||||
|
||||
@@ -458,7 +458,7 @@ export function Browse({ renderAccountDetails = (connection) => connection.conne
|
||||
const assistantConnections = useAssistantConnections();
|
||||
const tailscaleConnections = useTailscaleConnections(selectedCompanyId);
|
||||
const { userId: viewingUserId, settled: identitySettled } = useAccountIdentity();
|
||||
const { enabled: chatConnectorsEnabled, githubEnabled } = useChatConnectorsEnabled();
|
||||
const { enabled: chatConnectorsEnabled } = useChatConnectorsEnabled();
|
||||
const { enabled: memoryConnectorsEnabled } = useMemoryConnectorsEnabled();
|
||||
const connectorAvailability = useConnectorAvailability();
|
||||
const googleWorkspaceConnectorEnabled = connectorAvailability.enabled(getConnectableAppDefinition("google-workspace"));
|
||||
@@ -657,11 +657,11 @@ export function Browse({ renderAccountDetails = (connection) => connection.conne
|
||||
if (!connectorEnabled(entry)) return false;
|
||||
const definition = getAppStoreDefinition(appDefinitionSlug(entry));
|
||||
return (
|
||||
chatProviderVisible(appDefinitionSlug(entry), chatConnectorsEnabled, githubEnabled) ||
|
||||
chatProviderVisible(appDefinitionSlug(entry), chatConnectorsEnabled) ||
|
||||
!definition?.methods.some((method) => method.purpose === "channel") ||
|
||||
appSupportsToolCatalogSetup(definition)
|
||||
);
|
||||
}), [galleryQuery.data, memoryConnectorsEnabled, connectorEnabled, chatConnectorsEnabled, githubEnabled]);
|
||||
}), [galleryQuery.data, memoryConnectorsEnabled, connectorEnabled, chatConnectorsEnabled]);
|
||||
const userProfileById = useMemo(
|
||||
() => buildCompanyUserProfileMap(userDirectoryQuery.data?.users),
|
||||
[userDirectoryQuery.data],
|
||||
@@ -713,7 +713,7 @@ export function Browse({ renderAccountDetails = (connection) => connection.conne
|
||||
slug,
|
||||
name: appDefinitionName(entry),
|
||||
description:
|
||||
!chatProviderVisible(slug, chatConnectorsEnabled, githubEnabled) && chatProviderForSlug(slug)
|
||||
!chatProviderVisible(slug, chatConnectorsEnabled) && chatProviderForSlug(slug)
|
||||
? appCopyFor(slug).tagline
|
||||
: appDefinitionDescription(entry),
|
||||
brandKey: slug,
|
||||
@@ -759,7 +759,7 @@ export function Browse({ renderAccountDetails = (connection) => connection.conne
|
||||
"Chat with agents from Telegram direct messages, groups, and topics.",
|
||||
},
|
||||
] as const;
|
||||
for (const item of nativeChatApps.filter(item => chatProviderVisible(item.slug, chatConnectorsEnabled, githubEnabled))) {
|
||||
for (const item of nativeChatApps.filter(item => chatProviderVisible(item.slug, chatConnectorsEnabled))) {
|
||||
if (rowsBySlug.has(item.slug)) continue;
|
||||
rowsBySlug.set(item.slug, {
|
||||
key: `native-chat:${item.slug}`,
|
||||
@@ -848,7 +848,7 @@ export function Browse({ renderAccountDetails = (connection) => connection.conne
|
||||
});
|
||||
}
|
||||
|
||||
for (const endpoint of (chatEndpointsQuery.data ?? []).filter(endpoint => chatProviderVisible(endpoint.provider, chatConnectorsEnabled, githubEnabled))) {
|
||||
for (const endpoint of (chatEndpointsQuery.data ?? []).filter(endpoint => chatProviderVisible(endpoint.provider, chatConnectorsEnabled))) {
|
||||
if (endpoint.status === "archived") continue;
|
||||
let target = [...rowsBySlug.values()].find(
|
||||
(row) => chatProviderForSlug(row.slug) === endpoint.provider,
|
||||
@@ -903,7 +903,6 @@ export function Browse({ renderAccountDetails = (connection) => connection.conne
|
||||
&& (managedCatalogIdentities.has(aggregatorAppIdentity(row!.slug)) || managedCatalogIdentities.has(aggregatorAppIdentity(row!.name)))
|
||||
&& nativeConnectorRequiresCustomerOAuthApp({ ...row!.entry!, methods: declaredMethods ?? [] }, {
|
||||
enableChatConnectors: chatConnectorsEnabled,
|
||||
enableGitHubReviewBots: githubEnabled,
|
||||
});
|
||||
}
|
||||
yieldDecisions.set(slug, yields);
|
||||
@@ -969,7 +968,6 @@ export function Browse({ renderAccountDetails = (connection) => connection.conne
|
||||
applicationsQuery.data,
|
||||
chatEndpointsQuery.data,
|
||||
chatConnectorsEnabled,
|
||||
githubEnabled,
|
||||
connectionsQuery.data,
|
||||
tailscaleConnections.data,
|
||||
tailscaleConnections.canManage,
|
||||
@@ -1088,7 +1086,6 @@ export function Browse({ renderAccountDetails = (connection) => connection.conne
|
||||
preselectedAgentId={preselectedChatAgentId}
|
||||
chatConnectorsEnabled={chatConnectorsEnabled}
|
||||
setupEnabled={setupEnabledFor(row)}
|
||||
githubReviewBotsEnabled={githubEnabled}
|
||||
onConnectAggregator={connectAggregator}
|
||||
onManageAggregator={(app, connectionId) => setAggregatorToManage({ app, connectionId })}
|
||||
onRefreshAggregator={connectionId => refreshAggregator.mutate(connectionId)}
|
||||
@@ -1103,7 +1100,7 @@ export function Browse({ renderAccountDetails = (connection) => connection.conne
|
||||
);
|
||||
const connectActionFor = (row: ConnectorRowModel) => {
|
||||
if (row.networkConnections || !setupEnabledFor(row)) return null;
|
||||
const action = connectorAction(row, chatProviderVisible(row.slug, chatConnectorsEnabled, githubEnabled), preselectedChatAgentId);
|
||||
const action = connectorAction(row, chatProviderVisible(row.slug, chatConnectorsEnabled), preselectedChatAgentId);
|
||||
return {
|
||||
label: action.label,
|
||||
title: action.title,
|
||||
@@ -1386,7 +1383,6 @@ export function ConnectorCard({
|
||||
preselectedAgentId,
|
||||
chatConnectorsEnabled,
|
||||
setupEnabled = true,
|
||||
githubReviewBotsEnabled = false,
|
||||
onConnectAggregator,
|
||||
onManageAggregator,
|
||||
onRefreshComposio,
|
||||
@@ -1411,7 +1407,6 @@ export function ConnectorCard({
|
||||
preselectedAgentId?: string | null;
|
||||
chatConnectorsEnabled: boolean;
|
||||
setupEnabled?: boolean;
|
||||
githubReviewBotsEnabled?: boolean;
|
||||
onConnectAggregator?: (app: AggregatorAppCatalogEntry) => void;
|
||||
onManageAggregator?: (app: AggregatorAppCatalogEntry, connectionId?: string) => void;
|
||||
onRefreshComposio?: (connectionId: string) => void;
|
||||
@@ -1434,7 +1429,7 @@ export function ConnectorCard({
|
||||
}, [defaultExpanded, searchQuery]);
|
||||
const action = connectorAction(
|
||||
row,
|
||||
chatProviderVisible(row.slug, chatConnectorsEnabled, githubReviewBotsEnabled),
|
||||
chatProviderVisible(row.slug, chatConnectorsEnabled),
|
||||
preselectedAgentId,
|
||||
);
|
||||
const upstreamAccounts = (row.upstreamApps ?? []).flatMap(snapshot => {
|
||||
|
||||
@@ -102,7 +102,7 @@ describe("app connect policy", () => {
|
||||
const href = appSourceConnectHref(app.slug);
|
||||
const searchParams = new URL(href, "http://paperclip.test").searchParams;
|
||||
|
||||
expect(canEnterAppsConnect(searchParams, { chatConnectorsEnabled: true, githubReviewBotsEnabled: true }), app.slug).toBe(true);
|
||||
expect(canEnterAppsConnect(searchParams, { chatConnectorsEnabled: true }), app.slug).toBe(true);
|
||||
expect(resolveAppsConnectRouteKey({ sourceSlug: searchParams.get("source") }), app.slug).toBe(app.slug);
|
||||
}
|
||||
});
|
||||
@@ -116,15 +116,16 @@ describe("app connect policy", () => {
|
||||
expect(resolveAppsConnectRouteKey({})).toBeUndefined();
|
||||
});
|
||||
|
||||
it("admits the GitHub bot independently of chat setup and keeps tools available", () => {
|
||||
it("admits the GitHub bot without experimental chat flags and keeps tools available", () => {
|
||||
const bot = new URLSearchParams("source=github-code-review-bot");
|
||||
expect(canEnterAppsConnect(bot, { chatConnectorsEnabled: true })).toBe(false);
|
||||
expect(canEnterAppsConnect(bot, { githubReviewBotsEnabled: true })).toBe(true);
|
||||
expect(canEnterAppsConnect(new URLSearchParams("source=discord"), { githubReviewBotsEnabled: true })).toBe(false);
|
||||
expect(canEnterAppsConnect(bot)).toBe(true);
|
||||
expect(canEnterAppsConnect(bot, { chatConnectorsEnabled: false })).toBe(true);
|
||||
expect(canEnterAppsConnect(new URLSearchParams("source=discord"))).toBe(false);
|
||||
expect(canEnterAppsConnect(new URLSearchParams("source=github"))).toBe(true);
|
||||
});
|
||||
it("retains GitHub tools but denies chat-only deep links while chat connectors are disabled", () => {
|
||||
it("retains GitHub tools, GitHub review bots, and AgentMail while denying chat-only deep links when chat connectors are disabled", () => {
|
||||
expect(canEnterAppsConnect(new URLSearchParams("source=github"))).toBe(true);
|
||||
expect(canEnterAppsConnect(new URLSearchParams("source=github-code-review-bot"))).toBe(true);
|
||||
expect(canEnterAppsConnect(new URLSearchParams("source=agentmail"))).toBe(true);
|
||||
for (const source of ["discord", "telegram", "microsoft-teams", "speko"]) {
|
||||
expect(canEnterAppsConnect(new URLSearchParams({ source })), source).toBe(false);
|
||||
|
||||
@@ -56,7 +56,7 @@ export function resolveAppsConnectRouteKey(input: {
|
||||
|
||||
export function canEnterAppsConnect(
|
||||
searchParams: URLSearchParams,
|
||||
{ chatConnectorsEnabled = false, githubReviewBotsEnabled = false }: { chatConnectorsEnabled?: boolean; githubReviewBotsEnabled?: boolean } = {},
|
||||
{ chatConnectorsEnabled = false }: { chatConnectorsEnabled?: boolean } = {},
|
||||
): boolean {
|
||||
if (searchParams.get("aiLogin")?.trim()) return true;
|
||||
if (searchParams.get("byo") === "1") {
|
||||
@@ -80,10 +80,10 @@ export function canEnterAppsConnect(
|
||||
// plugin instead of bouncing back to the catalog.
|
||||
if (isPluginAppSlug(source)) return true;
|
||||
const entry = getAppStoreDefinition(source);
|
||||
const channelEnabled = source === "github-code-review-bot" ? githubReviewBotsEnabled : chatConnectorsEnabled;
|
||||
const alwaysAvailableChannel = source === "agentmail" || source === "github-code-review-bot";
|
||||
const channelEnabled = alwaysAvailableChannel || chatConnectorsEnabled;
|
||||
if (
|
||||
!channelEnabled &&
|
||||
source !== "agentmail" &&
|
||||
entry?.methods.some((method) => method.purpose === "channel") &&
|
||||
!entry.methods.some((method) => (method.purpose ?? "tool") !== "channel" && method.transport !== "chat_sdk")
|
||||
) return false;
|
||||
@@ -95,5 +95,5 @@ export function canEnterAppsConnect(
|
||||
getConnectableAppDefinition(source)
|
||||
&& (searchParams.get("reconnect")?.trim() || searchParams.get("resume")?.trim())
|
||||
) return true;
|
||||
return source === "agentmail" || channelEnabled ? appSupportsCatalogSetup(entry) : appSupportsToolCatalogSetup(entry);
|
||||
return channelEnabled ? appSupportsCatalogSetup(entry) : appSupportsToolCatalogSetup(entry);
|
||||
}
|
||||
@@ -23,7 +23,7 @@ const copilotBranding = {
|
||||
darkLogoUrl: "./brands/apps/github-copilot-dark.svg",
|
||||
};
|
||||
|
||||
function GitHubConnections({ saved = false, chatEnabled = true }) {
|
||||
function GitHubConnections({ saved = false }) {
|
||||
const location = useLocation();
|
||||
const [client] = useState(() => {
|
||||
const result = new QueryClient({
|
||||
@@ -38,7 +38,7 @@ function GitHubConnections({ saved = false, chatEnabled = true }) {
|
||||
],
|
||||
capabilities: { canSetCompanyInstall: true, canCreatePersonalConnection: true, canCreateOrganizationConnection: true },
|
||||
});
|
||||
result.setQueryData(queryKeys.instance.experimentalSettings, { enableChatConnectors: false, enableGitHubReviewBots: chatEnabled });
|
||||
result.setQueryData(queryKeys.instance.experimentalSettings, { enableChatConnectors: false });
|
||||
result.setQueryData(queryKeys.tools.applications(companyId), { applications: saved ? [
|
||||
{ id: "github-tools", companyId, name: "GitHub", status: "active", metadata: { sourceTemplateKey: "github" } },
|
||||
// Existing bots retain their provider/source identity after the catalog split.
|
||||
@@ -112,11 +112,10 @@ type Story = StoryObj<typeof meta>;
|
||||
export const Catalog: Story = {};
|
||||
export const SavedConnections: Story = { args: { saved: true } };
|
||||
export const ChatDisabled: Story = {
|
||||
args: { chatEnabled: false },
|
||||
play: async ({ canvasElement }) => {
|
||||
const canvas = within(canvasElement);
|
||||
await expect(await canvas.findByRole("button", { name: /^Connect GitHub$/ })).toBeVisible();
|
||||
await expect(canvas.queryByRole("heading", { name: "GitHub Code Review Bot" })).not.toBeInTheDocument();
|
||||
await expect(await canvas.findByRole("heading", { name: "GitHub Code Review Bot" })).toBeVisible();
|
||||
},
|
||||
};
|
||||
export const ToolSetup: Story = {
|
||||
|
||||
Reference in new issue
Block a user