Skip to content

fix: reject empty self_fusion.temperature_spread at config load - #148

Open
shrdgn wants to merge 1 commit into
mainfrom
claude/self-fusion-empty-spread
Open

fix: reject empty self_fusion.temperature_spread at config load#148
shrdgn wants to merge 1 commit into
mainfrom
claude/self-fusion-empty-spread

Conversation

@shrdgn

@shrdgn shrdgn commented Aug 17, 2026

Copy link
Copy Markdown
Owner

What & why

SelfFusionConfig.temperature_spread (openfusion/config.py) accepted an empty list with no validation. A config like self_fusion: {temperature_spread: []} — a plausible attempt to disable temperature variation — loads without error, but crashes every self_fusion request deep inside panel.py:

spread = config.self_fusion.temperature_spread
for index in range(config.self_fusion.n):
    temperature = spread[index % len(spread)]   # ZeroDivisionError if spread == []

This adds min_length=1 to the field so an empty list fails fast and clearly at config load (a ValidationError), instead of crashing mid-request with an unhandled ZeroDivisionError.

How it was tested

  • ruff check . passes (new code only — two pre-existing formatting diffs elsewhere in the touched files are unrelated to this change and left as-is)
  • pytest -q passes (no live network) — ran tests/test_config.py and tests/test_panel.py
  • New behavior has a test (test_self_fusion_rejects_empty_temperature_spread)
  • Docs updated if config / request surface / defaults changed — no docs describe this field's edge-case behavior, none needed
  • No secrets, prompts, or response bodies added to logs or metrics
  • Quality/cost claims backed by a reproducible bench/run.py number — not applicable, this is a validation-only fix with no behavior change for valid configs

Notes for reviewers

Found via an automated repo-review scheduled task. Scoped narrowly to the validation gap; no other behavior changes.


Generated by Claude Code

An empty list loads fine but crashes every self_fusion request with an
unhandled ZeroDivisionError in panel.py's `spread[index % len(spread)]`
lookup. Require at least one entry so this fails fast and clearly at
config load instead of mid-request.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EdA4xCCD6tTs2Z1atpfdB7
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.

2 participants