Skip to content

[deep-report] Make checkAndWaitForRateLimit context-cancellable (~60min uncancellable sleep) #43812

Description

@github-actions

Description

The Repository Quality Report (discussion #43796) found checkAndWaitForRateLimit in pkg/cli/logs_rate_limit.go uses 4 bare time.Sleep calls and can block for up to ~60 minutes waiting for a GitHub API rate-limit reset — uncancellable by Ctrl-C. Its only caller DownloadWorkflowLogs(ctx) already holds a context. The existing timesleepnocontext linter misses it because the function omits the ctx parameter entirely.

What to do

Add ctx context.Context as the first parameter to checkAndWaitForRateLimit (and fetchRateLimit if needed). Replace each time.Sleep(d) with:

timer := time.NewTimer(d)
select { case <-timer.C: case <-ctx.Done(): timer.Stop(); return ctx.Err() }

Update the call site at pkg/cli/logs_orchestrator.go:370 to pass activeCtx. Verify with make agent-report-progress.

Expected Impact

Makes the longest uncancellable blocking path in the CLI respond to cancellation; improves interactive UX and clean shutdown.

Suggested Agent

Copilot SWE Agent (well-scoped Go change with acceptance criteria).

Estimated Effort

Medium (1-4 hours)

Data Source

DeepReport Intelligence Briefing 2026-07-06; source discussion #43796 (Repository Quality Report), Task 1.

Generated by 🔬 Deep Report · 204.6 AIC · ⌖ 17.5 AIC · ⊞ 10.2K ·

  • expires on Jul 8, 2026, 8:03 AM UTC-08:00

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions