Skip to content

fix: propagate cancellation to Actions log downloads - #3706

Open
flysheep-ai wants to merge 1 commit into
github:mainfrom
flysheep-ai:codex/fix-log-download-cancellation
Open

flysheep-ai wants to merge 1 commit into
github:mainfrom
flysheep-ai:codex/fix-log-download-cancellation

Conversation

@flysheep-ai

Copy link
Copy Markdown

Summary

Use the request context when downloading Actions job logs, so canceled tool calls stop waiting for the download. Keep the existing default HTTP client and log-tail processing.

Why

Fixes #3705
downloadLogContent receives the tool context but uses http.Get, which creates an independent request. Canceling get_job_logs therefore does not stop a download that is waiting for response headers or receiving a streaming response.

What changed

  • Create the log GET request with http.NewRequestWithContext and execute it through the same http.DefaultClient.
  • Add local HTTP regressions for cancellation before a request, while waiting for headers, and after the server has flushed headers and partial log data. Preserve a successful uncanceled tail-output control.

MCP impact

  • No tool or API changes
  • Tool schema or behavior changed — get_job_logs downloads now honor cancellation; names, input/output schemas and successful log content are unchanged.
  • New tool added

Prompts tested (tool changes only)

Use case: “Get the last two log lines for an Actions job,” then cancel while the download is pending. Automated tests exercise the real download path against local HTTP servers and existing mocked Actions tool tests. No model-selected prompt or live GitHub API call was tested.

Security / limits

  • No security or limits impact — existing URL handling, HTTP client, permissions and content limits are retained; only cancellation propagation changes.
  • Auth / permissions considered
  • Data exposure, filtering, or token/size limits considered

Tool renaming

  • I am renaming tools as part of this PR (e.g. a part of a consolidation effort)
    • I have added the new tool aliases in deprecated_tool_aliases.go
  • I am not renaming tools as part of this PR — existing tool names are retained.

Lint & tests

  • Linted locally with ./script/lint — pinned golangci-lint2.14.0, 0 issues.
  • Tested locally with ./script/test — all 30 test-bearing packages pass with the race detector.

The three cancellation cases fail on the original code. All four new cancellation/success cases and adjacent Actions tests pass 20 repetitions with the race detector. go test -v ./..., UPDATE_TOOLSNAPS=true go test ./... and documentation generation pass with no snapshot/generated-document changes.

UI typecheck/build evidence is reused from the identical base and unchanged UI sources; actual generated assets are used. Its npm audit reported four dependency findings (two low, two high) in unchanged dependencies. No dependencies were upgraded.

Docs

  • Not needed — no schema or usage changes; script/generate-docs produces no diff.
  • Updated (README / docs / examples)

OpenAI Codex assisted with implementation, tests and independent review.

@flysheep-ai
flysheep-ai requested a review from a team as a code owner November 6, 2026 06:47
Copilot AI adaptive review requested due to automatic review settings November 6, 2026 06:47

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.

🟢 Approval recommended

The review records no active issues for the narrowly scoped change to cancel pending or streaming Actions log downloads.

No open issues 🎉

What changed in this PR

Updates Actions job-log downloads to honor request cancellation, stopping pending or streaming downloads while preserving the default HTTP client and existing log-tail behavior.

Changes:

  • Binds log-download requests to the caller’s context.
  • Adds cancellation tests for pre-request, header-waiting, and streaming scenarios.
  • Preserves successful tail output and line-count behavior.
File Description
pkg/​github/​actions.go Applies the caller’s context to Actions log-download requests.
pkg/​github/​actions_log_cancellation_test.go Verifies cancellation behavior and preserves successful log-tail processing.

Review effort: Lite (auto)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Actions log downloads ignore tool cancellation

2 participants