Repository navigation
Clear custom-linter findings in pkg/cli logs and audit files - #80186
Merged
Merged
Conversation
- Route TSV and continuation summary writes through compactLogsWriter and surface write errors. - Split extractLogMetrics, buildAgentEventsFromProcessedRun, tryLoadCachedRunResult and other functions over the 60-line limit into named helpers; behavior unchanged. - filepath.Walk -> WalkDir; log discarded extractContinuationRequestsFromRun errors and a read-only Close error; avoid string->[]byte copies; slices.Sort; explicit index guards. - runMCPAuditSubprocess logs ExitError code/stderr length, returning the error unchanged.
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Both TSV renderers lack failure-injection tests, leaving write-error propagation, short writes, and stopping after the first error unverified.
1 open issue
What changed in this PR
This PR clears existing custom-linter findings in gh-aw’s logs, audit, and safe-output code, removing gate blockers for follow-up work such as #80174.
Changes:
- Split large functions into focused helpers while preserving report and cache behavior.
- Propagate TSV write errors and log previously discarded errors.
- Replace older traversal and sorting APIs and reduce string-to-byte copies.
| File | Description |
|---|---|
pkg/workflow/safe_outputs_tools.go |
Decode embedded JSON without a string-to-byte copy; reject trailing data. |
pkg/workflow/safe_outputs_config_generation.go |
Use slices.Sort for required fields. |
pkg/cli/mcp_tools_privileged.go |
Decode audit stdout bytes directly and log subprocess exit details. |
pkg/cli/mcp_tools_privileged_test.go |
Adapt tests to byte-based audit error handling. |
pkg/cli/logs_run_cache.go |
Extract artifact checks and healed-cache persistence. |
pkg/cli/logs_run_analysis.go |
Log continuation extraction errors. |
pkg/cli/logs_report.go |
Extract chain metrics and summary aggregation helpers. |
pkg/cli/logs_metrics.go |
Split metrics extraction, use WalkDir, and parse log lines as bytes. |
pkg/cli/logs_format_tsv.go |
Extract row helpers and return write errors. |
pkg/cli/logs_format_tsv_test.go |
Assert successful renderer error returns. |
pkg/cli/drain3_integration.go |
Extract helpers for error, tool-result, and finish events. |
pkg/cli/continuation_requests.go |
Log backfill errors and use the checked TSV writer. |
pkg/cli/continuation_requests_test.go |
Check the TSV renderer’s returned error. |
pkg/cli/audit_run_pipeline.go |
Extract cached-artifact eligibility checks. |
pkg/cli/audit_report.go |
Extract action-minute fallback calculation. |
pkg/cli/audit_report_render.go |
Replace string sorting with slices.Sort. |
pkg/cli/audit_render_output.go |
Extract audit cache loading and construction. |
pkg/cli/audit_expanded.go |
Log file-close failures and use WalkDir. |
Review effort: Balanced (adaptive)
| // Line 2: Column headers | ||
| // Lines 3+: One line per run with tab-separated fields | ||
| func renderLogsTSVToWriter(w io.Writer, data LogsData) { | ||
| func renderLogsTSVToWriter(writer io.Writer, data LogsData) error { |
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.

The agent gate (
scripts/agent-report-progress.sh) runs the custom Go linters and fails on every finding in a changed file, including findings already onmain. Fifteen files inpkg/cliandpkg/workflowcarry 39 such findings, so any PR that touches one of them fails the gate. #80174 hits 38 of them. This PR fixes all 39 onmain, so later PRs only see their own findings. Behavior is unchanged except where noted below.Changes
renderLogsTSVToWriter,renderLogsTSVVerboseToWriterandrenderTSVContinuationRequestSummarywrite through the existingcompactLogsWriterand return the first write error.renderLogsTSVandrenderLogsTSVVerboseprint it the wayrenderLogsCompactalready does. TSV output bytes are unchanged; the existing tests pin them.extractLogMetrics: 209 lines to about 47.buildAgentEventsFromProcessedRun: 97 lines.tryLoadCachedRunResult: 69 lines.buildLogsDataWithCollectionCoverage: 66 lines.renderCachedAuditIfAvailable: 62 lines.newRunData,renderAuditReportandassembleAuditData: 61 lines each.filepath.Walktofilepath.WalkDirinlogs_metrics.go(3 calls) andaudit_expanded.go. None of the callbacks neededFileInfo. Skip and error handling is unchanged.extractContinuationRequestsFromRun. They now log it with the package logger and keep the same control flow. One of them is under a new logger,cli:continuation_requests.readHarnessRoutingOutcomeArtifactlogs a failedCloseon its read-only file.mcp_tools_privileged.gopasses the audit subprocess's stdout bytes straight todecodeAuditReport.extractMCPFailuresFromLogFilesplits the file as bytes.safe_outputs_tools.godecodes the embedded JSON with ajson.Decoderand requiresio.EOFafter the value, so trailing data is still rejected.runMCPAuditSubprocess: when the subprocess exits with an*exec.ExitError, it logs the exit code and the stderr length, then returns the error unchanged. Stderr stays out of the error text:buildAuditErrorResultfalls back toerr.Error()for the MCP message, and stderr carries debug log lines.sort.Stringsis nowslices.Sortin three places.workflowPath[0]and on the skill-name regex group.Validation
gh-aw-linters -largefunc.max-lines=60 ./pkg/cli ./pkg/workflow: no findings left in the changed files. Before this change,mainhad 39 in them.go build ./pkg/cli ./pkg/workflowandgofmt -lon the changed files: clean.BASE_REF=origin/main make agent-report-progress: the custom Go linters, impacted Go tests, schema freshness and sync checks pass. Go lint hit golangci-lint's default timeout after 727s on this loaded host. Replace work-queue protocol v3 with time-free v4 #79748 adds the--timeout 40mthat fixes this. Rerun withgolangci-lint run --timeout 40m ./pkg/cli ./pkg/workflow: 0 issues.go test ./pkg/cliruns (TSV, continuation, logs report, metrics, run cache, audit, drain3, MCP) andgo test ./pkg/workflow -run 'SafeOutputsTools|SafeOutputsConfig'pass.TestMCPCompileTimeoutReturnsSanitizedPartialResultsfails both here and on Route request_continuation to queue successors, approval issues or workflow dispatch #80174's branch. Neither branch changes the files it covers (mcp_tools_readonly.go,mcp_timeout_test.go). It is not related to this change.