Skip to content

[log] Add debug logging to proxy/router.go#7902

Merged
lpcox merged 2 commits into
mainfrom
log/proxy-router-debug-177d64307d5a3151
Jun 22, 2026
Merged

[log] Add debug logging to proxy/router.go#7902
lpcox merged 2 commits into
mainfrom
log/proxy-router-debug-177d64307d5a3151

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Adds 6 debug log calls to internal/proxy/router.go using the existing logRouter logger (proxy:router namespace).

Changes

extractOwnerRepoNumber — the argument-parsing function used by route handlers:

  • Entry log with tool name and key names being extracted
  • Log when a numeric field is provided as float64 (JSON number) instead of string
  • Log when a float64 value is out of int64 range (error path)
  • Log when a float64 value is not a whole number (error path)
  • Log when required fields (owner, repo, or number key) are missing (error path)

StripGHHostPrefix — strips the /api/v3 prefix added by gh when GH_HOST is set:

  • Log when the prefix is actually stripped, making it easier to trace gh-originated requests

Validation

  • go test ./internal/proxy/ — passes
  • go vet ./internal/proxy/ — passes
  • go build — succeeds

Enable

DEBUG=proxy:router ./awmg --config config.toml

Generated by Go Logger Enhancement · 314.5 AIC · ⊞ 8.3K ·

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>
@github-actions github-actions Bot added automation enhancement New feature or request labels Jun 21, 2026
@lpcox lpcox marked this pull request as ready for review June 22, 2026 14:25
Copilot AI review requested due to automatic review settings June 22, 2026 14:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot couldn't run its full agentic review because no GitHub Actions runner was available. Make sure your repository has a runner available to run Copilot's review, or add a copilot-setup-steps.yml file specifying one with the runs-on attribute. See the docs for more details.

Adds debug-level logging to internal/proxy/router.go to make request routing and argument parsing easier to trace when DEBUG=proxy:router is enabled.

Changes:

  • Added debug logs in extractOwnerRepoNumber for entry, float64 parsing, and key error paths.
  • Added debug log in StripGHHostPrefix when /api/v3 is stripped from a path.
Show a summary per file
File Description
internal/proxy/router.go Adds router debug logs around argument extraction and GH_HOST prefix stripping.

Copilot's findings

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 3

Comment thread internal/proxy/router.go Outdated
Comment on lines 82 to 93
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
Comment thread internal/proxy/router.go Outdated
// 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)
Comment thread internal/proxy/router.go Outdated
Comment on lines 485 to 486
logRouter.Printf("StripGHHostPrefix: stripping %s prefix from path", ghHostPathPrefix)
return strings.TrimPrefix(path, ghHostPathPrefix)
@lpcox

lpcox commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

@copilot address review feedback

Copilot AI commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

@copilot address review feedback

Addressed in e085267.

Copilot finished work on behalf of lpcox June 22, 2026 14:51
Copilot AI requested a review from lpcox June 22, 2026 14:51
@lpcox lpcox merged commit de59aba into main Jun 22, 2026
26 checks passed
@lpcox lpcox deleted the log/proxy-router-debug-177d64307d5a3151 branch June 22, 2026 15:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

automation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants