Skip to content

fix(frontend): Fix login/logout actions; update credentials cache on state change #10017

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 22 commits into from
Jun 4, 2025

Conversation

Pwuts
Copy link
Member

@Pwuts Pwuts commented May 22, 2025

Changes 🏗️

  • Update useSupabase hook to propagate auth state changes
  • Refresh CredentialsProvider whenever the user login state changes
  • Add logOut callback to useSupabase hook that handles (client-side) logout
    • Remove server-side logout action: the Supabase reference implementation does it client-side, and doing both causes a race condition

Refactorings to aid implementation of the above:

  • Move @/hooks/useSupabase -> @/lib/supabase/useSupabase

Other improvements:

  • Clean up login server action based on reference implementation
  • Make BackendAPI.isAuthenticated() more efficient and faster
  • Remove unused ProfileDropdown component
  • Improve logic and debug logging in tests/pages/login.page.ts
  • Improve playwright test output logging

Checklist 📋

For code changes:

  • I have clearly listed my changes in the PR description

  • I have made a test plan

  • I have tested my changes according to the test plan:

    • Log out from account (A)
    • Log in to other account (B)
    • Open builder, add a block for which account B has (multiple) credentials
    • Credentials for account B are shown
    • Credentials for account A are not shown

    Note: do not reload the page while going through these steps

Copy link

netlify bot commented May 22, 2025

Deploy Preview for auto-gpt-docs-dev canceled.

Name Link
🔨 Latest commit ee44746
🔍 Latest deploy log https://app.netlify.com/projects/auto-gpt-docs-dev/deploys/6840c8773148ee00083ec111

@github-actions github-actions bot added platform/frontend AutoGPT Platform - Front end platform/backend AutoGPT Platform - Back end labels May 22, 2025
Copy link

netlify bot commented May 22, 2025

Deploy Preview for auto-gpt-docs ready!

Name Link
🔨 Latest commit ee44746
🔍 Latest deploy log https://app.netlify.com/projects/auto-gpt-docs/deploys/6840c8773148ee00083ec10f
😎 Deploy Preview https://deploy-preview-10017--auto-gpt-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link

deepsource-io bot commented May 22, 2025

Here's the code health analysis summary for commits 6629052..ee44746. View details on DeepSource ↗.

Analysis Summary

AnalyzerStatusSummaryLink
DeepSource JavaScript LogoJavaScript✅ Success
❗ 40 occurences introduced
🎯 46 occurences resolved
View Check ↗
DeepSource Python LogoPython✅ SuccessView Check ↗

💡 If you’re a repository administrator, you can configure the quality gates from the settings.

@Pwuts Pwuts changed the title Fix credential refresh on user switch fix(frontend): Clear cached credentials on logout May 22, 2025
@AutoGPT-Agent
Copy link

The PR template is not properly filled out - missing the checklist items and clear description of changes. However, the code changes themselves are minor, focused on frontend auth handling, and the title follows the conventional commit format with proper scope. The changes appear to be strictly related to credential handling during logout which keeps it within scope.

@AutoGPT-Agent
Copy link

While the PR shows clear code changes that make sense, the PR template is not properly filled out. The checklist sections are completely missing (not even marked as N/A) and the test plan is very minimal, only showing failed lint checks. Additionally, while the PR title follows the conventional commit format with scope, the description could be more detailed about the need for these changes. However, since you mentioned to not be overly pedantic and we're working on getting the template used at all, these issues aren't severe enough to warrant a complete rejection.

@Pwuts Pwuts marked this pull request as ready for review May 22, 2025 20:39
@Pwuts Pwuts requested a review from a team as a code owner May 22, 2025 20:39
@Pwuts Pwuts requested review from ntindle and Swiftyos and removed request for a team May 22, 2025 20:39
@Pwuts Pwuts enabled auto-merge May 22, 2025 20:49
@Pwuts Pwuts changed the title fix(frontend): Clear cached credentials on logout fix(frontend): Update cached credentials on login state change May 22, 2025
@AutoGPT-Agent
Copy link

