Skip to content

Raise golangci-lint timeout to 10 minutes - #7084

Merged
rdimitrov merged 2 commits into
mainfrom
raise-lint-timeout
Nov 9, 2026
Merged

rdimitrov merged 2 commits into
mainfrom
raise-lint-timeout

Conversation

@jhrozek

@jhrozek jhrozek commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Summary

  • The Go lint job now fails on clean code. In the last runs, golangci-lint printed 0 issues. and then exited with Timeout exceeded, because it passed the --timeout=5m limit. That blocks every open PR, including Bump spf13/pflag to v1.1.0 #7083 and Update go modules #7077, even though no lint finding is involved.
  • Earlier green runs of the same job on main took 1 to 6 minutes, so the 5-minute limit leaves almost no room when the runner is slow.
  • This raises the limit to 10m and corrects the job comment, which said lint runs in well under a minute.

Type of change

  • Bug fix
  • New feature
  • Refactoring (no behavior change)
  • Dependency update
  • Documentation
  • Other (describe): CI configuration

Test plan

  • Unit tests (task test)
  • E2E tests (task test-e2e)
  • Linting (task lint-fix)
  • Manual testing (describe below)

I did not run lint locally. CI on this PR's Linting / Lint Go Code job is the check. A passing run shows the new limit is enough for the current runner speed, not that the runner won't slow down again.

Does this introduce a user-facing change?

No

Special notes for reviewers

  • This only changes the lint job's time limit. It doesn't change which linters run, their config, or any code.
  • If runs keep approaching 10 minutes, the next step is to find what is slow, not to raise the limit again.

The Go lint job has been failing on clean code with "Timeout exceeded"
at the 5m limit. golangci-lint reports "0 issues" and then exits with
code 4 once the run passes the limit. Runner speed varies between runs
(earlier green runs took 1 to 6 minutes), so 5m leaves no headroom.

Raise the limit to 10m and correct the job comment, which said lint
runs in well under a minute.

Co-authored-by: Mecatl <[email protected]>
@jhrozek
jhrozek requested a review from JAORMX as a code owner November 9, 2026 08:59
@github-actions github-actions Bot added the size/XS Extra small PR: < 100 lines changed label Nov 9, 2026

@rdimitrov rdimitrov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The 10m timeout is a fine stopgap, but the comment names the wrong cause, and the mechanism that keeps lint slow is still in place.

Design: CI is the right place for this. .golangci.yml sets no run.timeout, and the local task lint/task lint-fix don't pass one, so nothing else needs to stay in sync, and the change doesn't affect users. The slowness, though, is cold caches, not runner speed. Green runs take about 100–180s with warm Go-build and golangci-lint caches and about 250–340s when the caches are cold. A larger timeout hides that; it doesn't fix it.

  1. .github/workflows/lint.yml:42-49 (Go build cache step). actions/cache saves only in its post-job step, which is skipped when the job fails or is cancelled. Main run 42586214531 timed out and its "Post Cache Go build cache" step was skipped. As a result, there is no Linux-go-build-lint-* entry on refs/heads/main. Every PR starts cold (run 42585791799 missed all three keys and timed out) and saves its own entry, scoped to its PR ref. This PR's entry is 1449 MB. About seven open PRs fill the 10 GB repo cache budget (currently at 9.77 GB), and eviction then also removes the test job's build caches. Suggested fix: split the step into actions/cache/restore and actions/cache/save, with if: always() && github.ref == 'refs/heads/main' on the save. Main then always writes the cache, even when it fails or is cancelled, and PRs restore it instead of each writing 1.4 GB.
  2. .github/workflows/lint.yml:12-15: the new comment blames runner speed variance. Please reword it to name cold Go-build and golangci-lint caches, and the 10 GB cache budget, so whoever looks at this next starts in the right place.
  3. Outside the diff: the timed-out run saved golangci-lint.cache-Linux-2966-d5b434a07d472d9fae9865d50c0a63c23c1a3b49 at only 4.6 MB. golangci-lint-action doesn't save when the primary key already exists (this PR's run logged "Cache hit occurred on the primary key ..., not saving cache"), so this nearly empty entry can stay for up to 7 days (cache-invalidation-interval: 7). This PR's run took 251s even with a warm build cache. After merge, delete it so the next green main run can save a full cache:
    gh cache delete golangci-lint.cache-Linux-2966-d5b434a07d472d9fae9865d50c0a63c23c1a3b49 -R stacklok/toolhive
  4. No Test plan box is checked. Ticking Manual testing and linking the green Lint Go Code run on this PR would cover it.

Merging this as-is is fine. Item 1 is the follow-up that actually brings lint time back down.

🤖 Reviewed with Claude Code

The comment blamed runner speed variance for slow lint runs. The slow
runs are cold Go-build and golangci-lint caches: the build cache is
saved in a post-job step that is skipped when a job fails, so main
rarely has a warm cache. Name that cause and the 10 GB repo cache
budget, so the next person looking at this starts in the right place.

Co-authored-by: Mecatl <[email protected]>
@github-actions github-actions Bot added size/XS Extra small PR: < 100 lines changed and removed size/XS Extra small PR: < 100 lines changed labels Nov 9, 2026
@jhrozek

jhrozek commented Nov 9, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the detailed review on the lint timeout. I've reworded the job comment to name the cold Go-build cache and the 10 GB repo budget. The lint job is green on the current head now. Would you be able to take another look and approve? I'll follow up with the cache-split change as its own PR.

@codecov

codecov Bot commented Nov 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.83%. Comparing base (1df76a3) to head (51b4b96).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7084      +/-   ##
==========================================
- Coverage   80.84%   80.83%   -0.01%     
==========================================
  Files         864      864              
  Lines       88639    88639              
==========================================
- Hits        71663    71655       -8     
- Misses      16971    16979       +8     
  Partials        5        5              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@rdimitrov
rdimitrov merged commit 394a9fd into main Nov 9, 2026
44 checks passed
@rdimitrov
rdimitrov deleted the raise-lint-timeout branch November 9, 2026 10:08
@github-actions github-actions Bot mentioned this pull request Nov 10, 2026
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/XS Extra small PR: < 100 lines changed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants