Skip to content

post-code: golangci-lint pre-commit fails when repo go.mod exceeds runner Go toolchain #2060

Description

@Omeramsc

What happens

When post-code.sh runs authoritative pre-commit on an enrolled repo whose
go.mod targets a Go version newer than the golangci-lint binary pre-commit
installs on the GHA runner, the golangci-lint hooks fail with exit code 3
before analyzing any code. The workflow exits red and no PR is created.

Reproduced on konflux-ci/segment-bridge via
Code run #116
(2026-06-09):

  1. User triggered the code agent on an enrolled repo (segment-bridge).

  2. Agent completed (Agent completed annotation).

  3. post-code.sh ran authoritative pre-commit on changed files.

  4. golangci-lint-fmt and golangci-lint-full both failed:

    Error: can't load config: the Go language version (go1.25) used to build
    golangci-lint is lower than the targeted Go version (1.26.0)
    

    Hook log also shows:

    golangci-lint has version 2.0.0-20260506110125-c0d3ddc9cf3f+dirty
    built with go1.25.0
    
  5. Post-script blocked with:

    • BLOCKED — pre-commit hooks failed on agent's changes
    • The agent's code does not pass the repo's pre-commit hooks.
  6. Workflow conclusion: failure. No PR opened.

Other pre-commit hooks in the same run passed (markdownlint, go-mod-tidy,
gitleaks). Only golangci-lint hooks failed, and the failure is
infrastructure/version mismatch, not a lint finding in agent code.

What should happen

post-code.sh should be able to run golangci-lint pre-commit hooks against
repos whose go.mod declares the current Go release. At minimum, the
authoritative pre-commit gate should use a golangci-lint build whose Go
toolchain is >= the target repo's go directive.

Repo CI is unaffected: segment-bridge's own workflow uses
actions/setup-go with go-version-file: go.mod and the same pre-commit
hooks pass there. Only the fullsend post-code runner environment is broken.

How to reproduce

  1. Enroll a repo with go 1.26.0 (or newer) in go.mod.
  2. Add golangci-lint hooks to .pre-commit-config.yaml (e.g.
    golangci-lint-fmt, golangci-lint-full from
    https://github.com/golangci/golangci-lint).
  3. Trigger /fs-code on an issue in that repo.
  4. Let the code agent produce commits on a feature branch.
  5. Observe post-code.sh fail at authoritative pre-commit with the
    go1.25 ... lower than ... 1.26.0 error.

Enrolled repo used in repro: konflux-ci/segment-bridge (enabled: true
in konflux-ci/.fullsend config.yaml).

Target repo pre-commit hooks (.pre-commit-config.yaml):
yamllint, shellcheck, gitlint, conventional-pre-commit, actionlint,
markdownlint, go-mod-tidy, golangci-lint-fmt, golangci-lint-full, gitleaks.

Context

This is a runner-side toolchain gap, distinct from the recently fixed sandbox
Go mismatch (#1344,
fixed by
PR #1990). That fix
updated the code agent sandbox image. This failure happens on the GHA
runner during post-code.sh, after the sandbox is destroyed.

As more Konflux repos adopt Go 1.26, any enrolled repo using golangci-lint
pre-commit hooks will hit this block. The agent cannot fix it: the failure is
in the runner's pre-commit environment, not in the code it wrote.

What this is NOT (avoid duplicate closure)

This is not the same issue as:

  • #1997 — UX gap:
    no bot comment on the source issue when post-code pre-commit blocks. Same
    repro family, but this report is the root-cause infrastructure failure
    (golangci-lint Go toolchain mismatch), not missing notification.
  • #1344 /
    #1990 — sandbox Go
    version mismatch. Fixed for the agent sandbox; does not fix post-code
    runner pre-commit.
  • #850 — missing
    binaries (lychee, uvx) on the runner. Here the binary exists but is
    built with an incompatible Go version.
  • #1270 — registry
    coverage for precommit-tools.yaml. golangci-lint uses language: golang
    and is auto-managed by pre-commit; the failure is version skew, not a
    missing registry entry.
  • #1866 — blocking on
    pre-existing hook failures unrelated to agent changes. Here the hook cannot
    run at all due to toolchain mismatch.
  • #1865 — PR created,
    CI failed later. Here pre-commit blocks before any PR.

Acceptance criteria

  • post-code.sh runs golangci-lint pre-commit hooks successfully on a
    repo with go 1.26.0 in go.mod and golangci-lint hooks in
    .pre-commit-config.yaml.
  • A code agent run on konflux-ci/segment-bridge completes post-code
    pre-commit without the go1.25 ... lower than ... 1.26.0 error.
  • No regression for repos still on Go 1.25 or earlier.

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent/codeCode agentcomponent/runnerAgent runner behavior and lifecyclepriority/highSignificant impact, address soonready-to-codeTriaged and ready for the code agenttype/bugConfirmed defect in existing behavior

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    Status
    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions