From 8df345930bdb1d636d3bfc3a40a7999f4ce539eb Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Sun, 21 Jun 2026 23:58:18 +0000 Subject: [PATCH 1/2] Add debug logging to proxy/router.go Add 6 debug log calls to extractOwnerRepoNumber and StripGHHostPrefix to aid troubleshooting argument parsing and path prefix stripping in the proxy router. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- internal/proxy/router.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/internal/proxy/router.go b/internal/proxy/router.go index 617fc4a2f..d1521e105 100644 --- a/internal/proxy/router.go +++ b/internal/proxy/router.go @@ -73,18 +73,22 @@ func repoArgsExtractor(m []string) map[string]interface{} { // from tool arguments, accepting either string or float64 JSON number inputs for // the identifier. func extractOwnerRepoNumber(argsMap map[string]interface{}, ownerKey, repoKey, numberKey, toolName string) (owner, repo, number string, err error) { + logRouter.Printf("extractOwnerRepoNumber: tool=%s, keys=%s/%s/%s", toolName, ownerKey, repoKey, numberKey) owner = strutil.GetStringFromMap(argsMap, ownerKey) repo = strutil.GetStringFromMap(argsMap, repoKey) number = strutil.GetStringFromMap(argsMap, numberKey) if number == "" { if n, ok := argsMap[numberKey].(float64); ok { + logRouter.Printf("extractOwnerRepoNumber: %s provided as float64, parsing as integer for tool=%s", numberKey, toolName) const maxInt64AsFloat = float64(int64(^uint64(0) >> 1)) if n < 0 || n > maxInt64AsFloat { + logRouter.Printf("extractOwnerRepoNumber: %s value out of int64 range for tool=%s", numberKey, toolName) err = fmt.Errorf("%s: invalid %s (out of range)", toolName, numberKey) return } i := int64(n) if n != float64(i) { + logRouter.Printf("extractOwnerRepoNumber: %s value is not a whole number for tool=%s", numberKey, toolName) err = fmt.Errorf("%s: invalid %s (expected integer)", toolName, numberKey) return } @@ -92,6 +96,7 @@ func extractOwnerRepoNumber(argsMap map[string]interface{}, ownerKey, repoKey, n } } if owner == "" || repo == "" || number == "" { + logRouter.Printf("extractOwnerRepoNumber: missing required field(s) for tool=%s: owner=%q repo=%q %s=%q", toolName, owner, repo, numberKey, number) err = fmt.Errorf("%s: missing %s/%s/%s", toolName, ownerKey, repoKey, numberKey) } return @@ -477,6 +482,7 @@ func MatchRoute(path string) *RouteMatch { // StripGHHostPrefix removes the /api/v3 prefix that gh adds when using GH_HOST. func StripGHHostPrefix(path string) string { if strings.HasPrefix(path, ghHostPathPrefix) { + logRouter.Printf("StripGHHostPrefix: stripping %s prefix from path", ghHostPathPrefix) return strings.TrimPrefix(path, ghHostPathPrefix) } return path From e085267a4d7c30ade1c40f19287fcf9af5344445 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 22 Jun 2026 14:49:06 +0000 Subject: [PATCH 2/2] Address proxy router review feedback --- internal/proxy/router.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/proxy/router.go b/internal/proxy/router.go index d1521e105..e44dd52e7 100644 --- a/internal/proxy/router.go +++ b/internal/proxy/router.go @@ -73,22 +73,21 @@ func repoArgsExtractor(m []string) map[string]interface{} { // from tool arguments, accepting either string or float64 JSON number inputs for // the identifier. func extractOwnerRepoNumber(argsMap map[string]interface{}, ownerKey, repoKey, numberKey, toolName string) (owner, repo, number string, err error) { - logRouter.Printf("extractOwnerRepoNumber: tool=%s, keys=%s/%s/%s", toolName, ownerKey, repoKey, numberKey) owner = strutil.GetStringFromMap(argsMap, ownerKey) repo = strutil.GetStringFromMap(argsMap, repoKey) number = strutil.GetStringFromMap(argsMap, numberKey) if number == "" { if n, ok := argsMap[numberKey].(float64); ok { - logRouter.Printf("extractOwnerRepoNumber: %s provided as float64, parsing as integer for tool=%s", numberKey, toolName) + logRouter.Printf("extractOwnerRepoNumber: %s provided as float64=%v, parsing as integer for tool=%s", numberKey, n, toolName) const maxInt64AsFloat = float64(int64(^uint64(0) >> 1)) if n < 0 || n > maxInt64AsFloat { - logRouter.Printf("extractOwnerRepoNumber: %s value out of int64 range for tool=%s", numberKey, toolName) + logRouter.Printf("extractOwnerRepoNumber: %s float64=%v out of int64 range [0,%v] for tool=%s", numberKey, n, maxInt64AsFloat, toolName) err = fmt.Errorf("%s: invalid %s (out of range)", toolName, numberKey) return } i := int64(n) if n != float64(i) { - logRouter.Printf("extractOwnerRepoNumber: %s value is not a whole number for tool=%s", numberKey, toolName) + logRouter.Printf("extractOwnerRepoNumber: %s float64=%v is not a whole number for tool=%s", numberKey, n, toolName) err = fmt.Errorf("%s: invalid %s (expected integer)", toolName, numberKey) return } @@ -482,8 +481,9 @@ func MatchRoute(path string) *RouteMatch { // StripGHHostPrefix removes the /api/v3 prefix that gh adds when using GH_HOST. func StripGHHostPrefix(path string) string { if strings.HasPrefix(path, ghHostPathPrefix) { - logRouter.Printf("StripGHHostPrefix: stripping %s prefix from path", ghHostPathPrefix) - return strings.TrimPrefix(path, ghHostPathPrefix) + trimmedPath := strings.TrimPrefix(path, ghHostPathPrefix) + logRouter.Printf("StripGHHostPrefix: stripping %s prefix from %q -> %q", ghHostPathPrefix, path, trimmedPath) + return trimmedPath } return path }