Fix bug in novelty check when no papers found - replace 'is None' with falsy check#3
Merged
QRcode1337 merged 1 commit intomainfrom Jun 30, 2025
Conversation
|
|
|
🧙 Sourcery has finished reviewing your pull request! Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Copilot
AI
changed the title
[WIP] Resolve merge conflicts in PR #2
Fix bug in novelty check when no papers found - replace 'is None' with falsy check
Jun 30, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The
check_idea_noveltyfunction inai_scientist/generate_ideas.pyhad a bug where it only checked forpapers is Nonewhen handling empty search results. This could cause issues if thesearch_for_papersfunction returns other falsy values like empty lists instead ofNone.Solution
Replaced the explicit
Nonecheck with a more robust falsy check (if not papers:) that handles bothNoneand empty collection cases.Changes Made
ai_scientist/generate_ideas.py(line 417): Changedif papers is None:toif not papers:ai_scientist/perform_writeup.py(line 321): Fixed the same pattern for consistencyWhy This Fix Is Better
None, empty lists[], and other falsy valuessearch_for_papersbehavior changes to return empty lists instead ofNoneTesting
python -m py_compile ai_scientist/generate_ideas.pyThe
search_for_papersfunction can returnNonein two cases:if not query: return None)if not total: return None)This change ensures both cases are handled consistently, preventing potential runtime errors when the function behavior changes or returns empty collections.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.