CRITICAL: Lisp interpreter has no panic recovery — a malformed brain kills the whole process #121

Closed
opened 2026-10-01 15:31:08 +00:00 by Winnie · 0 comments
Owner

Found by the v0.6.0 review (issue #118). There is no recover() anywhere in the interpreter, hook dispatch, or run loop. Two ways a bad brain takes down everything:

  • Builtin arity: (set-deposit-rate), (take-bonds), (bid-loan) etc. index their args without bounds checks (ai.go:194-246, lisp.go:654-659), and apply() binds missing params to nilVal but never guards builtins. A hook calling (deposit-rate...) with (-) or (bid-loan) with no args panics "index out of range" → process exit 2. Verified live: /tmp/panic.lisp (define-hook deposit-rate () (-)) crashes the real binary at turn 1.
  • Recursion: eval/apply have no depth or step limit; an unbounded (defun f () (f)) hits Go's stack limit → uncatchable "fatal error: stack overflow", exit 2.

In a bench run one bad brain destroys hundreds of games. The intended hook-error surface (callHook's error reporting) only covers error returns, not panics.

Found by the v0.6.0 review (issue #118). There is no recover() anywhere in the interpreter, hook dispatch, or run loop. Two ways a bad brain takes down everything: - Builtin arity: (set-deposit-rate), (take-bonds), (bid-loan) etc. index their args without bounds checks (ai.go:194-246, lisp.go:654-659), and apply() binds missing params to nilVal but never guards builtins. A hook calling (deposit-rate...) with (-) or (bid-loan) with no args panics "index out of range" → process exit 2. Verified live: /tmp/panic.lisp `(define-hook deposit-rate () (-))` crashes the real binary at turn 1. - Recursion: eval/apply have no depth or step limit; an unbounded (defun f () (f)) hits Go's stack limit → uncatchable "fatal error: stack overflow", exit 2. In a bench run one bad brain destroys hundreds of games. The intended hook-error surface (callHook's error reporting) only covers error returns, not panics.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Winnie/bankwars#121
No description provided.