Add --filtered-integrity flag to logs command#21838
Merged
Conversation
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
pelikhan
March 19, 2026 18:14
View session
Contributor
|
@copilot refactor DownloadWorkflowLogs to take an options type rather than a gazillion parameters |
Copilot stopped work on behalf of
pelikhan due to an error
March 19, 2026 18:25
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new gh aw logs --filtered-integrity flag to filter workflow runs to those that contain DIFC-filtered items in MCP gateway logs, wiring the flag from the CLI command into the logs download orchestrator and extending tests/call sites accordingly.
Changes:
- Register and plumb a new
--filtered-integrityboolean flag throughlogs→DownloadWorkflowLogs. - Add DIFC filtered-item gating in the orchestrator via a new
runHasDifcFilteredItemshelper (uses gateway log parsing with rpc-messages fallback). - Update/extend unit tests and fix
DownloadWorkflowLogscall sites to pass the new parameter.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/cli/logs_command.go | Adds the --filtered-integrity flag, reads it, passes it to the orchestrator, and updates examples/help text. |
| pkg/cli/logs_orchestrator.go | Extends DownloadWorkflowLogs signature, adds DIFC-based run filtering, and introduces runHasDifcFilteredItems. |
| pkg/cli/logs_filtering_test.go | Extends flag-presence assertions and adds tests for the new helper/flag registration. |
| pkg/cli/logs_json_stderr_order_test.go | Updates orchestrator call sites to include the new parameter. |
| pkg/cli/logs_download_test.go | Updates orchestrator call sites to include the new parameter. |
| pkg/cli/logs_ci_scenario_test.go | Updates orchestrator call sites to include the new parameter. |
| pkg/cli/context_cancellation_test.go | Updates orchestrator call sites to include the new parameter. |
Comments suppressed due to low confidence (1)
pkg/cli/logs_orchestrator.go:906
- The
--filtered-integrityflag text implies integrity-only filtering, butrunHasDifcFilteredItemsreturnsgatewayMetrics.TotalFiltered > 0, which counts allDIFC_FILTEREDevents (integrity and secrecy). Either (a) filter specifically onFilteredEvents[i].Reason == "integrity", or (b) rename/update the flag + help text to reflect that it matches any DIFC-filtered event.
if gatewayMetrics == nil {
return false, nil
}
return gatewayMetrics.TotalFiltered > 0, nil
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+898
to
+899
| // No gateway log file present — not an error for workflows without MCP | ||
| return false, nil |
| logsCmd.Flags().Bool("firewall", false, "Filter to only runs with firewall enabled") | ||
| logsCmd.Flags().Bool("no-firewall", false, "Filter to only runs without firewall enabled") | ||
| logsCmd.Flags().String("safe-output", "", "Filter to runs containing a specific safe output type (e.g., create-issue, missing-tool, missing-data)") | ||
| logsCmd.Flags().Bool("filtered-integrity", false, "Filter to runs with DIFC integrity-filtered items in the gateway logs") |
Comment on lines
+450
to
+476
| const gatewayWithDifc = `{"timestamp":"2025-01-01T00:00:00Z","type":"DIFC_FILTERED","server_id":"github","tool_name":"create_issue","reason":"integrity"}` + "\n" | ||
| const gatewayWithoutDifc = `{"timestamp":"2025-01-01T00:00:00Z","event":"tool_call","server_name":"github","tool_name":"list_issues","duration":10}` + "\n" | ||
|
|
||
| tests := []struct { | ||
| name string | ||
| fileContent string | ||
| filePath func(dir string) string | ||
| want bool | ||
| }{ | ||
| { | ||
| name: "gateway.jsonl with DIFC_FILTERED event", | ||
| fileContent: gatewayWithDifc, | ||
| filePath: func(dir string) string { return filepath.Join(dir, "gateway.jsonl") }, | ||
| want: true, | ||
| }, | ||
| { | ||
| name: "gateway.jsonl without DIFC_FILTERED events", | ||
| fileContent: gatewayWithoutDifc, | ||
| filePath: func(dir string) string { return filepath.Join(dir, "gateway.jsonl") }, | ||
| want: false, | ||
| }, | ||
| { | ||
| name: "mcp-logs/gateway.jsonl with DIFC_FILTERED event", | ||
| fileContent: gatewayWithDifc, | ||
| filePath: func(dir string) string { return filepath.Join(dir, "mcp-logs", "gateway.jsonl") }, | ||
| want: true, | ||
| }, |
This was referenced Mar 19, 2026
github-actions bot
added a commit
that referenced
this pull request
Mar 20, 2026
- cli.md: add missing logs flags (--filtered-integrity, --firewall, --no-firewall, --safe-output, --after-run-id, --before-run-id, --no-staged, --tool-graph, --timeout) per #21838 and issue #21808 - custom-safe-outputs.md: document safe-outputs.actions feature (#21752) - safe-outputs.md: add actions: entry to Available Safe Output Types Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
Adds support in the
logscommand to filter sessions that have DIFC-filtered items in the gateway logs, via the new--filtered-integrityflag.Changes
pkg/cli/logs_command.go: Register the--filtered-integritybool flag, read its value, pass it to the orchestrator, and add a usage example.pkg/cli/logs_orchestrator.go:filteredIntegrity boolparameter toDownloadWorkflowLogs.--filtered-integrityis set, callrunHasDifcFilteredItemsand skip runs with no DIFC-filtered events. Errors from the check produce an unconditional warning (not silently skipped).runHasDifcFilteredItemshelper that callsparseGatewayLogs(with automatic fallback torpc-messages.jsonl) and returnstruewhenTotalFiltered > 0.pkg/cli/logs_filtering_test.go:filtered-integrityto the flag-presence test.TestRunHasDifcFilteredItems(table-driven, coversgateway.jsonl,mcp-logs/gateway.jsonl, no-file, and no-DIFC cases).TestFilteredIntegrityFlagto assert default value and usage text.DownloadWorkflowLogscall sites in test files to include the new parameter.Usage