From ae005569238b3c0d00f98d43932b8b56d77bb3dd Mon Sep 17 00:00:00 2001 From: Hermes Date: Tue, 18 Aug 2026 18:23:56 +0500 Subject: [PATCH] =?UTF-8?q?feat(debug):=20=D0=BB=D0=BE=D0=B3=D0=B8=D1=80?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D1=82=D1=8C=20=D0=B2=D1=81=D0=B5=20API-?= =?UTF-8?q?=D0=B2=D1=8B=D0=B7=D0=BE=D0=B2=D1=8B=20=D0=BA=20opencode=20serv?= =?UTF-8?q?e=20=D1=81=20=D1=81=D0=BE=D0=B4=D0=B5=D1=80=D0=B6=D0=B8=D0=BC?= =?UTF-8?q?=D1=8B=D0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit В единой точке Client.do добавлены отладочные логи (всегда включены): - строка вызова: opencode api -> - тело запроса (усечено до 5000 байт) - тело ответа 2xx (усечено до 5000 байт) - тело ответа при ошибке/не-2xx (усечено до 1000 байт) Нужно для диагностики проблемы аналитика (serve отвечал на модель opencode/nemotron, ratatoskr не видел вердикт). --- internal/opencode/client.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/opencode/client.go b/internal/opencode/client.go index 0d81328..51c202e 100644 --- a/internal/opencode/client.go +++ b/internal/opencode/client.go @@ -6,6 +6,7 @@ import ( "encoding/json" "fmt" "io" + "log" "net/http" "time" ) @@ -61,6 +62,11 @@ func (c *Client) do(ctx context.Context, method, path, op string, body []byte) ( if body != nil { req.Header.Set("Content-Type", "application/json") } + log.Printf("opencode api %s -> %s %s%s", + op, method, c.BaseURL, path) + if len(body) > 0 { + log.Printf("opencode api %s request body: %s", op, truncateStr(string(body), 5000)) + } resp, err := c.http.Do(req) if err != nil { return nil, &ClientErr{Op: "connect", Err: err} @@ -71,8 +77,10 @@ func (c *Client) do(ctx context.Context, method, path, op string, body []byte) ( return nil, &ClientErr{Op: "connect", Err: err} } if resp.StatusCode < 200 || resp.StatusCode > 299 { + log.Printf("opencode api %s response: status %d: %s", op, resp.StatusCode, truncateStr(string(b), 1000)) return nil, &ClientErr{Op: op, Err: fmt.Errorf("status %d: %s", resp.StatusCode, truncateStr(string(b), 300))} } + log.Printf("opencode api %s response (%d bytes): %s", op, len(b), truncateStr(string(b), 5000)) return b, nil }