Skip to content

fix: implement search_stackoverflow_threads and standardize tool interface#284

Open
jaishree-verma wants to merge 3 commits intojenkinsci:mainfrom
jaishree-verma:fix/search-stackoverflow-threads
Open

fix: implement search_stackoverflow_threads and standardize tool interface#284
jaishree-verma wants to merge 3 commits intojenkinsci:mainfrom
jaishree-verma:fix/search-stackoverflow-threads

Conversation

@jaishree-verma
Copy link

Problem

search_stackoverflow_threads was a no-op stub that always returned
hardcoded "Nothing relevant" regardless of the user query. It also
had an inconsistent interface - missing keywords and logger
parameters that all other search tools accept.

Changes

  • Replace stub with real retrieval implementation using retrieve_documents
    • extract_top_chunks, consistent with search_jenkins_docs,
      search_plugin_docs, and search_community_threads
  • Add missing keywords and logger parameters to match tool interface contract
  • Add stackoverflow source name to config.yml and config-testing.yml
  • Add top_k_stackoverflow to retrieval config in both yml files
  • Fix TOOL_SIGNATURES in utils.py to include keywords for stackoverflow
  • Fix get_default_tools_call to pass keywords for the stackoverflow tool
  • Add test_tools.py with unit tests covering the fix

Testing

Added tests/unit/tools/test_tools.py with tests verifying:

  • Function returns result of extract_top_chunks (not hardcoded string)
  • retrieve_documents is called with correct query and keywords
  • Hardcoded "Nothing relevant" stub behaviour is gone
  • TOOL_SIGNATURES includes keywords for stackoverflow
  • get_default_tools_call includes keywords for stackoverflow

…rface

- Replace no-op stub in search_stackoverflow_threads that always
  returned hardcoded 'Nothing relevant' with real retrieval logic
- Add missing keywords and logger parameters to match the interface
  contract of all other search tools
- Add stackoverflow source name to config.yml and config-testing.yml
- Add top_k_stackoverflow to retrieval config in both yml files
- Fix TOOL_SIGNATURES in utils.py to include keywords for stackoverflow
- Fix get_default_tools_call to pass keywords for stackoverflow tool
- Add test_tools.py with unit tests covering the fix
@berviantoleo
Copy link
Contributor

Duplicates

#172

@berviantoleo berviantoleo added the duplicate This issue or pull request already exists label Mar 15, 2026
plugins: "plugins"
jenkins_docs: "docs"
community_threads: "discourse"
stackoverflow: "stackoverflow" #-> first change
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove the first, second, ...

Copy link
Author

Choose a reason for hiding this comment

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

Thank you for the review @berviantoleo!
I checked PR #172. The key difference in my PR is that it also standardizes the tool interface by adding keywords and logger parameters to match the contract of the other 3 search tools (search_jenkins_docs, search_plugin_docs, search_community_threads).
PR #172 keeps search_stackoverflow_threads(query) only, which leaves the interface inconsistency unfixed.
I will remove the inline comment (#-> first change) from both config files as requested. Should I also address the interface standardization separately or keep it in this PR?

Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer to comment on existing PR, suggest the what you found that the contributor will miss. It's another way to contribute. Contribution doesn't mean you need to be an author; as a pair-reviewer, it's also valuable.

Copy link
Author

Choose a reason for hiding this comment

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

Understood! I will go to PR #172 and leave a review comment there pointing out the interface inconsistency.
Thank you for the guidance @berviantoleo!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

duplicate This issue or pull request already exists

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants