From 9dcd793b225e717d7b3c5b3319c4e106529656b4 Mon Sep 17 00:00:00 2001 From: "Molecule AI Dev Engineer A (Kimi)" Date: Wed, 10 Jun 2026 23:40:00 +0000 Subject: [PATCH] fix(registry): log boot Register HTTP response code on non-200 (#2500) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds a deferred log in Register that captures workspace ID, HTTP status code, and duration whenever a boot register returns non-200. This lets operators distinguish: - 401 → C18 token race / auth failure - 400 → invalid push-URL or malformed payload - 403 → platform kind guard rejection - 5xx → DB or internal error The log fires after the response is written so every early-return path is covered without adding individual log statements at each error site. Complements the heartbeat provisioning→online promotion fix in PR #2562. Refs #2500 --- workspace-server/internal/handlers/registry.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/workspace-server/internal/handlers/registry.go b/workspace-server/internal/handlers/registry.go index c96fb6d7a..f47844913 100644 --- a/workspace-server/internal/handlers/registry.go +++ b/workspace-server/internal/handlers/registry.go @@ -331,6 +331,17 @@ func (h *RegistryHandler) Register(c *gin.Context) { return } + // #2500 instrumentation: log non-200 boot Register outcomes so operators + // can distinguish 401 (C18 token race), 400 (push-URL invalid/empty), + // 403 (platform kind guard), 5xx (DB/internal error), or success from + // client timeout / unreachable $PLATFORM_URL. + registerStart := time.Now() + defer func(wsID string) { + if status := c.Writer.Status(); status != http.StatusOK { + log.Printf("Registry register: workspace=%s boot_register_failed status=%d duration=%s", wsID, status, time.Since(registerStart)) + } + }(payload.ID) + // Validate explicit delivery_mode if the agent declared one; empty is // allowed and resolves to the row's existing value (or "push" default) // in the upsert below. See #2339 for the poll/push split rationale. -- 2.52.0