[log] Add debug logging to executeBackendRequest in backend_call.go (… · github/gh-aw-mcpg@03c6ca5 · GitHub
Skip to content

Commit 03c6ca5

Browse files
authored
[log] Add debug logging to executeBackendRequest in backend_call.go (#14021)
## Summary Adds targeted debug logging to `executeBackendRequest` in `internal/server/backend_call.go`, the shared helper that centralizes backend JSON-RPC calls (`GetOrLaunchForSession` → `SendRequestWithServerID` → error check → unmarshal). ## Changes - Logs function entry with `serverID` and `method` before attempting to connect to the backend. - Logs the connection failure path when `launcher.GetOrLaunchForSession` fails, before the error is wrapped and returned. Both calls reuse the existing `logUnified` logger (declared once in `internal/server/unified.go` and shared across files in the `server` package per project convention), so no new logger declaration was needed. Log arguments are simple string/error values with no side effects. ## Why this file `backend_call.go` already has substantial logging (18 existing `logUnified` calls across its other functions), but `executeBackendRequest` — despite being the most central helper (used by every backend tool call) — had no entry-point or connection-failure logging, making it harder to trace where a backend call chain started or failed to connect. ## Investigated but rejected - `internal/util/atomic_write.go` and `internal/syncutil/registry.go` were also considered (both had no logger), but adding a `logger.New(...)` import to either introduces an **import cycle** with `internal/logger` (which imports `internal/util`, `internal/syncutil`, `internal/sanitize`, and `internal/tty`). These packages must not import `internal/logger`. ## Validation - `go build -o awmg .` — succeeds - `go vet ./internal/server/` — clean - `go test ./internal/server/...` — all tests pass - `gofmt -l internal/server/backend_call.go` — no formatting issues > Generated by [Go Logger Enhancement](https://github.com/github/gh-aw-mcpg/actions/runs/36358637067) · copilot · auto · 149.5 AIC · ⊞ 12.9K · [◷](https://github.com/search?q=repo%3Agithub%2Fgh-aw-mcpg+%22gh-aw-workflow-id%3A+go-logger%22&type=pullrequests) <!-- gh-aw-agentic-workflow: Go Logger Enhancement, engine: copilot, model: auto, id: 36358637067, workflow_id: go-logger, run: https://github.com/github/gh-aw-mcpg/actions/runs/36358637067 --> <!-- gh-aw-workflow-id: go-logger --> <!-- gh-aw-workflow-call-id: github/gh-aw-mcpg/go-logger -->
2 parents 2d0a5a3 + 28c6734 commit 03c6ca5

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎internal/server/backend_call.go‎

Lines changed: 2 additions & 0 deletions

0 commit comments

Comments
 (0)