Commit b896065
game_eval: require an ack before treating a missing compile beacon as a parse error (#490 review)
The 3s compile-grace timer inferred a parse error purely from the ABSENCE of
mcp:eval_compiled, conflating two cases: (a) the source failed to parse
(game's _handle_eval aborts at reload() before the beacon), and (b) the game
main thread hasn't serviced the eval message yet — a long frame/load, or a
CPU-bound prior eval (now possible with concurrent evals). In case (b) a valid
eval was false-failed as EVAL_COMPILE_ERROR, and worse, _clear_pending dropped
the eventual real eval_compiled/eval_response as an unknown request_id, losing
the actual result.
Fix (the eval_ack the #490 design originally called for): the game sends
mcp:eval_ack at the top of _handle_eval, BEFORE reload(), so it survives a
parse-error abort. The editor now fires EVAL_COMPILE_ERROR only when the eval
was acked (received + reload started) but never compiled — a positive
compile-failure signal. A missing ack means "not serviced yet", so the grace
defers to the normal timeout and leaves _pending intact, so the real reply is
still delivered.
Refactored the grace lambda into _on_eval_grace(request_id) so the gate is
unit-testable. Added editor-side tests: _on_eval_ack sets the flag; grace fires
EVAL_COMPILE_ERROR when acked-but-not-compiled, defers (no false error, pending
intact) when not acked, and is a no-op when already compiled. Full GDScript
suite green (1366); all 6 live cases re-verified.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent ff2623e commit b896065
3 files changed
Lines changed: 106 additions & 14 deletions
File tree
- plugin/addons/godot_ai
- debugger
- runtime
- test_project/tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
154 | 154 | | |
155 | 155 | | |
156 | 156 | | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
157 | 160 | | |
158 | 161 | | |
159 | 162 | | |
| |||
437 | 440 | | |
438 | 441 | | |
439 | 442 | | |
440 | | - | |
441 | | - | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
442 | 447 | | |
443 | | - | |
444 | | - | |
445 | | - | |
446 | | - | |
447 | | - | |
448 | | - | |
449 | | - | |
450 | | - | |
451 | | - | |
452 | | - | |
453 | | - | |
454 | | - | |
| 448 | + | |
455 | 449 | | |
456 | 450 | | |
457 | 451 | | |
| |||
460 | 454 | | |
461 | 455 | | |
462 | 456 | | |
| 457 | + | |
463 | 458 | | |
464 | 459 | | |
465 | 460 | | |
| |||
512 | 507 | | |
513 | 508 | | |
514 | 509 | | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
515 | 551 | | |
516 | 552 | | |
517 | 553 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
593 | 593 | | |
594 | 594 | | |
595 | 595 | | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
596 | 602 | | |
597 | 603 | | |
598 | 604 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
344 | 344 | | |
345 | 345 | | |
346 | 346 | | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
0 commit comments