Skip to content

Return partial MCP logs results before gateway timeout - #52412

Open
pelikhan with Copilot wants to merge 11 commits into
mainfrom
copilot/deep-report-fix-timeout-issue
Open

Return partial MCP logs results before gateway timeout#52412
pelikhan with Copilot wants to merge 11 commits into
mainfrom
copilot/deep-report-fix-timeout-issue

Conversation

Copilot AI commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

The agenticworkflows logs MCP tool could exceed the gateway’s ~60s request deadline on larger filtered queries such as count + start_date, causing the call to fail instead of returning collected data with a continuation cursor.

  • Gateway-aware soft timeout

    • Detects when the MCP request deadline is shorter than the logs subprocess timeout.
    • Passes a shorter internal cutoff to gh aw logs so it can stop cleanly before the gateway closes the request.
  • Second-level logs timeout

    • Adds hidden --timeout-seconds support for MCP-internal use.
    • Keeps the public minute-based --timeout behavior unchanged.
  • Timeout propagation

    • Stores the resolved timeout duration in the logs runtime.
    • Uses the resolved duration consistently for context deadlines and graceful timeout checks.
gh aw logs -c 100 --start-date 2026-08-05 --timeout 5 --timeout-seconds 55 --json

This lets MCP calls return partial JSON plus continuation data instead of failing with context deadline exceeded.


Generated by 👨‍🍳 PR Sous Chef · gpt54 · 12.7 AIC · ⌖ 6.5 AIC · ⊞ 8.5K ·
Comment /souschef to run again

Copilot AI and others added 8 commits August 13, 2026 04:09
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix logs MCP tool timeout on larger queries Return partial MCP logs results before gateway timeout Aug 13, 2026
Copilot AI requested a review from pelikhan August 13, 2026 04:25
@github-actions

Copy link
Copy Markdown
Contributor

PR Triage

Category: bug | Risk: medium | Priority: medium | Score: 48/100

Score breakdown: impact 25/50, urgency 15/30, quality 8/20

CI: unknown (draft)

Recommended action: defer

Useful fix but still draft, no reviews yet, CI unstable.

Automated triage — run 52412

Generated by 🔧 PR Triage Agent · auto · 67.2 AIC · ⌖ 2.77 AIC · ⊞ 7.8K ·

@github-actions

Copy link
Copy Markdown
Contributor

PR Triage

Category: bug · Risk: medium · Priority: medium
Score: 57/100 (impact 30, urgency 15, quality 12)
Recommended action: defer

Reliability fix for partial MCP logs results before gateway timeout. CI status unavailable; moderate size — deferred pending status confirmation.

Generated by 🔧 PR Triage Agent · auto · 61.7 AIC · ⌖ 2.63 AIC · ⊞ 7.8K ·

@pelikhan
pelikhan marked this pull request as ready for review August 13, 2026 17:41
Copilot AI balanced review requested due to automatic review settings August 13, 2026 17:41
@pelikhan

Copy link
Copy Markdown
Collaborator

@copilot must indicate that results are partial in response

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds gateway-aware soft timeouts so MCP log requests return partial results before gateway deadlines expire.

Changes:

  • Derives a second-level cutoff from the MCP request deadline.
  • Propagates the resolved timeout through log orchestration.
  • Adds focused timeout-resolution tests.
Show a summary per file
File Description
pkg/cli/mcp_tools_privileged.go Computes and forwards the gateway-aware soft timeout.
pkg/cli/logs_timeout_test.go Tests MCP soft-timeout calculation.
pkg/cli/logs_orchestrator_unit_test.go Tests second-based context deadlines.
pkg/cli/logs_orchestrator_types.go Adds second-level timeout configuration.
pkg/cli/logs_orchestrator_download.go Applies and tracks the resolved timeout duration.
pkg/cli/logs_command.go Adds the hidden internal timeout flag.

Review details

💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 6/6 changed files
  • Comments generated: 0
  • Review effort level: Balanced

@gh-aw-bot

Copy link
Copy Markdown
Collaborator

@copilot Triage nudge from sous-chef. Please inspect the latest branch state, address any remaining review feedback, refresh the branch, and run the pr-finisher skill before handing this PR back to maintainers.

No failed checks were included in the compact candidate set.
Branch update was requested by sous-chef for run https://github.com/github/gh-aw/actions/runs/31727087804.

Generated by 👨‍🍳 PR Sous Chef · gpt54 · 12.7 AIC · ⌖ 6.5 AIC · ⊞ 8.5K ·
Comment /souschef to run again

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>

Copilot AI commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

@copilot must indicate that results are partial in response

The logs MCP response now signals incompleteness explicitly: when the download stops early (soft timeout or count limit), the response sets "partial": true, echoes the continuation cursor inline, and the message begins with PARTIAL RESULTS: .... So callers can detect partial data without reading the cached file. Tool description and MCP server docs updated too.

Copilot AI commented Aug 13, 2026

Copy link
Copy Markdown
Contributor Author

@copilot Triage nudge from sous-chef. Please inspect the latest branch state, address any remaining review feedback, refresh the branch, and run the pr-finisher skill before handing this PR back to ...

Ran the pr-finisher pass on the latest branch state (19b0e1c):

  • Reviews — no unresolved review threads. The only substantive feedback (@pelikhan: "must indicate that results are partial in response") was addressed in 19b0e1c: the logs MCP response now sets "partial": true, echoes the continuation cursor inline, and prefixes the message with PARTIAL RESULTS: ....
  • Checks (local)make fmt (no diff), make lint (0 errors), make test-unit (pass), make recompile (all 285 lock files in sync, no diff).
  • Checks (CI) — no failed runs on this branch; all pending runs are action_required (awaiting maintainer approval), so CI on this HEAD is unverified until a maintainer approves/re-triggers.
  • Mergeable — branch is up to date with origin/main (no rebase/merge needed), not draft, no conflicts. mergeable_state: blocked reflects pending required checks/approval only.

Actions taken: verification pass only — no new file changes were required, so nothing new was pushed.
Hand-off: a maintainer needs to approve/re-trigger the pending workflow runs before merge.
Still needed: human review approval.

@github-actions

Copy link
Copy Markdown
Contributor

🔍 PR Triage

Category: bug · Risk: medium · Priority score: 58/100 (impact 25, urgency 18, quality 15)
Recommended action: fast_track

Score breakdown:

  • Impact: Fixes MCP logs tool failing (rather than returning partial results) on gateway timeout — affects tool reliability.
  • Urgency: Active failure mode for larger queries; worth fast-tracking.
  • Quality: AI reviewer commented; CI data sparse (only 1 check reported) — verify full CI status before merge.

Generated by 🔧 PR Triage Agent · auto · 71.4 AIC · ⌖ 2.63 AIC · ⊞ 7.8K ·

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[deep-report] agenticworkflows logs MCP tool times out on larger queries — recurrence of auto-expired #51952

4 participants