-
Notifications
You must be signed in to change notification settings - Fork 3
Eliminate duplicate launch logging in launcher package #563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Created internal/launcher/log_helpers.go with reusable logging functions - Extracted logSecurityWarning, logLaunchStart, logEnvPassthrough, logLaunchError, logTimeoutError, logLaunchSuccess - Refactored GetOrLaunch and GetOrLaunchForSession to use helpers - Reduced ~70 lines of duplicate code in launcher.go - All tests pass successfully Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
- Added clear logger variable naming guidelines to AGENTS.md - Updated CONTRIBUTING.md with same convention - Recommend descriptive names like logLauncher, logConfig vs generic log - Explain rationale for avoiding conflicts with standard library - Document current best practices already in use across codebase Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
- Made logEnvPassthrough a Launcher method for consistency - Clarified capitalization guideline (applies to component part after 'log') - Updated call sites to use l.logEnvPassthrough() - All tests pass Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
|
@copilot please fix this build error Building awmg... |
The build is working successfully in the current state (commit 9ec6b32). I tested with both If you're still seeing the import cycle error, try these steps: go clean -cache
go mod tidy
make clean
make buildThe import chain is currently clean:
The error may have been from a cached build state that has since been resolved. Warning 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:
If you need me to access, download, or install something from one of these locations, you can either:
|
Duplicate code analysis identified ~70 lines of duplicated logging code in
GetOrLaunchandGetOrLaunchForSession- nearly identical error handling, security warnings, and timeout diagnostics repeated verbatim.Changes
Extracted 6 logging helpers to
internal/launcher/log_helpers.go:logSecurityWarning- container privilege warningslogLaunchStart- launch initialization (session-aware)logEnvPassthrough- environment variable validationlogLaunchError- failure diagnostics with troubleshooting hintslogTimeoutError- timeout messaginglogLaunchSuccess- success confirmationBefore:
After:
Documented logger naming convention in AGENTS.md and CONTRIBUTING.md - prefer descriptive names (
logLauncher) over genericlogto avoid standard library conflicts.Warning
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:
invalid-host-that-does-not-exist-12345.com/tmp/go-build1641835397/b257/config.test /tmp/go-build1641835397/b257/config.test -test.testlogfile=/tmp/go-build1641835397/b257/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true go1.25.6 -c=4 -nolocalimports -importcfg /tmp/go-build2165635247/b255/importcfg -pack /opt/hostedtoolcache/go/1.25.6/x64/src/text/template/parse/lex.go conf�� go pull.rebase x_amd64/vet(dns block)nonexistent.local/tmp/go-build1641835397/b269/launcher.test /tmp/go-build1641835397/b269/launcher.test -test.testlogfile=/tmp/go-build1641835397/b269/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true -c=4 -nolocalimports -importcfg /tmp/go-build2165635247/b236/importcfg -pack /home/REDACTED/work/gh-aw-mcpg/gh-aw-mcpg/internal/launcher/connection_pool.go /home/REDACTED/work/gh-aw-mcpg/gh-aw-mcpg/internal/launcher/launcher.go conf�� tions.go(dns block)/tmp/go-build4031078163/b001/launcher.test /tmp/go-build4031078163/b001/launcher.test -test.testlogfile=/tmp/go-build4031078163/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true 5635247/b147/_pkg_.a mT2F/qWpgy2xvczcFn_VPmT2F x_amd64/vet(dns block)/tmp/go-build353279575/b001/launcher.test /tmp/go-build353279575/b001/launcher.test -test.testlogfile=/tmp/go-build353279575/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true --version aUjDgKeEG7Mnna9wNv_-/aUjDgKeEG7Mnna9wNv_- x_amd64/vet go1.25.6 -c=4 -nolocalimports x_amd64/vet -o /tmp/go-build1641835397/b280/_pkg_.a -trimpath git -p github.com/githushow -lang=go1.25 bash(dns block)this-host-does-not-exist-12345.com/tmp/go-build1641835397/b278/mcp.test /tmp/go-build1641835397/b278/mcp.test -test.testlogfile=/tmp/go-build1641835397/b278/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true ortcfg 64/src/runtime/cgithub.com/itchyny/gojq .12/x64/as user.name(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.