Skip to content

Open-source Grok Bot alternative with a virtual machine that bots can use

Sandbox switch: keep an enabled one visible when connected apps are off

AdityaUmaled783e07ef558
diff --git a/src/components/bot-settings/AccessSection.test.ts b/src/components/bot-settings/AccessSection.test.ts
index f963a42850..5c863aaab7 100644
--- a/src/components/bot-settings/AccessSection.test.ts
+++ b/src/components/bot-settings/AccessSection.test.ts
@@ -437,12 +437,15 @@ describe("AccessSection per-app scopes", () => {
expect(render(makeBot())).not.toContain("data-app-sandbox");
});
- it("keeps an enabled sandbox switch while the app list is unknown, and hides it from editors", () => {
+ it("keeps an enabled sandbox switch while the app list is unknown or apps are off, and hides it from editors", () => {
const grants = { connectorTools: { gmail: { tools: "*" as const } } };
fixture.apps = { phase: "unknown", apps: [], connectedSlugs: [] };
expect(render(makeBot({ ...grants, appSandbox: true }))).toContain("data-app-sandbox");
expect(render(makeBot(grants))).not.toContain("data-app-sandbox");
fixture.apps = { phase: "ready", connectedSlugs: ["gmail"], apps: [app("gmail", "Gmail")] };
+ const appsOff = { ...makeDerived(), connectedAppsEnabled: false };
+ expect(render(makeBot({ ...grants, appSandbox: true, composio: false }), appsOff)).toContain("data-app-sandbox");
+ expect(render(makeBot({ ...grants, composio: false }), appsOff)).not.toContain("data-app-sandbox");
fixture.ownerOrAdmin = false;
expect(render(makeBot({ ...grants, appSandbox: true }))).not.toContain("data-app-sandbox");
});
diff --git a/src/components/bot-settings/AccessSection.tsx b/src/components/bot-settings/AccessSection.tsx
index 2e6e796d37..3a40782718 100644
--- a/src/components/bot-settings/AccessSection.tsx
+++ b/src/components/bot-settings/AccessSection.tsx
@@ -785,8 +785,8 @@ export function AccessSection({
</>
)}
{/* Only an owner or admin may change it (the server refuses an editor). An enabled switch stays shown while the
- app list is unknown, so it can always be turned off. */}
- {connectedAppsEnabled && ownerOrAdmin === true && bot.connectorTools !== undefined && (inventoryReady || bot.appSandbox === true) && (
+ app list is unknown or connected apps are off, so it can always be turned off. */}
+ {ownerOrAdmin === true && bot.connectorTools !== undefined && (bot.appSandbox === true || (connectedAppsEnabled && inventoryReady)) && (
<AppSandboxRow on={bot.appSandbox === true} onChange={(appSandbox) => patch({ appSandbox })} />
)}
{connectedAppsEnabled && connectedAppsConfigured && (