Skip to content

fix(ci): setup-go never snapshots a persistent runner's Go cache - #334

Merged
github-actions[bot] merged 1 commit into
mainfrom
fix/runner-go-cache-disk
Dec 2, 2026
Merged

github-actions[bot] merged 1 commit into
mainfrom
fix/runner-go-cache-disk

Conversation

@aitrawog

@aitrawog aitrawog commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Summary

The org's required validate / validate job died three times today in Set up Go with No space left on device, on three runners (charly-ci-qo-4-1, charly-ci-no-2-1, charly-ci-no-1-1). The cause is actions/setup-go's default cache on persistent self-hosted runners. It also explains #324's original teardown signature. This closes #324.

Mechanism, measured:

  • On these runners GOMODCACHE (/home/ubuntu/.cache/charly/go/mod) and GOCACHE (/home/ubuntu/.cache/go-build) persist between jobs.
  • Save: setup-go's post step tars both whole. The archive is the runner's entire accumulated Go cache: 2,846,485,519 bytes, under one key shared by every runner, setup-go-Linux-x64-undefined-…, because ImageOS is unset on self-hosted runners. That took 84 s of tar plus about 3 min of upload in a passing run's teardown, which is fix(runner): self-hosted runner exhausts disk during workflow teardown and tag-on-merge #324's original signature.
  • Restore: the next run downloads that archive and untars it over the live copy (tar: … Cannot open: File exists ×96,327) until the disk runs out, which is today's signature.

The fix: every setup-go step in this repo states its cache decision.

Step Decision Why (measured)
pr-validator.yml validate (the contract sweep) cache: false, and the dead cache-dependency-path is dropped The sweep needs no module: built cold with an empty module cache and GOPROXY=off, it compiles in 3.6 s and the module cache stays at 4.0K. No runner gains from a cache.
pr-validator.yml lint cache: false Its cache never worked. The PR sits under pr-head/, so every run logged ##[warning]Restore cache failed: Dependencies file is not found and Primary key was not generated.
candy-validate.yml, image-build.yml (charly builds with real dependencies) cache: ${{ runner.environment == 'github-hosted' }} Keep the cache only where the runner starts empty. On a persistent runner, the persistent directories already are the cache.

scripts/setup-go-cache_test.sh (new, wired into workflow-checks.yml) refuses any setup-go step with no explicit cache:, or with any other value.

$ git diff --stat origin/main...HEAD
  .github/workflows/candy-validate.yml  |   8 +++
  .github/workflows/image-build.yml     |   8 +++
  .github/workflows/pr-validator.yml    |  20 +++++-
  .github/workflows/workflow-checks.yml |   2 +
  scripts/setup-go-cache_test.sh        | 115 ++++++++++++++++++++++++++++++++++
  5 files changed, 152 insertions(+), 1 deletion(-)

How tested

Head 7c5c840374cb1bff844a5df000c8ff7422b27fc6 (tree f5c7bba673beb8824bed58c23dfa0d35ee9f00fe), worktree .worktrees/cloud-charly/dotgithub off origin/main 6f5b133bf9d3a655dee1081418e802880e5c252c.

The evidence the mechanism rests on (job logs, read with gh api --allow-escape-sequences repos/opencharly/spec/actions/jobs/<id>/logs):

  • A failing restore (run 46926696650, charly-ci-no-1-1): Cache hit for: setup-go-Linux-x64-undefined-go-1.26.0-272dcab0…, then Received … of 2846485519, then tar: …/.cache/go-build/…: Cannot write: No space left on device, then ##[error]No space left on device.
  • A passing run's save (run 46910319708): /usr/bin/tar --posix -cf cache.tzst … --files-from manifest.txt at 15:14:06, then Sent … of 2846485519, then Cache saved with the key: setup-go-Linux-x64-undefined-… at 15:17:11.
  • The org-wide spread (gh api orgs/opencharly/actions/cache/usage-by-repository): pod-kde-vnc-cdp 15.5 GB in 3 entries, sdk 12.3 GB, spec 10.9 GB, .github 10.7 GB, and so on.

The new test fails on origin/main's workflows (swapped in, run, restored):

