Skip to content

Conversation

Weves
Copy link
Contributor

@Weves Weves commented Sep 10, 2025

Description

^

How Has This Been Tested?

[Describe the tests you ran to verify your changes]

Backporting (check the box to trigger backport action)

Note: You have to check that the action passes, otherwise resolve the conflicts manually and tag the patches.

  • This PR should be backported (make sure to check that the backport attempt succeeds)
  • [Optional] Override Linear Check

@Weves Weves requested a review from a team as a code owner September 10, 2025 19:02
Copy link

vercel bot commented Sep 10, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
internal-search Ready Ready Preview Comment Sep 11, 2025 2:29am

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Greptile Summary

This PR fixes a missing connectors section in the user settings modal by implementing federated OAuth connector support across multiple components. The changes add the ability for users to view and manage federated connectors (like Slack OAuth integrations) in their user settings, regardless of which page they access the settings from.

The core fix involves three main components:

  1. SidebarWrapper.tsx - Adds the useFederatedOAuthStatus hook and passes federated connector data (federatedConnectors and refetchFederatedConnectors) along with ccPairs to the UserSettingsModal. This ensures the connectors section is visible when accessing settings from the assistants page.

  2. ChatPage.tsx - Similarly integrates the federated OAuth status hook to provide complete connector information to the UserSettingsModal when accessed from the chat interface.

  3. Comprehensive testing infrastructure - Adds a new end-to-end test (federated_slack.spec.ts) that validates the complete federated Slack connector workflow, from admin creation through user OAuth interaction to settings visibility. The test ensures that federated connectors properly appear in user settings after admin configuration.

The implementation follows existing patterns in the codebase where the UserSettingsModal conditionally shows a 'Connectors' tab based on the hasConnectors variable, which depends on both regular connectors (ccPairs) and federated connectors being provided as props. Without these changes, users would experience inconsistent behavior where the connectors section might be missing depending on their entry point to the settings modal.

Additionally, the PR includes necessary CI/CD updates to support federated connector testing by adding Slack OAuth credentials (SLACK_CLIENT_ID and SLACK_CLIENT_SECRET) to the Playwright test environment, enabling comprehensive end-to-end testing of the OAuth flow.

Confidence score: 4/5

  • This PR addresses a clear user interface inconsistency with well-structured changes that follow existing patterns in the codebase
  • Score reflects solid implementation approach but some concerns about test reliability due to hardcoded timeouts and potentially fragile selectors in the new e2e test
  • Pay close attention to web/tests/e2e/connectors/federated_slack.spec.ts for potential test stability issues with environment variables and timing-dependent assertions

5 files reviewed, 1 comment

Edit Code Review Bot Settings | Greptile

Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

8 issues found across 5 files

React with 👍 or 👎 to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.


# for federated slack tests
SLACK_CLIENT_ID: ${{ secrets.SLACK_CLIENT_ID }}
SLACK_CLIENT_SECRET: ${{ secrets.SLACK_CLIENT_SECRET }}
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Sep 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Secrets are defined at workflow-level env, exposing them to every step and action; scope them to the Playwright test step to minimize exposure.

Prompt for AI agents
Address the following comment on .github/workflows/pr-playwright-tests.yml at line 15:

<comment>Secrets are defined at workflow-level env, exposing them to every step and action; scope them to the Playwright test step to minimize exposure.</comment>

<file context>
@@ -9,6 +9,11 @@ env:
+
+  # for federated slack tests
+  SLACK_CLIENT_ID: ${{ secrets.SLACK_CLIENT_ID }}
+  SLACK_CLIENT_SECRET: ${{ secrets.SLACK_CLIENT_SECRET }}
+
   MOCK_LLM_RESPONSE: true
</file context>
Fix with Cubic

