Skip to content

[log] Add debug logging to 5 CLI files for improved troubleshooting#25393

Merged
pelikhan merged 1 commit intomainfrom
log/enhance-cli-debug-logging-2026-04-08-eafe7cb5ce0185a4
Apr 8, 2026
Merged

[log] Add debug logging to 5 CLI files for improved troubleshooting#25393
pelikhan merged 1 commit intomainfrom
log/enhance-cli-debug-logging-2026-04-08-eafe7cb5ce0185a4

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions bot commented Apr 8, 2026

Add targeted DEBUG=* debug log statements to under-logged functions in the pkg/cli package. These logs emit only when the DEBUG environment variable is set and help developers trace execution during troubleshooting.

Changes

File Functions enhanced Log calls added
pkg/cli/audit.go extractStepOutput, findFirstFailingStep 5
pkg/cli/firewall_policy.go findMatchingRule 4
pkg/cli/deps_security.go querySecurityAdvisories 2
pkg/cli/workflows.go getMarkdownWorkflowFiles, suggestWorkflowNames 4
pkg/cli/mcp_safe_update_cache.go WritePriorManifestFile 2

What's being logged

  • audit.go – Step extraction: entry point with log size, outcome (lines extracted or step not found), and failing step number when detected.
  • firewall_policy.go – Rule matching: host, expected action, which rule matched (or that none matched). Useful for debugging why a domain was allowed or denied.
  • deps_security.go – Security advisory lookup: API URL + dep count at request time, and matched package/severity/advisory ID per hit.
  • workflows.go – Workflow file discovery: directory being scanned and count of files found; fuzzy name suggestions with input and results.
  • mcp_safe_update_cache.go – Manifest cache serialization: entry count at write time and output file path + byte size.

Validation

  • make build passes (no compilation errors)
  • go build ./pkg/cli/... passes
  • No test files modified
  • No side effects in log arguments (only existing values referenced)
  • All logging uses the file's existing logger variable — no new imports required

Test plan

  • Enable debug logging with DEBUG=cli:audit and run gh aw audit <run-id> — verify step extraction logs appear
  • Enable DEBUG=cli:firewall_policy and run firewall policy analysis — verify rule matching decisions are logged
  • Enable DEBUG=cli:deps_security and run gh aw deps security — verify API request and matched advisories are logged
  • Enable DEBUG=cli:workflows and run any workflow command — verify file discovery and suggestion logs appear
  • Enable DEBUG=mcp:server and start MCP server — verify manifest cache write is logged

🤖 Generated with [Claude Code]((claude.com/redacted)

Generated by Go Logger Enhancement · ● 974.9K ·

  • expires on Apr 10, 2026, 9:39 PM UTC

…hooting

Add targeted debug log statements to under-logged functions in the cli package:
- audit.go: log step extraction entry/outcome and failing step detection
- firewall_policy.go: log rule matching decisions per host/entry
- deps_security.go: log advisory API requests and matched dependencies
- workflows.go: log workflow file discovery and name suggestion results
- mcp_safe_update_cache.go: log manifest cache file write operations

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@github-actions github-actions bot added automation enhancement New feature or request labels Apr 8, 2026
@pelikhan pelikhan merged commit 518fec6 into main Apr 8, 2026
@pelikhan pelikhan deleted the log/enhance-cli-debug-logging-2026-04-08-eafe7cb5ce0185a4 branch April 8, 2026 21:42
lpcox added a commit that referenced this pull request Apr 8, 2026
…eScript compatibility (#25406)

* feat: increase logging in copilot driver for silent startup failures (#issue) (#25390)

* feat(logging): add debug logging to 5 CLI files for improved troubleshooting (#25393)

* fix: add parentheses to JSDoc type cast in copilot_driver.cjs for TypeScript compatibility

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/34f7e8b3-df09-41bc-b786-8bb4b22ebb7e

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
lpcox added a commit that referenced this pull request Apr 8, 2026
…25366)

* Initial plan

* Initial plan for CLI proxy: start difc-proxy on host, pass new AWF flags

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/cd08abe8-65f6-4cd4-aca7-a2cfa59d7e81

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

* feat: replace --enable-cli-proxy with --difc-proxy-host, start difc-proxy on host

When features.cli-proxy is enabled, the compiler now:
1. Starts a difc-proxy container on the host before AWF execution
2. Passes --difc-proxy-host host.docker.internal:18443 and
   --difc-proxy-ca-cert /tmp/gh-aw/difc-proxy-tls/ca.crt to AWF
3. Injects GH_TOKEN into the AWF step env with --exclude-env GH_TOKEN
4. Stops the CLI proxy container after AWF execution

Removed deprecated flags: --enable-cli-proxy, --cli-proxy-policy.
Minimum AWF version bumped to v0.26.0 for CLI proxy support.

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/cd08abe8-65f6-4cd4-aca7-a2cfa59d7e81

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

* fix: address code review feedback for CLI proxy

- Handle empty policy gracefully in start_cli_proxy.sh (proxy starts
  without guard filtering when no policy is configured)
- Exit with error when proxy fails to start (prevents AWF from running
  with a non-functional proxy)
- Rename hasCliProxyNeeded to isCliProxyNeeded for naming consistency

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/cd08abe8-65f6-4cd4-aca7-a2cfa59d7e81

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

* fix: address review feedback and recompile agentic workflows

- Bump DefaultFirewallVersion to v0.26.0 to align with AWFCliProxyMinVersion
- Gate addCliProxyGHTokenToEnv on awfSupportsCliProxy and awfSupportsExcludeEnv
  to prevent leaking GH_TOKEN into the agent container on older AWF versions
- Make start_cli_proxy.sh idempotent by removing any leftover container first
- Update changeset to describe current behavior (difc-proxy-host flags)
- Recompile all agentic workflows with updated DefaultFirewallVersion

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/e59645aa-2981-470c-bd44-1075fd88317a

Co-authored-by: Mossaka <5447827+Mossaka@users.noreply.github.com>

* fix: update golden files and lock file for AWF v0.26.0 version bump (#25400)

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/f16055db-4d7a-479e-acae-0713caf5344d

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

* fix: update DefaultFirewallVersion to v0.25.17, fix shell quoting and docstring

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/35642b32-32d1-4a2d-bea7-8041bed78e77

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

* fix: add parentheses to JSDoc type cast in copilot_driver.cjs for TypeScript compatibility (#25406)

* feat: increase logging in copilot driver for silent startup failures (#issue) (#25390)

* feat(logging): add debug logging to 5 CLI files for improved troubleshooting (#25393)

* fix: add parentheses to JSDoc type cast in copilot_driver.cjs for TypeScript compatibility

Agent-Logs-Url: https://github.com/github/gh-aw/sessions/34f7e8b3-df09-41bc-b786-8bb4b22ebb7e

Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: lpcox <15877973+lpcox@users.noreply.github.com>
Co-authored-by: Mossaka <5447827+Mossaka@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Landon Cox <landon.cox@microsoft.com>
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.

1 participant