Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 24, 2025

RAG discovery was attempted regardless of FEATURE_RAG_ENABLED, causing "ERROR - Unexpected error while discovering data sources" when the feature was disabled.

Changes

  • backend/routes/config_routes.py: Wrap RAG discovery block in if app_settings.feature_rag_enabled: guard
  • backend/tests/test_routes_config_smoke.py: Add test verifying discovery methods are not called when flag is off
# Before: only checked which method to use, not whether to run at all
if app_settings.feature_rag_mcp_enabled:
    # MCP discovery
else:
    # Legacy discovery (still runs even if RAG disabled)

# After: skip entirely when RAG is disabled
if app_settings.feature_rag_enabled:
    if app_settings.feature_rag_mcp_enabled:
        # MCP discovery
    else:
        # Legacy discovery

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • astral.sh
    • Triggering command: /usr/bin/curl curl -LsSf REDACTED (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>if the RAG flag is off then discovering RAG should not be attempted.</issue_title>
<issue_description>ERROR - Unexpected error while discovering data sources happens even when the RAG flag is off. </issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits November 24, 2025 20:52
Co-authored-by: garland3 <1162675+garland3@users.noreply.github.com>
Co-authored-by: garland3 <1162675+garland3@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix unexpected error during data source discovery with RAG flag off Skip RAG discovery when FEATURE_RAG_ENABLED is false Nov 24, 2025
Copilot AI requested a review from garland3 November 24, 2025 20:56
Copilot finished work on behalf of garland3 November 24, 2025 20:56
@garland3 garland3 marked this pull request as ready for review November 24, 2025 22:32
Copilot AI review requested due to automatic review settings November 24, 2025 22:32
@garland3 garland3 merged commit 252d963 into main Nov 24, 2025
4 checks passed
@garland3 garland3 deleted the copilot/fix-rag-discovery-error branch November 24, 2025 22:32
Copilot finished reviewing on behalf of garland3 November 24, 2025 22:33
Copy link

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 fixes a bug where RAG (Retrieval-Augmented Generation) discovery was attempted even when the FEATURE_RAG_ENABLED flag was disabled, causing unnecessary errors in the logs.

Key Changes:

  • Added a guard condition to skip RAG discovery entirely when the feature is disabled
  • Added test coverage to verify RAG discovery methods are not called when the feature flag is off

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
backend/routes/config_routes.py Wraps RAG discovery logic in if app_settings.feature_rag_enabled: guard to prevent discovery attempts when RAG is disabled
backend/tests/test_routes_config_smoke.py Adds test verifying RAG discovery methods are not called when feature_rag_enabled is False

assert "data_sources" in data


def test_rag_discovery_skipped_when_feature_disabled(monkeypatch):
Copy link

Copilot AI Nov 24, 2025

Choose a reason for hiding this comment

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

The monkeypatch parameter is declared but never used in the test function. Remove it or use it to set environment variables instead of directly mutating the config_manager settings. Other tests in the codebase use monkeypatch.setenv() to modify configuration (see test_core_auth.py line 11).

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

None yet

Development

Successfully merging this pull request may close these issues.

if the RAG flag is off then discovering RAG should not be attempted.

2 participants