{
"name": "fastapiusersauth",
"value": "h3qhacpHbE4_09HcOLlVW4lSee48m1UbjYTUiKYwNiw",
"value": "AAdfmA4NT0BXdlg80K3xVuLGVPPPqH7JfzVk82otIw0",
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Sep 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid committing a real authentication cookie/token value; rely on global-setup to generate storage state at runtime or store a placeholder to prevent leaking credentials.

Prompt for AI agents
Address the following comment on web/admin2_auth.json at line 5:

<comment>Avoid committing a real authentication cookie/token value; rely on global-setup to generate storage state at runtime or store a placeholder to prevent leaking credentials.</comment>

<file context>
@@ -2,10 +2,10 @@
     {
       &quot;name&quot;: &quot;fastapiusersauth&quot;,
-      &quot;value&quot;: &quot;h3qhacpHbE4_09HcOLlVW4lSee48m1UbjYTUiKYwNiw&quot;,
+      &quot;value&quot;: &quot;AAdfmA4NT0BXdlg80K3xVuLGVPPPqH7JfzVk82otIw0&quot;,
       &quot;domain&quot;: &quot;localhost&quot;,
       &quot;path&quot;: &quot;/&quot;,
</file context>
Suggested change
"value": "AAdfmA4NT0BXdlg80K3xVuLGVPPPqH7JfzVk82otIw0",
"value": "<redacted>",
Fix with Cubic

const {
connectors: federatedConnectorOAuthStatus,
refetch: refetchFederatedConnectors,
} = useFederatedOAuthStatus();
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Sep 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant fetch: useFederatedOAuthStatus is invoked here and again inside FederatedOAuthModal, leading to duplicate network requests. Consider lifting the hook to ChatPage and passing data to the modal, or memoizing/centralizing the fetch.

Prompt for AI agents
Address the following comment on web/src/app/chat/components/ChatPage.tsx at line 168:

<comment>Redundant fetch: useFederatedOAuthStatus is invoked here and again inside FederatedOAuthModal, leading to duplicate network requests. Consider lifting the hook to ChatPage and passing data to the modal, or memoizing/centralizing the fetch.</comment>

<file context>
@@ -161,6 +162,10 @@ export function ChatPage({
+  const {
+    connectors: federatedConnectorOAuthStatus,
+    refetch: refetchFederatedConnectors,
+  } = useFederatedOAuthStatus();
 
   const { user, isAdmin } = useUser();
</file context>
Fix with Cubic


test.use({ storageState: "admin_auth.json" });

const SLACK_CLIENT_ID = process.env.SLACK_CLIENT_ID || "";
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Sep 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fail fast or skip the test if SLACK_CLIENT_ID is not set; defaulting to "" silently misconfigures the flow.

Prompt for AI agents
Address the following comment on web/tests/e2e/connectors/federated_slack.spec.ts at line 7:

<comment>Fail fast or skip the test if SLACK_CLIENT_ID is not set; defaulting to &quot;&quot; silently misconfigures the flow.</comment>

<file context>
@@ -0,0 +1,108 @@
+
+test.use({ storageState: &quot;admin_auth.json&quot; });
+
+const SLACK_CLIENT_ID = process.env.SLACK_CLIENT_ID || &quot;&quot;;
+const SLACK_CLIENT_SECRET = process.env.SLACK_CLIENT_SECRET || &quot;&quot;;
+
</file context>


async function navigateToUserSettings(page: Page) {
// Wait for any existing modals to close
await page.waitForTimeout(1000);
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Sep 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid fixed delay; wait for a specific element/state signaling the UI is ready.

Prompt for AI agents
Address the following comment on web/tests/e2e/connectors/federated_slack.spec.ts at line 35:

<comment>Avoid fixed delay; wait for a specific element/state signaling the UI is ready.</comment>

<file context>
@@ -0,0 +1,108 @@
+
+async function navigateToUserSettings(page: Page) {
+  // Wait for any existing modals to close
+  await page.waitForTimeout(1000);
+
+  // Wait for potential modal backdrop to disappear
</file context>
Fix with Cubic

await createOrUpdateButton.click();

// Wait for success message or redirect
await page.waitForTimeout(2000);
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Sep 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed wait introduces flakiness; wait for a deterministic condition (e.g., success UI, navigation, or network idle) instead.

Prompt for AI agents
Address the following comment on web/tests/e2e/connectors/federated_slack.spec.ts at line 30:

<comment>Fixed wait introduces flakiness; wait for a deterministic condition (e.g., success UI, navigation, or network idle) instead.</comment>

<file context>
@@ -0,0 +1,108 @@
+  await createOrUpdateButton.click();
+
+  // Wait for success message or redirect
+  await page.waitForTimeout(2000);
+}
+
</file context>
Fix with Cubic

await page.waitForLoadState("networkidle");

// Click on Slack connector tile (specifically the one with "Logo Slack" text, not "Slack Bots")
await page.getByRole("link", { name: "Logo Slack" }).first().click();
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Sep 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Selector depends on icon alt text; prefer a text-based matcher that remains stable and avoids coupling to alt values.

Prompt for AI agents
Address the following comment on web/tests/e2e/connectors/federated_slack.spec.ts at line 16:

<comment>Selector depends on icon alt text; prefer a text-based matcher that remains stable and avoids coupling to alt values.</comment>

<file context>
@@ -0,0 +1,108 @@
+  await page.waitForLoadState(&quot;networkidle&quot;);
+
+  // Click on Slack connector tile (specifically the one with &quot;Logo Slack&quot; text, not &quot;Slack Bots&quot;)
+  await page.getByRole(&quot;link&quot;, { name: &quot;Logo Slack&quot; }).first().click();
+  await page.waitForLoadState(&quot;networkidle&quot;);
+
</file context>


// Check if the OAuth modal appears
await expect(
page.getByText(/improve answer quality by letting/i)
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Sep 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assertion checks for text that does not exist in the OAuth modal; use a stable element like the "Skip for now" button to confirm the modal is shown.

Prompt for AI agents
Address the following comment on web/tests/e2e/connectors/federated_slack.spec.ts at line 85:

<comment>Assertion checks for text that does not exist in the OAuth modal; use a stable element like the &quot;Skip for now&quot; button to confirm the modal is shown.</comment>

<file context>
@@ -0,0 +1,108 @@
+
+  // Check if the OAuth modal appears
+  await expect(
+    page.getByText(/improve answer quality by letting/i)
+  ).toBeVisible({ timeout: 10000 });
+  await expect(page.getByText(/slack/i)).toBeVisible();
</file context>
Fix with Cubic

@Weves Weves merged commit 6340c51 into main Sep 11, 2025
17 of 20 checks passed
@Weves Weves deleted the fix-missing-connectors-section branch September 11, 2025 02:28
@blacksmith-sh blacksmith-sh bot deleted a comment from Weves Sep 11, 2025
AnkitTukatek pushed a commit to TukaTek/onyx that referenced this pull request Sep 23, 2025
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants