Skip to content

Commit 626c231

Browse files
dsarnoclaude
andauthored
Address Copilot review on #408: post-await guard + ellipsis consistency (#409)
1. Re-check `_plugin.has_method("force_restart_or_start_dev_server")` after the 0.15s await in `_perform_dev_restart_after_feedback`. A self-update mixed-state could swap the plugin script class while we were sleeping, leaving the old reference pointing at a class that no longer carries the new method. Same #168 guard pattern other dock helpers use. 2. Switch the dev primary button's "Restarting…" / "respawning…" labels to "Restarting..." / "respawning..." (three ASCII dots) to match the sibling _crash_restart_btn / _version_restart_btn / status text already in this file. Tests assert on the substring "Restarting" so they're unaffected. Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 65c743a commit 626c231

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

plugin/addons/godot_ai/mcp_dock.gd

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1355,10 +1355,14 @@ func _on_dev_stop_pressed() -> void:
13551355

13561356

13571357
func _perform_dev_restart_after_feedback() -> void:
1358-
## Brief paint cycle so the user sees "Restarting" before the
1358+
## Brief paint cycle so the user sees "Restarting..." before the
13591359
## blocking _wait_for_port_free freezes the editor for up to 5s.
13601360
await get_tree().create_timer(0.15).timeout
1361-
if _plugin != null:
1361+
## Re-check has_method post-await — a self-update mixed-state window
1362+
## could swap _plugin's script class while we were sleeping, leaving
1363+
## the old reference pointing at a class that no longer carries the
1364+
## new method. Same #168 guard pattern as _update_dev_section_buttons.
1365+
if _plugin != null and _plugin.has_method("force_restart_or_start_dev_server"):
13621366
_plugin.force_restart_or_start_dev_server()
13631367
## start_dev_server's spawn happens via a 0.5s SceneTree timer; give
13641368
## it time to land plus a buffer for the WS reconnect before clearing
@@ -1385,8 +1389,8 @@ func _update_dev_section_buttons() -> void:
13851389
if _dev_primary_btn != null:
13861390
if _server_restart_in_progress:
13871391
_dev_primary_btn.disabled = true
1388-
_dev_primary_btn.text = "Restarting"
1389-
_dev_primary_btn.tooltip_text = "Killing the current server and respawning"
1392+
_dev_primary_btn.text = "Restarting..."
1393+
_dev_primary_btn.tooltip_text = "Killing the current server and respawning..."
13901394
else:
13911395
var primary_state := _dev_primary_btn_state(has_managed, dev_running)
13921396
_dev_primary_btn.disabled = false

0 commit comments

Comments
 (0)