Skip to content

fix(ci): Analyze (go) fails on every PR head with a CodeQL configuration error, blocking ~39 PRsΒ #2746

Closed

Description

@devantler

πŸ€– Generated by the Daily AI Engineer

Evidence

Analyze (go) fails on every open PR head in this repo with a CodeQL configuration error β€” not a code fault:

Encountered a fatal error while running "codeql database finalize ..." Exit code was 32
and last log line was: CodeQL could not process any code written in Go.
CodeQL job status was configuration error.

Sample: run 29659533468 (PR #2699).

The decisive detail is that two code-scanning runs fire per PR, and they disagree about the same language on the same commit:

Run (PR #2745, same head) Jobs Result
29660162421 Analyze (actions), Analyze (go), Analyze (python) all success
29660162194 Analyze (go), Analyze (python) go failure

On main both runs succeed (29660192906), which is why main reads green and the breakage is only visible on PRs.

Supporting facts, gathered read-only:

  • Code scanning is default setup (event: dynamic; no CodeQL workflow file in .github/workflows), currently state: configured with languages: ["actions","go","python"], last changed 2026-07-14T08:05:56Z.
  • The repo's only Go code is 4 files under scripts/generate-kubescape-exceptions/ and scripts/validate-merge-group-heal/, with go.mod at the repository root β€” consistent with one configuration not seeing those paths and therefore extracting zero Go.
  • python is still configured as an analysed language even though the portfolio is constitutionally Python-free (scripting is bash or Go), and Migrate remaining Python tooling and tests to GoΒ #2623 tracks removing the remaining Python tooling.

I have not established why two configurations coexist, or which one is authoritative β€” that is the first thing to determine, and I did not mutate any settings to find out.

Impact

~39 open PRs sit at mergeStateStatus: BLOCKED with this as their failing check (#2699, #2702–#2745 and neighbours). Because the failure is a configuration error rather than a finding, no amount of work on those branches clears it β€” every one of them is unmergeable until the configuration is fixed. main staying green masks it from any check that only watches the default branch.

Secondary: a language analysis that always errors trains readers to ignore a security check, which is the worst possible check to make routine noise.

Expected behaviour

Analyze (go) succeeds on PR heads exactly as it does on main, from a single authoritative code-scanning configuration, and the configured language set matches the languages the repo actually contains.

Acceptance criteria

  1. Root cause of the duplicate/conflicting code-scanning configuration is identified and recorded on this issue.
  2. Exactly one authoritative configuration analyses this repo; the redundant one is removed.
  3. Analyze (go) passes on a PR head β€” verified on a real open PR, not inferred from main.
  4. The analysed language set reflects the repo's actual contents (drop python unless Migrate remaining Python tooling and tests to GoΒ #2623 shows it is still needed).
  5. Whatever the fix is, it lands in the declarative GitHub configuration in devantler-tech/.github where repo config is managed, rather than as an undocumented click in repo settings.

Size

Small–medium. The diagnosis is likely most of the work; the change itself should be a configuration edit. Note that default setup is settings-driven, so part of the fix may need a maintainer-applied settings change if it cannot be expressed declaratively β€” worth confirming as part of AC 5.

Part of #2043.

Activity

  1. added theissue type on Jul 18, 2026
  2. coderabbitai commented on Jul 18, 2026

    @coderabbitai
    Contributor
    πŸ”— Related PRs

    #2317 - ci: migrate deploy-prod Flux diagnostics to shared diagnose-flux composite [merged]
    #2330 - ci: heal prod when a merge-group deploy fails (restore main) [merged]
    #2339 - docs(agents): record merge-queue mechanics + root-cause-before-requeue [merged]
    #2404 - fix: tenant artifact verification rejects the dual signing identities from #2399 [merged]
    #2622 - fix(ci): heal cancelled merge-group deploys [merged]


    πŸ“ Issue Planner

    Check the box below or use the @coderabbitai plan command to generate an implementation plan and prompts that you can use with your favorite coding assistant.

    • Create Plan

    πŸ§ͺ Issue enrichment is currently in open beta.

    You can configure auto-planning by selecting labels in the issue_enrichment configuration.

    To disable automatic issue enrichment, add the following to your .coderabbit.yaml:

    issue_enrichment:
      auto_enrich:
        enabled: false

    πŸ’¬ Have feedback or questions? Drop into our discord!

  3. moved this to πŸ“₯ Backlog in 🌊 Project Boardon Jul 18, 2026
  4. devantler commented on Jul 18, 2026

    @devantler
    ContributorAuthor

    πŸ€– Generated by the Daily AI Engineer

    Correction to my own framing above β€” narrowing the root cause.

    The body presents "two code-scanning runs fire per PR" as the decisive detail. That part is not the defect: ksail shows the identical double-run pattern on its PR heads (e.g. two concurrent runs on refs/pull/6262/head) and both succeed. So a pair of default-setup runs per PR is normal org-wide behaviour, not platform-specific misconfiguration.

    What survives, and is the actual defect:

    • One of the two Analyze (go) runs fails to extract any Go on platform PR heads (configuration error, exit 32), while the other analyses the same commit's Go successfully.
    • The same pairing succeeds on main.

    So the question for AC 1 is not "why are there two runs" but "why does one run of the pair see zero Go on a PR head when its twin sees the code and main sees it too?" The leading hypothesis remains path/checkout scope β€” the only Go lives under scripts/ with go.mod at the repo root β€” but I have not confirmed it and did not mutate settings to test.

    Also confirmed while checking: code scanning is not currently expressed in the declarative config in devantler-tech/.github (deploy/repositories/platform.yaml and neighbours carry no code-scanning stanza), so AC 5 likely means adding that expression rather than editing an existing one β€” and the fix may need a maintainer-applied settings change if default setup cannot be driven declaratively.

  5. self-assigned this
    on Jul 18, 2026
  6. devantler commented on Jul 19, 2026

    @devantler
    ContributorAuthor

    πŸ€– Generated by the Daily AI Engineer

    AC 1 β€” root cause established. It is not a duplicate configuration, and there is nothing to remove. Both earlier framings on this issue (mine included) were wrong; correcting them here so nobody deletes a legitimate config.

    The two runs are two analysis kinds, both legitimate

    I decoded the CODE_SCANNING_WORKFLOW_FILE payload embedded in each run. They differ in exactly one meaningful line:

    Run analysis-kinds Languages Go result
    PR #2745 code-scanning actions, go, python success
    Code Quality: PR #2745 code-quality go, python failure

    So the pair is GitHub default setup running its security analysis and its separate Code Quality analysis. Neither is redundant and neither is a stray click. The actions-vs-no-actions difference is simply that Code Quality has no actions analysis. AC 2 is void β€” there is no second configuration to remove.

    The actual defect: the head has no Go to extract

    The failing job says so directly:

    Found no go.mod files in the workspace.
    Found 0 go.mod file(s).
    

    go.mod landed on main on 2026-07-14. Every failing PR branched from a main older than that, so its head genuinely contains no go.mod β€” confirmed by API, not inferred: contents/go.mod?ref=<head> returns 404 on the failing heads.

    The correlation is exact across the 25 open PRs I checked, with a clean control:

    PR behind main go.mod at head Analyze (go)
    #2721–#2745 (25 PRs) 77–79 absent (404) FAILURE (code-quality) + SUCCESS (code-scanning)
    #2704 51 present (87 B) SUCCESS + SUCCESS

    #2704 is the control: same repo, same day, same two analyses β€” the only difference is that its branch is new enough to carry go.mod, and it is the one platform PR whose checks are green. main passes for the same reason.

    Why it blocks

    Ruleset β€œRequire code quality results” (16885082, type: code_quality, severity: all, enforcement: active, ~DEFAULT_BRANCH) requires the Code Quality analysis to pass. Code Quality’s Go job uses build-mode: autobuild, which exits 32 with a configuration error when it extracts zero Go β€” so ordinary branch staleness is converted into a hard merge block.

    One thing I have not established: why the code-scanning Go job tolerates zero extracted Go on the very same commit while the code-quality one treats it as fatal. That asymmetry is observed, not explained.

    What the fix actually is

    Update the stale branches onto current main. Once a head carries the root go.mod, Go extracts and the analysis passes β€” #2704 already demonstrates the post-fix state. No settings change, no config removal, no maintainer click.

    Proposed AC replacement

    • 2. Remove the redundant configuration β€” void, both analyses are legitimate.
    • 4. Drop python β€” not yet actionable: main still contains 5 .py files (scripts/validate-*.py, scripts/tests/test_*.py), so python is correctly configured today. This unblocks only after Migrate remaining Python tooling and tests to GoΒ #2623 removes them.
    • New AC 2: every blocked PR head is updated onto a main containing go.mod.
    • New AC 3 (unchanged in spirit): Analyze (go) verified green on a real updated PR head β€” fix(aws): constrain eks-ci KMS grant creationΒ #2704 already satisfies this.
    • New AC 4: decide whether a zero-Go head should hard-block, or whether the code_quality ruleset needs a tolerance for it. This is the only durable question here; everything else self-heals as branches update.
    • 5. Express it in devantler-tech/.github β€” void for this defect (no config change is needed). Expressing code scanning declaratively remains worth doing, but it belongs on its own issue rather than riding on a defect it would not have prevented.

    Note on the blocked PRs

    The ~45 blocked PRs are all on codex/* branches cut the same day from a main ~77 commits stale. I have deliberately not pushed to or updated any of them β€” they are another instance's lane. Whoever owns them can clear the whole set with gh pr update-branch; the merge block disappears with the staleness.

  7. removed their assignment
    on Jul 19, 2026
  8. devantler commented on Jul 19, 2026

    @devantler
    ContributorAuthor

    πŸ€– Generated by the Daily AI Engineer

    Fix applied per the root cause above: 22 of the 27 stale-head codex/* PR branches are updated with main via the update-branch API (2699, 2700, 2702, 2703, 2707, 2709, 2710, 2713, 2714, 2717, 2723, 2725, 2729, 2730, 2733, 2734, 2737, 2738, 2739, 2740, 2742, 2743). Each now carries go.mod, so the code-quality CodeQL run should extract Go and pass β€” verification is each PR's fresh CI at its new head.

    5 could not be auto-updated β€” real merge conflicts between base and head: #2711, #2722, #2724, #2736, #2744. These need owner-side conflict resolution before the CodeQL fix can reach them.

    No settings/ruleset change made, per AC analysis above.

  9. devantler commented on Jul 19, 2026

    @devantler
    ContributorAuthor

    πŸ€– Generated by the Daily AI Engineer

    Verification complete: spot-checked 6 of the 22 updated PRs (#2699, #2700, #2713, #2725, #2739, #2743) β€” all checks green, zero pending, zero failures, confirming the stale-go.mod root cause end-to-end. The blocked-lane count is now down to the 5 conflict-bearing PRs named above (#2711, #2722, #2724, #2736, #2744), which need owner-side conflict resolution. Remaining issue scope is the declarative-management AC (code scanning config into .github deploy/).

  10. self-assigned this
    on Jul 19, 2026
  11. devantler commented on Jul 19, 2026

    @devantler
    ContributorAuthor

    πŸ€– Generated by the Daily AI Engineer

    Root cause (AC 1) β€” it is NOT a duplicate/conflicting configuration

    The opening hypothesis (two coexisting code-scanning configurations) is wrong, and it sent the diagnosis in the wrong direction. Both runs are the same workflow β€” workflow_id 159049983, path dynamic/github-code-scanning/codeql β€” from the one default setup. They differ only in analysis kind:

    Run (PR #2745, same head) analysis-kinds Result
    PR #2745 code-scanning (security) success
    Code Quality: PR #2745 code-quality go failure

    So there is nothing to de-duplicate. One configuration legitimately emits two analyses.

    Why only the code-quality one fails

    The two kinds build the database differently:

    • security β€” database init … --overlay-changes=…/overlay-changes.json, i.e. an overlay on a base database built from main.
    • code-quality β€” database init --force-overwrite … with no overlay, i.e. a full build from the PR head alone.

    And the decisive fact: go.mod and every .go file landed on main only on 2026-07-14 (348a132b7e, "fix(ci): heal cancelled merge-group deploys (#2622)"). A PR branch whose head predates that commit contains zero Go code.

    The overlay-based security analysis still sees Go via its main base database, so it passes. The full-build code-quality analysis extracts nothing:

    Found no go.mod files in the workspace.
    Found 0 go.mod file(s).
    go: warning: "github.com/devantler-tech/platform/..." matched no packages
    CodeQL could not process any code written in Go.
    ##[error]… "codeql database finalize …". Exit code was 32
    

    main is green for the same reason the PRs are red: main has go.mod.

    Differential test β€” 7/7 clean separation

    Checking go.mod at each PR head, against that PR's Analyze (go) outcome:

    PR head go.mod Analyze (go)
    #2705, #2745, #2712 absent fail
    #2699, #2742, #2743, #2635 present (87 B) pass

    The split is exact. Branch age relative to 348a132b7e predicts the failure with no exceptions.

    What makes it blocking

    Repository ruleset "Require code quality results" (id 16885082, rule code_quality, severity: all, active since 2026-05-26) gates merge on the code-quality analysis. That is why these PRs sit at BLOCKED rather than merely showing a red advisory check.

    The remedy is branch freshness, not a configuration change (revises AC 2 and AC 5)

    There is no redundant configuration to remove, so AC 2 is void as written, and AC 5's premise does not hold β€” no declarative change in devantler-tech/.github would fix this, because the configuration is not at fault. The fix is mechanical: bring each stale branch up to date with main so it contains the Go module.

    This also means the condition is self-limiting β€” every branch created or updated after 2026-07-14 is already immune, and the affected set shrinks on its own as branches rebase. No new PR can enter this state.

    AC 4 correction β€” python is not stale configuration

    The issue reasoned that python should probably be dropped as constitutionally Python-free. Live check: main still contains 5 .py files (scripts/validate-embedded-json.py, scripts/validate-naming.py, scripts/validate-homepage-bookmarks.py, scripts/refresh-flux-ghcr-auth tests, …). So python is configured correctly for the repo as it stands today; it becomes removable only once #2623 lands the bash/Go migration. Dropping it now would silently stop analysing code that is really there.

    Status

    gh pr update-branch 2705 applied β€” head moved 0dbc0d7dca β†’ 26549e5f46, and go.mod (87 B) is now present at that head. Its re-run is in flight; I will post the observed Analyze (go) result here as the AC 3 evidence rather than inferring it.

    Deliberately not mass-updating the remaining ~22 branches in this run: they are another instance's in-flight codex/* lane, and 22 concurrent base merges would collide with active work for no extra diagnostic value. With the remedy proven on one PR, the rest is safe routine hygiene.

  12. devantler commented on Jul 19, 2026

    @devantler
    ContributorAuthor

    πŸ€– Generated by the Daily AI Engineer

    AC 3 satisfied β€” verified on a real PR head, not inferred from main

    The re-run on #2705 after update-branch (head 0dbc0d7dca β†’ 26549e5f46):

    Analyze (actions): pass
    Analyze (go):      pass
    Analyze (python):  pass
    

    Failing-check count on that PR is now 0 (was: Analyze (go)). It still reads mergeStateStatus: BLOCKED purely because it is a draft β€” that is the draft state, not a residual gate.

    This closes the loop end-to-end: a head with no Go fails code-quality; the same PR, updated onto main so it carries go.mod, passes. Cause and remedy both confirmed by observation.

    Remaining work

    ~22 PRs are still on pre-2026-07-14 heads and will keep failing until updated. That is now routine hygiene with a known, proven remedy β€” gh pr update-branch <n> per PR β€” rather than an open investigation. I left them for their owning instance rather than merging into 22 branches concurrently mid-flight.

    Suggested disposition of the acceptance criteria

    • AC 1 β€” met (root cause above).
    • AC 2 β€” void: there is no redundant configuration; the premise was incorrect.
    • AC 3 β€” met (this comment).
    • AC 4 β€” superseded: python is correctly configured while 5 .py files remain; revisit under Migrate remaining Python tooling and tests to GoΒ #2623.
    • AC 5 β€” not applicable: nothing to express declaratively, since the configuration was never at fault.

    Given AC 2/4/5 rest on a premise the evidence contradicts, this issue is arguably done once the remaining branches are refreshed. I would rather the outcome be recorded honestly than have the issue closed against criteria that turned out to describe the wrong defect.

  13. devantler commented on Jul 19, 2026

    @devantler
    ContributorAuthor

    πŸ€– Generated by the Daily AI Engineer

    Housekeeping β€” my two comments above are largely redundant, and I want the record to say so.

    I re-derived the root cause independently without first reading the earlier comments on this issue. The 00:03Z comment had already established the same conclusion, 02:37Z applied the fix to 22 branches, and 03:37Z verified it. Two agent runs reached the same answer; there is one defect here, not two.

    The only new work in this run is the tail the earlier sweep did not cover: #2708, #2712, #2735, #2741 were still failing Analyze (go) on stale heads β€” now updated, and all four observed green β€” plus #2705. The remaining DIRTY PRs (#2711, #2722, #2724, #2736, #2744) have genuine merge conflicts and still need their owner.

    The independent re-derivation does at least corroborate the diagnosis from a second angle (differential go.mod presence across 7 heads, and the code_quality ruleset as the blocking mechanism). But it cost a duplicate analysis, and the fault is mine for not reading the thread first.

  14. devantler commented on Jul 19, 2026

    @devantler
    ContributorAuthor

    πŸ€– Daily AI Engineer (Codex) β€” verified root-cause update

    This is not two redundant Code Security configurations. GitHub has two separately configured products on this repository:

    • Code Security default setup is configured for actions, go, and python (last updated 2026-07-14).
    • Code Quality is separately configured for go and python (last updated 2026-07-17).

    The two disputed PR runs share GitHub's dynamic CodeQL workflow ID and the same PR head/time, but their run names identify the products: PR #2745 succeeded under Code Security, while Code Quality: PR #2745 failed. The corresponding main-branch Code Quality run succeeded, so the failure is specific to the PR analysis path.

    I also verified that the currently deployed GitHub provider CRD only exposes securityAndAnalysis; it has no Code Quality setup field or resource. The organisation .github repository therefore cannot yet declare this setting through the existing Crossplane surface.

    Immediate remediation would require a direct GitHub settings API change (for example, temporarily reducing Code Quality to Python-only) or leaving the failing Go preview lane enabled. Because the former weakens a quality guardrail and is not currently declarative, I have made no settings mutation. The blocking choice has been actively escalated through the approved maintainer channel.

    References: enable Code Quality, Code Quality REST API.

  15. devantler commented on Jul 19, 2026

    @devantler
    ContributorAuthor

    πŸ€– Generated by the Daily AI Engineer (Codex instance)

    Maintainer decision A is now applied through GitHub's versioned Code Quality setup API.

    • Before: Code Quality state=configured, languages=[go, python].
    • After: Code Quality state=configured, languages=[python], updated 2026-07-19T11:19:07Z.
    • Unchanged safety surface: Code Security default setup remains languages=[actions, go, python], query_suite=default.
    • Ordinary Go CI and the Code Security Go analysis remain required; only the public-preview Code Quality Go lane was removed.

    The change is settings-only and reversible because the deployed GitHub provider still has no Code Quality field. #2751 tracks the dated GA/behavior probe, representative PR trials, Go re-enable, and eventual declarative ownership.

    Existing stale/conflicted PR heads may retain historical red check runs until their owners resolve conflicts or refresh those branches; the repository-level source of new Go Code Quality failures is removed.

  16. moved this from πŸ“₯ Backlog to βœ… Done in 🌊 Project Boardon Jul 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

Fields

Priority

None yet

Effort

None yet

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions