Skip to content

Conversation

jessicasingh7
Copy link
Contributor

@jessicasingh7 jessicasingh7 commented Sep 12, 2025

Description

[Provide a brief description of the changes in this PR]

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

Summary by cubic

Fixes federated Slack search by always sending a valid original_query to the search tool. Defaults to the user query and uses the rewritten query when available to prevent None/empty values.

  • Bug Fixes
    • Default original_query to query in SearchTool; fall back to query if override is missing.
    • Pass rewritten_query as original_query from DR basic search to ensure a valid query reaches retrieval and logging.

@jessicasingh7 jessicasingh7 requested a review from a team as a code owner September 12, 2025 01:54
Copy link

vercel bot commented Sep 12, 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 12, 2025 1:54am

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 query handling issues in the federated Slack functionality by ensuring the original_query parameter is properly passed through the search pipeline. The changes address two related problems:

  1. SearchTool initialization fix: In search_tool.py, the original_query variable was previously initialized to None and could remain null when override_kwargs was not provided or when override_kwargs.original_query was null. The fix ensures original_query always defaults to the input query parameter, preventing downstream functions from receiving unexpected null values.

  2. DR Agent query parameter fix: In dr_basic_search_2_act.py, the SearchToolOverrideKwargs was missing the original_query parameter entirely. The fix adds original_query=rewritten_query to ensure the search system has proper query tracking even when queries are rewritten by the LLM.

These changes work together to maintain query continuity through the search pipeline. The SearchTool expects an original_query string for proper search request construction (line 411 in search_tool.py), and the DR agent now provides this required parameter. This is particularly important for federated search scenarios where maintaining original query context is crucial for proper attribution, analytics, and search functionality. The fixes use defensive programming patterns (or query fallback) to ensure backward compatibility while preventing null reference errors.

Confidence score: 5/5

  • This PR is safe to merge with minimal risk as it fixes clear null reference issues
  • Score reflects straightforward defensive programming fixes that address specific bug scenarios without changing core logic
  • No files require special attention - both changes are simple parameter handling improvements

2 files reviewed, no comments

Edit Code Review Bot Settings | Greptile

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.

1 issue found across 2 files

Prompt for AI agents (all 1 issues)

Understand the root cause of the following 1 issues and fix them.


<file name="backend/onyx/agents/agent_search/dr/sub_agents/basic_search/dr_basic_search_2_act.py">

<violation number="1" location="backend/onyx/agents/agent_search/dr/sub_agents/basic_search/dr_basic_search_2_act.py:155">
Passing rewritten_query as original_query loses the user&#39;s raw phrasing used by federated Slack expansions and is redundant since SearchTool defaults original_query to query anyway; use the raw user query instead for correct behavior.</violation>
</file>

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

@justin-tahara justin-tahara merged commit e024472 into main Sep 12, 2025
56 of 58 checks passed
@justin-tahara justin-tahara deleted the jessica/federated-slack-improvements branch September 12, 2025 02:27
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.

2 participants