Researcher Uses AI and Formal Verification to Unearth Three NetHack Bugs

davidbau · x · 2026-09-27

David Bau shares his hands-on workflow learning formal methods coding with AI assistance: he found three reproducible bugs in NetHack's polymorph code (src/polyself.c) — a deleted light source that was never created, cleanup executed twice per polymorph causing double damage rolls, and decisions still made by the superseded form's rules (fatally stripping water-walking boots while standing in lava).

Formal verification then revealed a hole in his first fix: a second form change triggered by polymorph damage is mishandled. He filed issue #1682 with a companion PR and asks how to avoid missing issues when checking assumptions.

Original post →

More from coding & agent

coding & agent channel →