$ bash scripts/setup-go-cache_test.sh   # workflows at origin/main 6f5b133bf9d3a655dee1081418e802880e5c252c
self-test ok: missing and foreign rejected, both allowed forms accepted
FAIL .github/workflows/candy-validate.yml:120: actions/setup-go has no explicit `cache:` (the default caches a persistent runner's whole Go cache)
FAIL .github/workflows/image-build.yml:136: actions/setup-go has no explicit `cache:` (the default caches a persistent runner's whole Go cache)
FAIL .github/workflows/pr-validator.yml:355: actions/setup-go has no explicit `cache:` (the default caches a persistent runner's whole Go cache)
FAIL .github/workflows/pr-validator.yml:1490: actions/setup-go has no explicit `cache:` (the default caches a persistent runner's whole Go cache)
ok   .github/workflows/workflow-checks.yml:69: cache: false
rc=1

With the change:

$ bash scripts/setup-go-cache_test.sh   # with the change
self-test ok: missing and foreign rejected, both allowed forms accepted
ok   .github/workflows/candy-validate.yml:120: cache: ${{ runner.environment == 'github-hosted' }}
ok   .github/workflows/image-build.yml:136: cache: ${{ runner.environment == 'github-hosted' }}
ok   .github/workflows/pr-validator.yml:355: cache: false
ok   .github/workflows/pr-validator.yml:1501: cache: false
ok   .github/workflows/workflow-checks.yml:69: cache: false
setup-go-cache_test: PASS
rc=0

actionlint on the four edited workflows (actionlint 1.7.7):

$ actionlint .github/workflows/pr-validator.yml .github/workflows/candy-validate.yml .github/workflows/image-build.yml .github/workflows/workflow-checks.yml
rc=0

Every test workflow-checks.yml runs, run locally on this tree; the last output line of each and its exit code:

$ bash scripts/image-build-tag_test.sh
image-build-tag_test: OK (explicit tag verbatim; v-tag push strips the v; build-only derives ci-<sha> and announces it; a publishing run without a tag refuses by name; the build-only arm is load-bearing)
rc=0
$ bash scripts/org-ruleset_test.sh
org-ruleset_test: all assertions passed (apply/verify/abort, targets + forks)
rc=0
$ bash scripts/retire-per-repo-dispatchers_test.sh
retire-per-repo-dispatchers_test: all assertions passed (targets + forks)
rc=0
$ bash scripts/retire-per-repo-candy-gates_test.sh
retire-per-repo-candy-gates_test: all assertions passed
rc=0
$ bash scripts/strip-config-version_test.sh
strip-config-version_test: all assertions passed
rc=0
$ bash scripts/setup-go-cache_test.sh
setup-go-cache_test: PASS
rc=0
$ bash scripts/head-settle_test.sh
head-settle_test: all assertions passed
rc=0
$ bash scripts/arm-enable_test.sh
arm-enable_test: all assertions passed
rc=0
$ bash scripts/retired-sweep-arm_test.sh
retired-sweep-arm_test: OK (clean tree passes; a carrier fails and is named; the table is read from the tree in opencharly/.github and from the org checkout everywhere else; a covered hit is a RECORD and a stale record fails; the sweep is a guarded step of the required validate job; a go.work the job does not own cannot decide the verdict; a re-run can clone over the previous attempt's checkout)
rc=0
$ bash scripts/assert-org-rulebook_test.sh
assert-org-rulebook_test: OK (a project rulebook passes; an empty prompt fails and names the cause; a prompt that names no project fails; the step forwards vars.AI_REVIEW_PROMPT)
rc=0
$ bash scripts/engine-pin-asset_test.sh
engine-pin-asset_test: OK (a good asset pair installs the engine; a 504 is 'asset unreachable' with its URL and status and stays infra with the RE-RUN remedy; a 200 HTML body is unreadable; a 4xx is an absent asset with the publish remedy; a dead tag is a pin defect; the tarball is measured too; three negative controls turn this RED)
rc=0
$ bash scripts/reconcile-tag-on-merge-callers_test.sh
reconcile-tag-on-merge-callers_test: 17 passed, 0 failed
rc=0
$ bash scripts/reconcile-tag-on-merge-callers_tag_test.sh
PASS: the reconcile tags every write it makes, guards the source repo, does not re-tag, and uses Go's form for module repos (6 properties)
rc=0
$ bash scripts/backfill-missing-tags_test.sh
PASS: the backfill tags only what is untagged and unexplained, in the right form, verifies every create by the ref itself, and names an exhausted quota once at every read AND at the create (19 properties)
rc=0
$ bash scripts/tag-on-merge-assert_test.sh
PASS: tag-on-merge untagged-merge detector (10 properties: 4 green arms, 2 red arms naming the merge, 4 structural)
rc=0
$ bash scripts/reconcile-fork-callers_test.sh
PASS: fork caller reconcile — install on the default branch (birth, untagged), SHA-pin bump, update tagged, targets never install
rc=0
$ bash scripts/sync-forks_test.sh
PASS: sync-forks — fast-forward read-back, merge accepted, conflict reported, allow-list
rc=0
$ python3 scripts/check-action-runtimes.py
check-action-runtimes: OK (18 workflow files; 5 audited pins; node24)
rc=0
$ python3 scripts/check-action-runtimes.py
check-action-runtimes: OK (18 workflow files; 5 audited pins; node24)
rc=0
$ bash scripts/bootstrap-repo-main_test.sh
bootstrap-repo-main_test: all assertions passed
rc=0
$ bash scripts/labels-test.sh
PASS: the label taxonomy tool syncs, audits (forbidden prefixes + the retired gate), classifies and applies, samples (tested-fixture recording + --n), retires, renders, verifies close, handles the quota/permission classes in every verb, and classifies by the issue text alone (never the repo name)
rc=0
$ bash scripts/governance-reconcile.sh
governance-reconcile: checked=50 skipped=55 fail=0
rc=0
$ bash scripts/governance-reconcile.sh
governance-reconcile: checked=50 skipped=55 fail=0
rc=0

Change class: CI workflow configuration (opencharly/.github). Its gate is workflow-checks.yml, reproduced locally above, plus this PR's own validator run. The changed steps run from main only after the merge: the org-required workflow is read at @refs/heads/main. So the post-merge proof is the next validator runs on other PRs, where Set up Go must log no Cache hit/Cache saved for the validate step. I will paste it on #324.

Spike

The three candidates, each held to one requirement (the table below): the required job must pass on these runners without a manual infrastructure command.

Candidate Result
A: an explicit cache decision per step (false, or GitHub-hosted only) Works. The validate sweep builds cold and offline in 3.6 s (GOPROXY=off, empty module cache, rc=0), so the 2.85 GB restore and the ~3 min save disappear. The lint cache was already a no-op with a warning. actionlint types runner.environment (its error for an unknown property lists environment: string in the runner object type; control: runner.nonexistent is rejected).
B: a free-space guard before Set up Go Refuted. It turns ENOSPC into an earlier, clearer failure, but the job still fails: the step still needs room for a 2.85 GB archive plus its extraction over a live copy.
C: prune the runners' caches between jobs Refuted. It needs a manual command on runner hosts (C5). The next save re-snapshots whatever the persistent directories hold, so the archive regrows.

Winner: A.

Rulebook compliance

  • C0: /charly-internals:repo-setup, /charly-internals:root-cause-analyzer and /charly-internals:git-workflow were loaded, and this repo's AGENTS.md ("Build / validate / test") was read.
  • C1: the RCA is above (mechanism, missed control, blast radius, root fix). Missed control: no check made a setup-go cache a decision, so the default (a cache) was taken silently. The new test is that control. Zero new warnings: the lint job's per-run ##[warning] is removed.
  • C2: the spike round is above.
  • C3: the map is below.
  • C4: one rule with two allowed values, enforced by one test across every workflow.
  • C5: no retry and no manual runner cleanup. The cause is removed.
  • C6: every setup-go in this repo is covered: the test lists all five steps, including workflow-checks.yml's existing cache: false. The same default in 27 workflow files of 22 other repositories is filed as Per-repo workflows still take setup-go's default cache on persistent self-hosted runners #333 (one PR per repository, each owned elsewhere).
  • C7: no documented command changes.
  • C8: the test fails on origin/main and passes here.
  • C9: no service is mocked. The evidence is real job logs and the real cache API.
  • C10: not applicable; no charly binary is involved.
  • C11: the workflow-checks.yml suite and actionlint on the committed tree.
  • C12: worktree .worktrees/cloud-charly/dotgithub. fix(runner): self-hosted runner exhausts disk during workflow teardown and tag-on-merge #324 was claimed before the edit, and the open-PR list showed no other session touching these workflows.

Plan conformance

Winning candidate: A, an explicit setup-go cache decision per step.

No DESIGN-governed surface — the change is the org's CI workflow configuration (setup-go cache decisions in four workflows, plus a policy test). It touches no DESIGN.cue definition, no ai.opencharly.* label and no InstallPlan surface. The rule it follows is AGENTS.md C5: "Do: fix the cause instead" of a blind retry or a manual infrastructure command.

Filed issues

Change classification

Change class: CI workflow configuration. Gate: the workflow-checks.yml suite (reproduced locally) and actionlint; the live proof follows the merge on other PRs' validator runs. Tier: analysed on a live system. The mechanism is measured on live runs and the checks pass locally, but the changed workflow cannot run on its own PR.
Breaking change + rollback: none for consumers. Jobs stop restoring and saving the multi-GB cache; on a GitHub-hosted runner, candy-validate and image-build keep their cache. Rollback: revert this commit.

https://claude.ai/code/session_01Tvdn3vuAwUEWaR9p9fc7ca

Agent: cloud-charly · Claude Code session 4f8404c4-b4fe-44e0-90d2-89db3fe800d5
Assisted-by: Claude Code Anthropic Claude Opus 5.5 (analysed on a live system)

The required `validate / validate` job died three times today in "Set up Go"
with "No space left on device" (charly-ci-qo-4-1, -no-2-1, -no-1-1).
setup-go's default cache tars GOMODCACHE + GOCACHE in its post step and untars
them on the next run. On the persistent self-hosted runners those directories
already survive between jobs, so:
- each save snapshotted the runner's whole accumulated cache: a
  2,846,485,519-byte archive under the shared key
  setup-go-Linux-x64-undefined-…, with ~3 min of tar and upload in teardown
  (#324's original signature);
- each restore wrote that archive back over the live copy until the disk ran
  out (today's signature).

Every setup-go step in this repo now states its cache decision:
- pr-validator `validate` (the contract sweep): `cache: false`. Built cold with
  an empty module cache and GOPROXY=off, the sweep compiles in 3.6s and the
  module cache stays empty, so no cache helps it on any runner. Its
  `cache-dependency-path` goes with it.
- pr-validator `lint`: `cache: false`. Its cache never worked: the PR sits
  under pr-head/, so every run logged "Restore cache failed: Dependencies file
  is not found" and "Primary key was not generated".
- candy-validate and image-build (charly builds with real dependencies):
  `cache: ${{ runner.environment == 'github-hosted' }}`, so the cache is used
  only where the runner starts empty.

scripts/setup-go-cache_test.sh (wired into workflow-checks) refuses any setup-go
step without an explicit decision, or with any other value. It fails on all four
steps at origin/main and passes here, and its self-test proves the checker
rejects both bad forms.

Closes #324

Agent: cloud-charly · Claude Code session 4f8404c4-b4fe-44e0-90d2-89db3fe800d5
Assisted-by: Claude Code Anthropic Claude Opus 5.5 (analysed on a live system)
Claude-Session: https://claude.ai/code/session_01Tvdn3vuAwUEWaR9p9fc7ca
@github-actions

github-actions Bot commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Review — PASS

Head SHA: 7c5c840374cb1bff844a5df000c8ff7422b27fc6 (branch: fix/runner-go-cache-disk)

Security screen: PASS — no secrets/egress, no weakened gate (setup-go cache flags only; the validator's logic, prompt, and branch-protection posture are untouched; the new test strengthens the gate).
Checklist: All applicable rules PASS or NA. Change class is CI workflow configuration; workflow-checks.yml + actionlint is the matching gate; no charly binary/bed is involved (C10, DISP, SDD, ADE, RDD-bed, C9-boundary all NA). Body is complete (all five files accounted for, ### Spike, ### Plan conformance, ## Filed issues, honest analysed on a live system tier, Agent/Assisted-by footers). The new test fails on origin/main and passes here, so C8/C11 coverage is genuine.

Verdict: PASS


ollama-cloud/deepseek-v4.1-flash — action-review.

View action run

@github-actions
github-actions Bot enabled auto-merge (squash) December 2, 2026 17:00
@github-actions
github-actions Bot merged commit d11852a into main Dec 2, 2026
4 checks passed
charly-auto-merge Bot added a commit that referenced this pull request Dec 2, 2026
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.

fix(runner): self-hosted runner exhausts disk during workflow teardown and tag-on-merge

1 participant