Skip to content

fix(acceptor): reject NaN and +inf is_valid#3

Open
GrigoryEvko wants to merge 1 commit into
FusionBrainLab:mainfrom
GrigoryEvko:fix/acceptor-finite-guard
Open

fix(acceptor): reject NaN and +inf is_valid#3
GrigoryEvko wants to merge 1 commit into
FusionBrainLab:mainfrom
GrigoryEvko:fix/acceptor-finite-guard

Conversation

@GrigoryEvko
Copy link
Copy Markdown

ValidityMetricAcceptor rejected zero and negative is_valid via is_valid <= 0, but NaN comparisons all return False and so does inf <= 0. A crashed validity stage emitting NaN, or an unbounded-objective sentinel of +inf, was therefore silently accepted as an elite.

Fix: add an isfinite() guard before the <= 0 check. Tests: finite small positive (0.5) accepted, NaN rejected, +inf rejected.

`is_valid <= 0` is False for both NaN and +inf, so a crashed validity stage emitting NaN or an unbounded-sentinel +inf was silently accepted as an elite. Add an isfinite() guard.
GrigoryEvko added a commit to GrigoryEvko/gigaevo-core that referenced this pull request May 15, 2026
If ``_bandit.select()`` raises before ``record_pull`` runs, no pull is
recorded and the try/except inside ``invoke``/``ainvoke`` never engages
to inject a zero reward — the ledger invariant ("pulls and rewards
stay in step") therefore holds vacuously. Codify this so a future
refactor that moves ``record_pull`` outside ``_select`` (or hoists the
try/except above ``_select``) doesn't break the invariant silently.

Audit item FusionBrainLab#3 from the PR FusionBrainLab#13 bug hunt — verification, no code change.
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.

1 participant