Commit 1d505ea
authored
Enrich EDITOR_NOT_READY with editor_state + actionable hint (#454)
* Enrich EDITOR_NOT_READY with editor_state + actionable hint
Telemetry on plugin v2.5.6 surfaced an EDITOR_NOT_READY-loop pattern:
89% of EDITOR_NOT_READY errors over 24h came from two users alone,
each retrying node_set_property dozens of times during play mode
before eventually calling project_manage(op="stop") and seeing the
write succeed immediately. The editor was correctly refusing — the
caller had no signal telling it why the editor was unwritable or
how to unstick it, so the LLM looped the failing call.
Mirror the F-001/PROPERTY_NOT_ON_CLASS approach (PR #436): give
the AI caller an explicit, action-oriented recovery hint in the error
payload. Now every EDITOR_NOT_READY response carries:
data: {
editor_state: "playing" | "importing" | "no_scene",
retryable: bool,
hint: "<one-line recovery instruction naming the exact tool to call>"
}
Both halves of the system contribute: the Python require_writable_async
gate attaches the payload for "playing" / "importing", and the GDScript
scene_path.require_edited_scene helper attaches it for "no_scene". The
"playing" hint names project_manage(op="stop") so an LLM can chain
directly to the recovery call instead of guessing.
The data-key name changed from "state" to "editor_state" so it reads
unambiguously in the GodotCommandError serialized form (which LLMs
often see in tool error responses).
* Scope EDITOR_NOT_READY-hint claim to recoverable editor states only
Copilot review on #454 caught an overclaim in the contract test's
docstring (and the parallel comment in scene_path.gd): they read as
if *every* EDITOR_NOT_READY response now carries the structured data
block. It doesn't — only the three recoverable editor *states*
(playing / importing / no_scene) do, because those are the paths an
AI caller can act on. Other EDITOR_NOT_READY callsites in handlers
("EditorFileSystem not available", "AnimationHandler not available",
"No 3D viewport available", etc.) describe internal-state failures
with no caller-actionable recovery and intentionally stay unenriched.
Tighten the docstring and the GDScript comment to say exactly that.
No behavior change.1 parent 0c8c17c commit 1d505ea
4 files changed
Lines changed: 141 additions & 18 deletions
File tree
- plugin/addons/godot_ai/utils
- src/godot_ai/handlers
- tests/unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
78 | 94 | | |
79 | 95 | | |
80 | 96 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
19 | 39 | | |
20 | 40 | | |
21 | 41 | | |
| |||
87 | 107 | | |
88 | 108 | | |
89 | 109 | | |
90 | | - | |
91 | | - | |
92 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
93 | 116 | | |
94 | 117 | | |
95 | 118 | | |
| |||
121 | 144 | | |
122 | 145 | | |
123 | 146 | | |
124 | | - | |
| 147 | + | |
125 | 148 | | |
126 | 149 | | |
127 | 150 | | |
128 | | - | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
129 | 156 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
202 | 202 | | |
203 | 203 | | |
204 | 204 | | |
205 | | - | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
206 | 212 | | |
207 | 213 | | |
208 | 214 | | |
209 | | - | |
| 215 | + | |
210 | 216 | | |
211 | 217 | | |
212 | 218 | | |
| |||
216 | 222 | | |
217 | 223 | | |
218 | 224 | | |
219 | | - | |
220 | | - | |
221 | | - | |
222 | | - | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
223 | 236 | | |
| 237 | + | |
224 | 238 | | |
225 | 239 | | |
226 | 240 | | |
| |||
235 | 249 | | |
236 | 250 | | |
237 | 251 | | |
238 | | - | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
239 | 256 | | |
240 | 257 | | |
241 | 258 | | |
| |||
0 commit comments