Skip to content

fix: InputText widget returns string seed causing model reset to fail #3516#3518

Merged
quaquel merged 6 commits intomesa:mainfrom
R1patil:fix/inputtext-string-seed-3516
Mar 14, 2026
Merged

fix: InputText widget returns string seed causing model reset to fail #3516#3518
quaquel merged 6 commits intomesa:mainfrom
R1patil:fix/inputtext-string-seed-3516

Conversation

@R1patil
Copy link
Copy Markdown
Contributor

@R1patil R1patil commented Mar 12, 2026

Fixes #3516

Problem

Solara's InputText component always returns string values. When a user
types an integer seed (e.g. 100), it was passed as "100" to numpy's
default_rng() which only accepts integers, causing a TypeError crash.

Fix

Added type conversion in the InputText change handler to automatically
convert string values to int or float where possible before passing
to on_change.

Testing

  • Launched Schelling model with solara run
  • Changed Random Seed to 100 and clicked Reset → works correctly ✅
  • No more TypeError crash

@github-actions
Copy link
Copy Markdown

Performance benchmarks:

Model Size Init time [95% CI] Run time [95% CI]
BoltzmannWealth small 🔵 +0.2% [-0.3%, +0.7%] 🔵 -1.2% [-1.3%, -1.0%]
BoltzmannWealth large 🔵 -0.0% [-0.4%, +0.3%] 🔵 -1.5% [-3.0%, -0.3%]
Schelling small 🔵 +1.4% [+1.1%, +1.8%] 🔵 +0.6% [+0.5%, +0.8%]
Schelling large 🔵 +1.5% [+0.6%, +2.3%] 🔵 +2.2% [+0.4%, +4.5%]
WolfSheep small 🔵 -0.3% [-0.6%, -0.0%] 🔵 -0.8% [-1.1%, -0.6%]
WolfSheep large 🔵 -2.3% [-2.9%, -1.6%] 🟢 -6.4% [-7.6%, -4.9%]
SugarscapeG1mt small 🔵 +0.1% [-0.3%, +0.5%] 🔵 -2.0% [-2.1%, -1.8%]
SugarscapeG1mt large 🔵 -1.5% [-2.7%, -0.5%] 🔵 -2.3% [-2.8%, -1.8%]
BoidFlockers small 🔵 -0.2% [-0.6%, +0.2%] 🔵 +0.0% [-0.1%, +0.2%]
BoidFlockers large 🔵 +0.8% [+0.2%, +1.3%] 🔵 -0.2% [-0.4%, -0.1%]

@quaquel quaquel added the bug Release notes label label Mar 12, 2026
@R1patil
Copy link
Copy Markdown
Contributor Author

R1patil commented Mar 13, 2026

Hi @quaquel! Thank you for adding the bug label. All 14 CI checks are passing. This is my first contribution to Mesa and I'm also a GSoC 2026 applicant interested in the Mesa-LLM project. Would love your feedback when you have time!

@quaquel quaquel merged commit a3499bd into mesa:main Mar 14, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Release notes label

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: InputText Widget Returns String Seed, Causing Model Reset to Fail

2 participants