fix(coding-lint): validate generated skill calls correctly#733
Open
Wuodan wants to merge 1 commit intomindcraft-bots:developfrom
Open
fix(coding-lint): validate generated skill calls correctly#733Wuodan wants to merge 1 commit intomindcraft-bots:developfrom
Wuodan wants to merge 1 commit intomindcraft-bots:developfrom
Conversation
… index Generated-code lint did not validate referenced `skills.*` / `world.*` calls correctly. `coder.js` extracted only method names such as `placeBlock`, while `SkillLibrary` exposed skill docs as strings keyed by fully qualified names such as `skills.placeBlock`. That meant lint validation depended on the shape of the prompt-doc data instead of on a real function index, so the check was unreliable and could misreport valid generated calls. Replace that with a structured namespace-aware function index in `SkillLibrary` and validate parsed calls against it in `coder.js`. Missing calls are now reported as fully qualified names, prompt doc selection stays unchanged, and the now-unused `getAllSkillDocs()` accessor is removed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This fixes two problems in validation of generated code. The two problems
canceled each other out for a while, which made the bug hard to spot.
Skill-library methods vs. validated parsed methods
SkillLibrarysees them in the formskills.placeBlockcoder.jsvalidated only the parsed method name likeplaceBlockValidation result double-negated in
coder.jsconst missingSkills = skills.filter(skill => !!allDocs[skill]);With the old code, generated skill calls were therefore not validated
correctly. After correcting only the double-negation, valid calls could then
show up as missing because the underlying comparison still used incompatible
formats.
This change fixes that by validating generated calls against a structured,
namespace-aware function index instead of against raw skill-doc strings.
To reproduce the problem:
src/agent/coder.js:Run
mindcraftwithallow_insecure_coding=trueand a bot profile that hasa
code_modeland anembeddingmodel.Use a task that is likely to trigger code generation. One example is the
small_churchtask fromtasks-demo/construction_tasks/custom/tasks.json, adapted to one bot andwith explicit wording to force
!newActionand avoid resource gathering:Then the logs can show valid generated code like:
but still report a validation error like:
This PR fixes that by keeping namespace information during validation and by
checking generated calls against a structured skill index instead of a doc
string array.