Conversation
…in cmd package Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Analyze and resolve duplicate code issues in Go files
Eliminate duplicate constants: centralize DefaultLogDir, DefaultPayloadDir, DefaultPayloadSizeThreshold in config package
Mar 6, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR centralizes CLI/logging default values by removing duplicated constants from internal/cmd and using the canonical defaults from internal/config, reducing the risk of silent drift between configuration and CLI behavior.
Changes:
- Introduces
config.DefaultLogDiralongside existing payload defaults ininternal/config. - Updates CLI flag/env defaulting and guard comparisons to reference
config.Default*constants. - Aligns tests and environment validation logic with the centralized defaults.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| internal/config/config_logging.go | Adds DefaultLogDir constant as the canonical log directory default. |
| internal/cmd/flags_logging.go | Removes local default constants and references config.Default* instead. |
| internal/cmd/root.go | Updates comparisons that relied on removed local defaults to use config.Default*. |
| internal/config/validation_env.go | Replaces inline default log-dir literal with DefaultLogDir. |
| internal/cmd/flags_logging_test.go | Updates expectations to use config.Default* constants. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced Mar 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
internal/cmdpackage independently redeclareddefaultPayloadDir,defaultPayloadSizeThreshold, anddefaultLogDir— values already canonical ininternal/config. This created silent drift risk: changes toconfig_payload.gowould not propagate to the CLI layer.Changes
internal/config/config_logging.go(new) — addsDefaultLogDir = "/tmp/gh-aw/mcp-logs"constant, mirroring the pattern already established byDefaultPayloadDir/DefaultPayloadSizeThresholdinconfig_payload.gointernal/cmd/flags_logging.go— removes the three duplicate local constants; referencesconfig.DefaultLogDir,config.DefaultPayloadDir,config.DefaultPayloadSizeThresholdinternal/cmd/root.go— updates two comparison guards that also relied on the removed local constantsinternal/config/validation_env.go— replaces inline"/tmp/gh-aw/mcp-logs"literal withDefaultLogDirinternal/cmd/flags_logging_test.go— test expectations updated to referenceconfig.Default*constants directlyWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
example.com/tmp/go-build846392901/b301/launcher.test /tmp/go-build846392901/b301/launcher.test -test.testlogfile=/tmp/go-build846392901/b301/testlog.txt -test.paniconexit0 -test.timeout=10m0s conf�� 64/src/runtime/cgo credential.helper 64/bin/as(dns block)invalid-host-that-does-not-exist-12345.com/tmp/go-build846392901/b283/config.test /tmp/go-build846392901/b283/config.test -test.testlogfile=/tmp/go-build846392901/b283/testlog.txt -test.paniconexit0 -test.timeout=10m0s conf�� /go-build --local x_amd64/asm pull.rebase 64/src/runtime/c-unsafeptr=false(dns block)nonexistent.local/tmp/go-build846392901/b301/launcher.test /tmp/go-build846392901/b301/launcher.test -test.testlogfile=/tmp/go-build846392901/b301/testlog.txt -test.paniconexit0 -test.timeout=10m0s conf�� 64/src/runtime/cgo credential.helper 64/bin/as(dns block)slow.example.com/tmp/go-build846392901/b301/launcher.test /tmp/go-build846392901/b301/launcher.test -test.testlogfile=/tmp/go-build846392901/b301/testlog.txt -test.paniconexit0 -test.timeout=10m0s conf�� 64/src/runtime/cgo credential.helper 64/bin/as(dns block)this-host-does-not-exist-12345.com/tmp/go-build846392901/b310/mcp.test /tmp/go-build846392901/b310/mcp.test -test.testlogfile=/tmp/go-build846392901/b310/testlog.txt -test.paniconexit0 -test.timeout=10m0s conf�� --local user.name /opt/hostedtoolcache/go/1.25.7/x--property=MemoryHigh=170M 988407/b107/(dns block)If you need me to access, download, or install something from one of these locations, you can either:
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.