Skip to content

wesnoth_tactical_ai: top-level Lua files never run (if io then raises on an undefined global) #51

Open

Description

@findalexli

Task

wesnoth_tactical_ai

Claim

Every top-level .lua file fails to load, so a Lua candidate action written the way the instruction describes never runs in grading, and the grade doesn't say so. The sandbox header in judge/eval_wesnoth.py ends in if io then. io isn't defined in Wesnoth's Lua, and reading an undefined global raises:

error scripting/lua: ~add-ons/my_ai/my_recruit.lua:23: variable 'io' must be assigned before being used

This is the instruction's own example CA, unmodified. Local testing has no header, so the same file loads there.

Impact

The submitted Lua code never runs; only the header lines before the failure take effect. Qwen3.8 Flash Next's public final submission loads its Lua CAs this way and scores 48, 67, 57 and 58 on the current judge, and 81, 81, 76 and 79 once the files load. A test CA that stops every unit scores 41 and 47 on the current judge and 0 and 0 with the files loading. We don't know how many other submissions are affected. Archived submissions with a top-level .lua would show it.

Evidence and how to reproduce

On community f92857a3, with the files from https://github.com/findalexli/EdgeBench/tree/da540564098c8bbc0ad5b9b4cfce0ce53045f8d6/wesnoth_tactical_ai. hold.tar.gz is the stock CAs plus a Lua CA that stops every unit:

python -m sforge build --task wesnoth_tactical_ai
python -m sforge eval --task wesnoth_tactical_ai --archive hold.tar.gz --run-id hold --json

It still wins games. To see the error (run docker images edgebench.judge.wesnoth_tactical_ai for the image):

sh diagnose.sh <judge-image> example.tar.gz

This installs the archive as the judge does, plays one game and prints the load errors shown above. For hold.tar.gz they name my_hold.lua.

Proposed fix

if rawget(_G, "io") then, one line. #56

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions