[q] Fix firewall log parsing to handle workflow-specific directory suffixes #2696
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.
Q Workflow Optimization Report
Investigation Summary
User Question: "/q investigate the issue with firewall logs. Are they uploaded or is it an issue in logs?"
Answer:
Issues Found (from live data)
Firewall Log Analysis
Analyzed Runs: 18874197110, 18874317908, 18874452198
Evidence:
squid-logs-smoke-copilot-firewall/,squid-logs-changeset-generator/run_summary.jsonfiles show"firewall_analysis": nullRoot Cause:
The
analyzeFirewallLogs()function inpkg/cli/firewall_log.go(lines 315-330) was looking for directories named exactly:squid-logsfirewall-logsBut actual artifact directories have workflow-specific suffixes:
squid-logs-{workflow-name}(e.g.,squid-logs-smoke-copilot-firewall)firewall-logs-{workflow-name}This directory name mismatch caused uploaded logs to be ignored during analysis.
Changes Made
pkg/cli/firewall_log.go
Lines modified: 316-343
Changes:
os.ReadDir()to scan all directoriesstrings.HasPrefix()Before:
After:
pkg/cli/firewall_log_test.go
Added:
TestAnalyzeFirewallLogsWithWorkflowSuffix()(60 lines)Purpose: Validates that firewall log parsing works with workflow-specific directory suffixes
Test coverage:
squid-logs-smoke-copilot-firewall/access.logwith 3 requests (2 allowed, 1 denied)analyzeFirewallLogs()finds and parses the logs correctlyExpected Improvements
After this fix:
run_summary.jsonwill include firewall analysis datagh aw logscommand will display firewall statistics in outputgh aw auditcommand will include firewall analysis in reportsValidation
Unit Test Added:
TestAnalyzeFirewallLogsWithWorkflowSuffix()- Tests realistic workflow artifact structureManual Validation:
squid-logs-{workflow-name}patternReferences
/tmp/gh-aw/cache-memory/q-firewall-investigation.md/tmp/gh-aw/aw-mcp/logs/run-18874197110/squid-logs-smoke-copilot-firewall/FIREWALL_LOG_PARSER_IMPLEMENTATION.md