Skip to content

Remove unused tasks in Github workflows#253

Merged
locnguyen1986 merged 2 commits intomainfrom
feat/oauth-improve
Nov 19, 2025
Merged

Remove unused tasks in Github workflows#253
locnguyen1986 merged 2 commits intomainfrom
feat/oauth-improve

Conversation

@locnguyen1986
Copy link
Collaborator

Remove unused tasks in Github workflows

Copilot AI review requested due to automatic review settings November 19, 2025 02:28
@locnguyen1986 locnguyen1986 merged commit 482d055 into main Nov 19, 2025
10 checks passed
@locnguyen1986 locnguyen1986 deleted the feat/oauth-improve branch November 19, 2025 02:28
@github-project-automation github-project-automation bot moved this to QA in Jan Nov 19, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR aims to remove unused tasks in GitHub workflows but includes substantial authentication improvements. The key changes involve adding Keycloak logout functionality, improving OAuth error handling with redirects instead of JSON responses, and fixing context handling in the user repository.

  • Add Keycloak session invalidation to the logout flow
  • Replace JSON error responses with user-friendly redirects to the frontend
  • Fix context cancellation issue in user repository upsert operation

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
.github/workflows/template-docker.yml Comments out QEMU setup step in Docker workflow
services/llm-api/internal/interfaces/httpserver/handlers/authhandler/token_handler.go Adds Keycloak logout endpoint call before clearing local cookies
services/llm-api/internal/interfaces/httpserver/handlers/authhandler/keycloak_oauth.go Converts error JSON responses to homepage redirects with error parameters
services/llm-api/internal/infrastructure/keycloak/client.go Implements new LogoutUser method to invalidate Keycloak sessions
services/llm-api/internal/infrastructure/database/repository/userrepo/user_repository.go Uses background context for user reload to prevent cancellation issues

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +246 to +250
homeURL := "https://chat-dev.jan.ai/"
redirectURL := fmt.Sprintf("%s?error=%s&error_description=%s",
homeURL,
url.QueryEscape(keycloakError),
url.QueryEscape(errorDescription))
Copy link

Copilot AI Nov 19, 2025

Choose a reason for hiding this comment

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

The hardcoded URL 'https://chat-dev.jan.ai/' is duplicated in 6 locations throughout this file (lines 246, 269, 286, 300, 328, 378). Consider extracting this to a constant or configuration value to improve maintainability and make environment-specific deployments easier.

Copilot uses AI. Check for mistakes.
})

// Redirect to homepage with error in URL
homeURL := "https://chat-dev.jan.ai/"
Copy link

Copilot AI Nov 19, 2025

Choose a reason for hiding this comment

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

Hardcoded environment-specific URL ('chat-dev.jan.ai') should be externalized to a configuration file or environment variable. This will prevent the need to modify code when deploying to different environments (dev, staging, production).

Suggested change
homeURL := "https://chat-dev.jan.ai/"
homeURL := config.GetConfig().HomeURL

Copilot uses AI. Check for mistakes.
}
defer resp.Body.Close()

if resp.StatusCode >= 300 {
Copy link

Copilot AI Nov 19, 2025

Choose a reason for hiding this comment

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

The status code check >= 300 will treat HTTP 3xx redirect responses as errors. Keycloak logout endpoint typically returns 204 No Content on success. Consider checking for resp.StatusCode < 200 || resp.StatusCode >= 300 or specifically resp.StatusCode != 204 if that's the expected success response.

Suggested change
if resp.StatusCode >= 300 {
if resp.StatusCode != http.StatusNoContent {

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: QA

Development

Successfully merging this pull request may close these issues.

2 participants