The PR has issues with incomplete checklist. While the PR title follows conventional commit format and the description clearly explains the intent of the changes (fixing credential caching on login state changes), the author has not properly completed the checklist section. The test plan shows that the linting and type checking tests failed, but there's no indication that the actual functionality was tested. According to the rules, the checklist must be filled out completely, and partially checked off checklists are not accepted.

@Pwuts Pwuts requested a review from kcze May 22, 2025 22:44
@Pwuts Pwuts changed the title fix(frontend): Update cached credentials on login state change fix(frontend): Update credentials cache on login state change May 22, 2025
@AutoGPT-Agent
Copy link

The PR mostly follows the required format and rules. The title correctly uses 'fix(frontend)' format. The description references issue #10008 and clearly explains the changes. The checklist is incomplete as the author hasn't confirmed testing according to their test plan - they've created a plan but haven't marked it as completed. This is a requirement according to the rules where checklists must be filled out completely. No backend/data/*.py files are changed and no new frontend routes are added, so those specific rules don't apply.

@AutoGPT-Agent
Copy link

Thanks for your PR to fix the credentials cache on login state change! Before we can merge this, please complete the checklist by confirming that you've tested your changes according to the test plan you outlined. The test plan looks comprehensive, but we need confirmation that you've actually run through the steps and verified the expected behavior (credentials for account B showing, credentials for account A not showing).

@AutoGPT-Agent
Copy link

Thank you for your PR addressing the credentials cache update on login state change! The changes look good technically - you're updating the useSupabase hook to respond to auth state changes and refreshing credentials when the logged-in user changes.

A couple of things to address before this is ready to merge:

  1. It appears you haven't completed testing your changes according to the test plan you outlined. Please follow through with the testing steps you've described (logging out from account A, logging into account B, etc.) and check off that item in the checklist once you've verified everything works as expected.

  2. Your test plan is very clear, but I'd like to confirm - have you observed that without this fix, credentials from account A would incorrectly persist when switching to account B without a page reload?

The code changes themselves look good - subscribing to auth state changes and properly cleaning up the subscription is the right approach here. The dependency array for the useEffect in credentials-provider.tsx has been appropriately updated to include the user as well.

@Pwuts Pwuts force-pushed the pwuts-codex/fix-frontend-credentials-refresh branch from ae23514 to 1762f5c Compare May 27, 2025 15:09
@Pwuts Pwuts requested a review from kcze May 27, 2025 16:34
@Pwuts Pwuts changed the title fix(frontend): Update credentials cache on login state change fix(frontend): Fix login/logout actions; update credentials cache on state change May 27, 2025
@majdyz majdyz added this pull request to the merge queue May 28, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks May 28, 2025
@Pwuts
Copy link
Member Author

Pwuts commented May 28, 2025

still flaky |:(

@github-actions github-actions bot added the conflicts Automatically applied to PRs with merge conflicts label Jun 4, 2025
Copy link
Contributor

github-actions bot commented Jun 4, 2025

This pull request has conflicts with the base branch, please resolve those so we can evaluate the pull request.

@github-actions github-actions bot removed the conflicts Automatically applied to PRs with merge conflicts label Jun 4, 2025
Copy link
Contributor

github-actions bot commented Jun 4, 2025

Conflicts have been resolved! 🎉 A maintainer will review the pull request shortly.

@Pwuts Pwuts added this pull request to the merge queue Jun 4, 2025
Merged via the queue into dev with commit 47adab5 Jun 4, 2025
25 checks passed
@Pwuts Pwuts deleted the pwuts-codex/fix-frontend-credentials-refresh branch June 4, 2025 23:00
@github-project-automation github-project-automation bot moved this from 👍🏼 Mergeable to ✅ Done in AutoGPT development kanban Jun 4, 2025
@github-project-automation github-project-automation bot moved this to Done in Frontend Jun 4, 2025
@Pwuts Pwuts removed the platform/backend AutoGPT Platform - Back end label Jun 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
codex platform/frontend AutoGPT Platform - Front end size/l
Projects
Status: Done
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants