From 6c58b23946dbbc6cfede44e5b618a4de008631a0 Mon Sep 17 00:00:00 2001 From: lc6464 <64722907+lc6464@users.noreply.github.com> Date: Sat, 28 Mar 2026 00:19:20 +0800 Subject: [PATCH] fix(web): clarify version timeout rationale --- web/backend/api/version.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/web/backend/api/version.go b/web/backend/api/version.go index 7a180654a..cde8b40a2 100644 --- a/web/backend/api/version.go +++ b/web/backend/api/version.go @@ -43,9 +43,10 @@ func newSystemVersionCache() *systemVersionCache { } var ( - // Reuse the launcher gateway startup window so embedded/slow devices - // have enough time for first-run command initialization. - versionCmdTimeout = gatewayStartupWindow + // 15 seconds matches the gateway startup window used elsewhere in launcher flow, + // giving slow/embedded hosts enough time for first command invocation while + // staying independent from cross-file init ordering. + versionCmdTimeout = 15 * time.Second findPicoclawBinaryForInfo = utils.FindPicoclawBinary runPicoclawVersionOutput = executePicoclawVersion currentGatewayVersionState = gatewayVersionState @@ -64,7 +65,10 @@ func (h *Handler) handleGetVersion(w http.ResponseWriter, r *http.Request) { versionInfo := h.resolveSystemVersionInfo(r.Context()) w.Header().Set("Content-Type", "application/json") - json.NewEncoder(w).Encode(versionInfo) + if err := json.NewEncoder(w).Encode(versionInfo); err != nil { + http.Error(w, "Failed to encode response", http.StatusInternalServerError) + return + } } // resolveSystemVersionInfo prefers the actual picoclaw binary version output,