Add helper methods to eliminate duplicate null checks#47
Open
sarvanithin wants to merge 2 commits intowithmartian:mainfrom
Open
Add helper methods to eliminate duplicate null checks#47sarvanithin wants to merge 2 commits intowithmartian:mainfrom
sarvanithin wants to merge 2 commits intowithmartian:mainfrom
Conversation
- Add _require_container() and _require_task() helper methods to CodeBaseEnv - Update SweBenchEnv to use helpers instead of duplicate if/raise patterns - Remove TODO comment about duplicate checks - Improves code reusability and maintainability Both helpers raise RuntimeError with clear messages if state is invalid.
rsmith49
reviewed
Jan 23, 2026
Contributor
rsmith49
left a comment
There was a problem hiding this comment.
Nice find, thanks @sarvanithin! Can you add the _require_container and _require_task checks to HarborEnv as well? Then I'll go ahead and merge 🙌
- Update _start_container() to use _require_task() helper - Update _start_code_agent() to use both helpers - Update _compute_reward() to use both helpers - Update _parse_reward_file() to use _require_container() helper - Consistent error handling across all environment implementations
Contributor
|
Looks like the changes conflict with some of the changes to HarborEnv - do you mind resolving those? Shouldn't be too much to fix |
Contributor
Author
|
@rsmith49 Conflicts resolved! All 82 tests passing. Ready for review. |
Contributor
|
Looks like you accidentally included the state snapshot changes here as well - are you able to take that piece back out? |
77c9a5c to
3609560
Compare
Contributor
Author
|
Fixed both issues:
This PR now only contains the original helper method changes. All 67 tests passing. |
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.
Both helpers raise RuntimeError with clear messages if state is invalid.