Skip to content

fixes one off errors and auto water - #175

Merged
micahwoodard merged 6 commits into
mainfrom
fix-one-off-error
Sep 10, 2026
Merged

fixes one off errors and auto water#175
micahwoodard merged 6 commits into
mainfrom
fix-one-off-error

Conversation

@micahwoodard

Copy link
Copy Markdown
Collaborator

resolves #207

  • requires a run length strictly greater than min_consecutive_stable_trials

resolves #208

  • instead of always picking left, lefts randomly select a side

resolves #203

  • stops when max_trial <= len(history)

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 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=5 and kernel_size=2, test_update_block_switches_after_conditions_met supplies 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 provide min_stable + kernel_size stable 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.

@micahwoodard
micahwoodard merged commit f34e5a8 into main Sep 10, 2026
7 of 8 checks passed
@micahwoodard
micahwoodard deleted the fix-one-off-error branch September 10, 2026 15:55
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.

3 participants