logs: fix truncated daily audits — raise MCP gateway timeout and add count-limit pagination#43197
Conversation
|
Hey This PR is still in its initializer state — 0 lines changed and the description is the boilerplate opener. Before it's ready for review, here's what to add once the implementation lands:
If you'd like a prompt to guide the implementation:
|
…tion continuation Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
… date format Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This pull request addresses truncated daily audit log collection by (1) increasing the MCP gateway tool timeout in the affected daily workflow definitions and (2) adding count-limit pagination continuation to DownloadWorkflowLogs so agents can page through date windows when --count is reached.
Changes:
- Raised MCP gateway proxy deadline to 10 minutes via
engine.mcp.tool-timeout: 10min the three daily audit workflows and recompiled their.lock.ymlfiles (now emitting"toolTimeout": 600). - Added
countLimitReachedtracking to emitContinuationDatawhen date-range fetching hits thecountcap (not just when timeouts occur). - Added a JSON round-trip test for count-limit continuation serialization.
Show a summary per file
| File | Description |
|---|---|
| pkg/cli/logs_orchestrator.go | Emit continuation data when a date-range fetch hits the count cap. |
| pkg/cli/logs_json_test.go | Add test coverage for count-limit continuation JSON serialization. |
| .github/workflows/api-consumption-report.md | Switch to engine object form and set MCP tool timeout to 10m. |
| .github/workflows/api-consumption-report.lock.yml | Recompiled lock with MCP gateway toolTimeout: 600. |
| .github/workflows/audit-workflows.md | Switch to engine object form and set MCP tool timeout to 10m. |
| .github/workflows/audit-workflows.lock.yml | Recompiled lock with MCP gateway toolTimeout: 600. |
| .github/workflows/detection-analysis-report.md | Switch to engine object form and set MCP tool timeout to 10m. |
| .github/workflows/detection-analysis-report.lock.yml | Recompiled lock with MCP gateway toolTimeout: 600. |
Review details
Tip
Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Files reviewed: 8/8 changed files
- Comments generated: 3
- Review effort level: Low
| @@ -251,6 +251,11 @@ func DownloadWorkflowLogs(ctx context.Context, opts LogsDownloadOptions) error { | |||
| // When no date filters, we fetch up to 'count' runs with artifacts (old behavior for backward compatibility) | |||
| fetchAllInRange := startDate != "" || endDate != "" | |||
|
|
|||
| // countLimitReached is set when the loop exits because len(processedRuns) >= count in | |||
| // Build continuation data if timeout was reached and there are processed runs, | ||
| // OR if a date-range fetch hit the count limit (more runs may exist in the window). | ||
| var continuation *ContinuationData | ||
| if timeoutReached && len(processedRuns) > 0 { | ||
| // Get the oldest run ID from processed runs to use as before_run_id for continuation | ||
| if len(processedRuns) > 0 && (timeoutReached || countLimitReached) { | ||
| // Use the oldest processed run as the before_run_id cursor for the next page. |
| // Simulate what DownloadWorkflowLogs emits when fetchAllInRange is true and the | ||
| // count limit is reached before all runs in the date window are fetched. | ||
| // "-1d" is a relative date shorthand accepted by the --start-date flag. | ||
| continuation := &ContinuationData{ | ||
| Message: "Count limit reached. Use these parameters to continue fetching more logs from the same date range.", | ||
| StartDate: "-1d", | ||
| Count: 100, | ||
| BeforeRunID: 19999, // oldest processed run | ||
| Timeout: 3, | ||
| } |
|
@copilot please run the
|
…te in test Co-authored-by: gh-aw-bot <259018956+gh-aw-bot@users.noreply.github.com>
Done — addressed all three reviewer threads in commit
Local |
|
@copilot please run the
|
All three reviewer threads are already addressed in commit
Local |
PR Triage
Breakdown: Raises MCP gateway timeout to 10 min and adds count-limit pagination for daily audit workflows. Directly fixes audit coverage dropping from 175 to 84 runs. 195 add/35 del across audit workflow files. Well-described PR. Next: Human review of workflow timeout changes and pagination cursor logic.
|
|
🎉 This pull request is included in a new release. Release: |
Daily audit workflows (
api-consumption-report,detection-analysis-report,audit-workflows) collected only ~84 of ~175 daily runs because the MCP gateway killed thelogs()tool call at 60 s, and count-limit exits were silent with no continuation cursor.MCP gateway timeout
Changed
engine: claude(string form, inherits 60 s default) to the object form withengine.mcp.tool-timeout: 10min all three workflows, raising the gateway proxy deadline to the 600 s maximum. Recompiled.lock.ymlfiles; each now contains"toolTimeout": 600.Count-limit pagination continuation (
logs_orchestrator.go)Even with a longer timeout,
count=100would silently drop runs 101–175 — the continuation cursor was only emitted on timeout, not on count-limit. AddedcountLimitReachedtracking inDownloadWorkflowLogs: whenfetchAllInRangeis true and the count cap is hit, aContinuationDatais emitted withBeforeRunIDpointing to the oldest fetched run, allowing the agent to page through the full date window.Added
TestBuildLogsDataWithCountLimitContinuationcovering the new pagination path with round-trip JSON serialisation verification.