fix(bandit): return neutral reward for non-finite fitness inputs#2
Open
GrigoryEvko wants to merge 1 commit into
Open
fix(bandit): return neutral reward for non-finite fitness inputs#2GrigoryEvko wants to merge 1 commit into
GrigoryEvko wants to merge 1 commit into
Conversation
compute_bandit_reward used to compute exp(min(max(NaN, 0), _MAX)) → NaN when either input was non-finite. The NaN then flowed into SlidingWindowUCB1.update_reward → mean_reward → UCB score, after which every arm's score is NaN, "score > best_score" is False, and the first arm in dict iteration order is always selected (exploration silently bricked). Non-finite inputs do occur in practice: validity stage crashes yield sentinel-or-NaN fitness depending on the acceptor. Add a finite-input fast-guard returning 0.0 — the neutral reward — so the sliding-window mean stays well-defined. Tests cover positive (finite path unchanged), NaN child, and +inf parent.
GrigoryEvko
added a commit
to GrigoryEvko/gigaevo-core
that referenced
this pull request
May 15, 2026
``_StructuredOutputRouter._maybe_fire_failure_hook`` used to swallow hook exceptions silently (``except Exception: pass``). The hook is observability-only, so re-raising would mask the real LLM failure — but a *silent* swallow loses telemetry whenever the hook itself has a bug, hiding bandit-side regressions. Replace ``pass`` with ``logger.warning(...)`` so the original exception still propagates, yet a broken hook is visible in operator logs. Audit item FusionBrainLab#2 from the PR FusionBrainLab#13 bug hunt.
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.
compute_bandit_reward(NaN, _)returns NaN. That feeds into the SlidingWindowUCB1 mean and silently bricks routing — every arm's score becomes NaN,score > best_scoreis always False, the first arm in dict order always wins. Trigger: any path producing non-finite fitness, e.g. a crashed validity stage emitting NaN.Fix: return 0.0 when either input is non-finite. Tests: finite-input parity, NaN child, +inf parent.