muse-chat-api.py: Fix sidechat create URL race\n\nPoll for /thread/ URL up to 15s instead of fixed 5s sleep.\nWas capturing base URL before navigation settled.

This commit is contained in:
operator-main
2026-10-04 03:10:52 +00:00
parent 2b76863520
commit 39e47ab2ef
+11 -1
View File
@@ -277,8 +277,18 @@ def cmd_sidechat_create(ws):
print("ERROR: 'New side chat' button not found (sidebar may be closed)", file=sys.stderr)
sys.exit(1)
import time as _time
_time.sleep(5)
# Poll for URL to change to a thread URL (up to 15s)
# Fixed 2026-10-04: was sleeping 5s and reading once, often captured
# base URL before navigation settled.
url = None
for i in range(15):
_time.sleep(1)
url = ev(ws, "window.location.href")
if url and "/thread/" in url:
break
if not url or "/thread/" not in url:
print(f"ERROR: Sidechat creation did not navigate to thread URL (got: {url})", file=sys.stderr)
sys.exit(1)
print(f"Created: {url}")
return url