fixes one off errors and auto water - #175
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
An unresolved critical autowater bug and missing exact-boundary regression tests must be addressed.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR fixes trial-count boundaries, stability thresholds, and equal-probability autowater selection.
Changes:
- Stops sessions at
max_trial. - Requires stability runs to exceed
min_consecutive_stable_trials. - Randomizes autowater side selection when probabilities tie.
File summaries
| File | Summary | Findings |
|---|---|---|
src/aind_behavior_dynamic_foraging/task_logic/trial_generators/uncoupled_trial_gnerator.py |
Corrects maximum-trial termination. | Moderate (3 votes): Add exact-boundary regression tests for max_trial and max_trial - 1. |
src/aind_behavior_dynamic_foraging/task_logic/trial_generators/coupled_trial_generators/coupled_trial_generator.py |
Corrects trial termination and stability thresholds. | Moderate (3 votes): Add exact-boundary regression tests for max_trial and max_trial - 1. |
src/aind_behavior_dynamic_foraging/task_logic/trial_generators/block_based_trial_generator.py |
Randomizes equal-probability autowater selection. | Critical (3 votes): Convert the sampled numpy.bool_ to a Python bool before identity checks. |
Review details
Suppressed comments (1)
src/aind_behavior_dynamic_foraging/task_logic/trial_generators/coupled_trial_generators/coupled_trial_generator.py:235
- This strict comparison invalidates existing stability tests: with the default
min_stable=5andkernel_size=2,test_update_block_switches_after_conditions_metsupplies six choices and produces only five stable windows, so the block no longer switches; the anytime fixture can similarly fail when the high-reward side is left. Update those fixtures to providemin_stable + kernel_sizestable choices and retain an exact-boundary negative case.
if run_len > min_stable:
- Files reviewed: 3/3 changed files
- Comments generated: 3
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
alexpiet
approved these changes
Sep 10, 2026
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.
resolves #207
resolves #208
resolves #203