Skip to content

Commit 9766d84

Browse files
dsarnoclaude
andcommitted
Align install-dispatch version check with the gate predicate (F2)
The _can_self_update() gate is major-aware (major>4 or (major==4 and minor>=4)), but _install_zip / _install_zip_inline still keyed off `minor >= 4` only. On a future Godot 5.0 (major=5, minor=0) the gate would let the user in expecting the seamless runner reload, but the minor-only check would route them to the pre-4.4 inline extract + "Restart editor" path — the crash-prone flow the gate exists to avoid. Route both install-dispatch checks through the same _version_can_self_update(major, minor) predicate (already unit-tested for 4.3/4.4/4.6/5.0) so the gate and the dispatch can't disagree. No behavior change on 4.4-4.6; fixes the latent 5.x inconsistency. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent b0080fa commit 9766d84

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

plugin/addons/godot_ai/utils/update_manager.gd

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,11 @@ func _install_zip() -> void:
340340
_plugin != null
341341
and _plugin.has_method("install_downloaded_update")
342342
)
343-
if int(version.get("minor", 0)) >= 4 and has_runner:
343+
## Same major-aware predicate as the _can_self_update() gate, so a future
344+
## Godot 5.x (minor 0) takes the runner path the gate promised — not the
345+
## pre-4.4 inline extract. A bare `minor >= 4` here would route 5.0 to the
346+
## crash-prone inline path even though the gate let it in.
347+
if _version_can_self_update(int(version.get("major", 0)), int(version.get("minor", 0))) and has_runner:
344348
install_state_changed.emit({"button_text": "Reloading..."})
345349
## Runner takes over: plugin tears down, runner extracts + scans +
346350
## re-enables. `install_downloaded_update` calls
@@ -393,7 +397,7 @@ func _install_zip_inline(version: Dictionary) -> void:
393397
if _plugin != null and _plugin.has_method("prepare_for_update_reload"):
394398
_plugin.prepare_for_update_reload()
395399

396-
if int(version.get("minor", 0)) >= 4:
400+
if _version_can_self_update(int(version.get("major", 0)), int(version.get("minor", 0))):
397401
install_state_changed.emit({"button_text": "Scanning..."})
398402
## Filesystem scan must complete before plugin reload — otherwise
399403
## plugin.gd re-parses against a ClassDB that hasn't seen the new

0 commit comments

Comments
 (0)