Repository navigation
fix(blender): OpenCode for Blender 0.4.4, find the API and verify by criteria - #26
Merged
Merged
Conversation
…criteria The 0.4.3 exercises showed agents guessing Blender's Python API (a property name, an operator's stroke elements, a node's sockets, the 5.3 compositing tree), declaring results they had not measured, and a scripted sculpt stroke closing Blender 5.3. 0.4.4 answers from the running Blender itself, never from embedded tables, and keeps the tool surface as it was. Errors that say what is valid: a failed execute_code run on Blender's API carries a hint, read before the run is undone: the closest names and the type's properties for an unknown attribute, the operator's real signature (with its collections' element type) for its arguments, the closest items for an invalid enumeration value, a collection's keys for a missing key (node sockets included), the node types the tree creates for an unknown node type, Blender's reason and the context the code had for a failed poll. The add-on wraps the bpy.ops callables created during the run (same call, poll, get_rna_type and repr; restored afterwards) to name the failing operator, and reads a failing collection or node tree from the failing line with names, attribute reads and constant subscripts only. blender_inspect: search finds words in this Blender's types, properties, functions and operators, with their paths and the properties that lead to a type; an operator shows its collections' element type and its poll here with Blender's reason; tree makes a node type in the tree named (shader, geometry, compositing, texture) or lists what that tree creates instead; entries beyond limit are named instead of cut, and match takes words as well as a glob. blender_verify: criteria are the agent's own checks (a read-only expression or a bpy.data path, a comparison, a value, frames), measured on the evaluated scene and returned passed or failed with the value; visible says whether an object shows in the render at a frame, or every reason found (out of frame, hidden in render, collection excluded, view layer not rendered, holdout, transparent or zero-density material, no geometry, hidden behind another object). The render runs when asked, or without criteria and visible. The sculpt crash is a Blender 5.3 defect, established without the add-on: the script path of sculpt.brush_stroke skips the grid mask layer its interactive path creates (BKE_sculpt_mask_layers_ensure), so a mask stroke (the Mask brush or brush_toggle='MASK', which the default keymap binds to Alt+drag) on a multiresolution object corrupts the heap. A sphere with one Multires level and one scripted mask stroke closes Blender from a timer and from the Text editor's Run Script alike; the same strokes by hand never do. OpenCode Link now creates the layer first, as the interactive path does (inverting the mask twice keeps its values), and says so in warnings. A background Blender has no undo stack until a first undo step, and every sculpt-mode operator closes it without one: a first step is pushed when none was. The add-on's hello names its process and crash folder, so a call after Blender closed says so with the crash report it wrote instead of an unreachable host (not under WSL, where Blender's process is on Windows). Asset previews run from execute_code in a Blender with a window when the operator gets its data-block (temp_override(id=...)); the failed poll's hint and inspect now show that. The working method asks to inspect the exact element, read an error's hint and inspect again, set measurable criteria and conclude with blender_verify, within its 10 lines. Validation: ops044_tests.py (12 tests) and three plugin tests in a background Blender 5.3 fail on 0.4.3 (the first through a real crash) and pass on 0.4.4; unit tests for the closed-Blender notice. Windowed Blender 5.3 on Ubuntu, through the add-on's execute_code: the minimal mask stroke and the full ex02 sequence 6/6 alive with 0.4.4, 2/3 crashes with 0.4.3 in the same harness; asset previews generated. lint, typecheck, npm test, build, check:markers, trace scan, Blender suites (20/20, extension 1/1) and native sessions with OpenCode 2.2.5 pass.
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.
OpenCode for Blender 0.4.4, from the 0.4.3 exercises (QA journal, Luna section): an agent finds Blender's API from the running Blender and verifies by measurement. Every answer is read from the running Blender (RNA,
bpy.ops, node types made in a temporary tree); no embedded tables, no new tool.What changes
execute_coderun on Blender's API carries ahint, read before the run is undone: the closest names and the type's properties (unknown attribute, e.g.Sculpt.detail_type→detail_type_method), the operator's real signature with its collections' element type (unknown or missing argument), the closest items (invalid enum value), the collection's keys (missing key, node sockets included), the node types the tree creates with their sockets (unknown node type), Blender's reason and the context the code had (failed poll).blender_inspect.searchfinds words in types, properties, functions and operators, with their paths and the properties that lead to a type; operators show their collections' element type (OperatorStrokeElement) and their poll here with Blender's reason;treemakes a node type in the tree named (shader, geometry, compositing, texture) or lists what that tree creates; entries beyondlimitare named, never cut;matchtakes words or a glob.blender_verifyby criteria.criteria: the agent's checks (read-only expression orbpy.datapath, comparison, value, frames), measured on the evaluated scene, passed or failed with the value (bounds(name),ev(name),world(name)helpers).visible: whether an object shows in the render at a frame, otherwise every reason found (out of frame, hidden in render, collection excluded, view layer not rendered, holdout, transparent or zero-density material, no geometry, hidden behind another object). The render runs when asked, or without them.warnings. After a closure, the next call says "Blender closed" with the crash report path (the add-on'shellonames its process and crash folder).execute_codein a Blender with a window when given their context (temp_override(id=...)); the failed poll's hint andinspectnow show Blender's reason and that context.blender_verify(still 10 lines at most).The sculpt crash (Blender 5.3.0)
multires_subdivide→ Sculpt mode → onesculpt.brush_stroke(stroke=[2 elements], brush_toggle='MASK')intemp_override(window, area, region). 3/3 crashes (Ubuntu VM, plain timer script, no add-on); removing multires, or using toggleNone/SMOOTH, gives 0/12. The real Mask brush crashes too.brush_toggle='MASK'is what the default keymap binds to Alt+drag; the override is the documented context API and the poll needs it.sculpt_brush_stroke_invokecallsBKE_sculpt_mask_layers_ensurefor a mask brush;sculpt_brush_stroke_execdoes not, so the stroke writes into grid masks that were never allocated (heap corruption, thenlayerCopy_mdispson the mode switch). With the layer created first: 0/15 crashes, the mask painted. Not filed upstream.ED_undosys_stack_memfile_id_changed_tag); after oneed.undo_push, 10/10 survive.Validation
ops044_tests.py(12) and three plugin tests in a background Blender 5.3: fail on 0.4.3 (the first through a real crash), pass on 0.4.4.execute_code: minimal stroke and the full ex02 sequence 6/6 alive with 0.4.4, 2/3 crashes with 0.4.3 in the same harness; asset preview generated (128 × 128).npm test, build,check:markers, trace scan, Blender suites (20/20, extension 1/1), native sessions with OpenCode 2.2.5.test/MANUAL.mdfor the real trial.