Skip to content

[CI/Build] Fix flaky failures in CPU CI image building - #55317

Merged
bigPYJ1151 merged 7 commits into
vllm-project:mainfrom
bigPYJ1151:fix-cpu-ci-log-level-and-triton-cache
Sep 4, 2026
Merged

bigPYJ1151 merged 7 commits into
vllm-project:mainfrom
bigPYJ1151:fix-cpu-ci-log-level-and-triton-cache

Conversation

@bigPYJ1151

Copy link
Copy Markdown
Member

Summary

  • Retry the CPU test Docker image build on transient network errors instead of failing the whole CI job outright.
  • Keep BuildKit cache mounts warm and raise the disk-pressure prune threshold so hot layers survive across jobs instead of getting evicted mid-build; add a local-disk sccache mode for CPU test builds.
  • Scope the reranker test's VLLM_LOGGING_LEVEL=WARNING override to just its own server subprocess (via RemoteOpenAIServer's env_dict) instead of mutating os.environ at module import time. That mutation leaked into the whole pytest process once tests/models/language/{generation,pooling} and the CPU e2e test got combined into a single sharded invocation ([CI] Shard CPU jobs above the 24h P90 threshold #54751), since pytest imports every test file during collection regardless of -k/-m selection — silently hiding EngineCore/Worker INFO-level startup logs in CI for every test that ran afterward in that session.
  • Fail the vllm-triton-cpu-build Docker stage's RUN step on any internal failure (set -ex) instead of letting a transient error (e.g. a network blip cloning triton-cpu) fall through to rm -rf triton-cpu; exit 0. Previously, a single such failure got permanently cached by BuildKit as a "successful" empty dist/, so every future CI job scheduled on that same agent silently fell back to requirements/test/cpu.txt's triton==3.6.0 pin instead of triton-cpu, with no error anywhere — reproduced against build #87100, where two independent CPU CI agents had exactly this stale cache.

Why this doesn't duplicate an open PR

Searched vllm-project/vllm open/closed PRs for each change (disk-pressure prune threshold, BuildKit cache mounts, local-disk sccache, retry CPU image build, triton-cpu build cache, VLLM_LOGGING_LEVEL) — no existing PR addresses any of these.

Test plan

  • test_max_tokens_per_doc.py log-leak fix: reproduced the log-suppression bug live in a locally built CPU test Docker image by running the exact pre-/post-[CI] Shard CPU jobs above the 24h P90 threshold #54751 pytest invocations (pytest tests/models/language/generation tests/models/language/pooling tests/v1/e2e/test_cpu_linear_attn_chunked_prefix.py -m cpu_model --num-shards=N --shard-id=i, filtered to facebook/opt-125m to keep it fast). Confirmed EngineCore/Worker INFO logs were absent (0 occurrences) in shards that exercised the reranker tests before the fix, and present after, matching unaffected shards' behavior.
  • docker/Dockerfile.cpu set -ex fix: built the vllm-triton-cpu-build stage in isolation twice.
    • Happy path (docker build --target vllm-triton-cpu-build --build-arg USE_SCCACHE=1 --build-arg SCCACHE_LOCAL_ONLY=1 -f docker/Dockerfile.cpu .): succeeds, produces triton-3.7.0+git270e696d-...whl exactly as before.
    • Forced failure (same command with the git checkout ref pointed at a nonexistent ref): before the fix this exits 0 and caches an empty dist/; after the fix, docker build fails with exit code 1 and a clear error pointing at the failed RUN step.
  • Did not re-run the full CPU CI matrix end-to-end (would require a live CI run); the two isolated reproductions above cover the actual failure modes being fixed.

AI assistance disclosure

The root-cause analysis (bisecting the log-suppression bug across shard/test-file combinations, and finding the missing errexit in the triton-cpu build stage) and the fixes above were developed with AI assistance (Claude Code). I reviewed every changed line and ran the test/build commands listed above myself before opening this PR.

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@mergify mergify Bot added ci/build cpu Related to CPU backends labels Sep 4, 2026
@coderabbitai

coderabbitai Bot commented Sep 4, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 37813fe1-051a-4cfb-87bf-beee86bba5aa

📥 Commits

Reviewing files that changed from the base of the PR and between 9d2bebfe6dc65418a5b1699468efd081ae446f35 and 7df33c9.

📒 Files selected for processing (1)
  • csrc/cpu/sgl-kernels/mla_cache.cpp

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.


📝 Summary

Summary by CodeRabbit

  • Build Improvements

    • CPU container image builds now better handle temporary network failures through automatic retries.
    • Build processes clean up disk space more effectively and can use local caching for faster, more reliable compilation.
    • Required base images are checked before builds begin.
  • Testing

    • Test server logging is now configured per test run, reducing unintended effects on other tests.

Walkthrough

The CPU build workflow updates disk cleanup and Docker build retries. The CPU Dockerfile adds local-disk sccache support across three stages. The pooling test scopes logging to its server fixture, and the MLA cache comment clarifies tensor shapes.

Changes

CPU build maintenance

Layer / File(s) Summary
Local sccache build mode
docker/Dockerfile.cpu
The Dockerfile adds local sccache cache mounts and a SCCACHE_LOCAL_ONLY mode across three build stages.
CPU build preparation and retries
.buildkite/scripts/hardware_ci/run-cpu-test.sh
The script raises cleanup thresholds, excludes exec.cachemount records from pruning, pulls ubuntu:22.04, and retries matching transient Docker build failures.

Test and kernel maintenance

Layer / File(s) Summary
Scoped test logging configuration
tests/models/language/pooling/test_max_tokens_per_doc.py
The server fixture passes VLLM_LOGGING_LEVEL=WARNING through RemoteOpenAIServer instead of setting it globally.
MLA cache documentation formatting
csrc/cpu/sgl-kernels/mla_cache.cpp
The comment documents the alternate k_pe shape and separates the kv_cache and slot_mapping shape descriptions.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Merge Risk: ⚪ Minimal · up to 7df33

This change improves CPU CI build retries, caching, cleanup behavior, and test logging isolation without any identified current-head merge-blocking risk.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 66.67% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 3 functions across 3 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly summarizes the primary change: fixing flaky CPU CI image-build failures.
Description check ✅ Passed The description directly explains the CPU CI build, caching, logging-scope, and Triton build fixes, along with their test coverage and limitations.
  • Fix all pre-merge checks with AI

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@bigPYJ1151
bigPYJ1151 force-pushed the fix-cpu-ci-log-level-and-triton-cache branch from 9d2bebf to f2b6f92 Compare September 4, 2026 09:59
CPU CI jobs were frequently failing fast on unrelated PRs due to
transient DNS/connection errors during `docker build` (base image
auth, rustup, rust toolchain, pypi/uv), which normally succeed on a
manual rebuild. Retry only the build command with backoff when the
output matches known transient-network signatures, leaving the actual
test run (`docker run`) untouched so real test failures are never
retried or masked.

Signed-off-by: jiang1.li <jiang1.li@intel.com>
Local CPU test builds were losing their uv/cargo/apt package caches to
docker builder prune whenever disk pressure hit, forcing full re-downloads
on the next build. Exclude cache mounts (exec.cachemount) from the prune
filter so only regular build-cache records get reclaimed, and raise the
retention ceiling from 80GB to 200GB to reduce how often pruning kicks in.

Signed-off-by: jiang1.li <jiang1.li@intel.com>
Build CPU image (image_build_cpu.sh) uses USE_SCCACHE with an S3 backend
plus a registry-backed BuildKit cache, so it stays fast across agents. The
CPU test shards' embedded docker build (run-cpu-test.sh) used neither,
rebuilding Rust and C++ from scratch on every run even though the same
agent had just compiled the identical source minutes earlier.

Add SCCACHE_LOCAL_ONLY, which redirects sccache to a local BuildKit cache
mount instead of S3 when set, so it works without AWS credentials. Wire it
into the rust-build-cache, vllm-build, and vllm-triton-cpu-build stages,
and enable it by default in run-cpu-test.sh. Verified locally: a rebuild
with one source file changed (so Docker's own layer cache misses) hit
sccache for 485/485 C++ objects and 1692/1696 Rust objects, cutting those
stages from ~240s/~283s to ~33s/~148s. The default (no USE_SCCACHE) and S3
(USE_SCCACHE without SCCACHE_LOCAL_ONLY) paths are unchanged.

Signed-off-by: jiang1.li <jiang1.li@intel.com>
70% was triggering builder prune too eagerly relative to the new 200GB
retention ceiling, discarding warm cache before it was actually needed.

Signed-off-by: jiang1.li <jiang1.li@intel.com>
Setting os.environ at module import time leaked into the whole pytest
process once CPU generation/pooling/e2e tests were combined into a
single sharded invocation (vllm-project#54751), since pytest imports every test
file during collection regardless of -k/-m selection. This silently
downgraded EngineCore/Worker child-process logging to WARNING for the
rest of that session, hiding their INFO-level startup logs in CI.

Pass the override via RemoteOpenAIServer's env_dict instead, so it only
affects the launched server subprocess.

Signed-off-by: jiang1.li <jiang1.li@intel.com>
The RUN script in the vllm-triton-cpu-build stage chains git clone/checkout
and uv build with plain ';' and no errexit, so a transient failure partway
through (e.g. a network blip cloning triton-cpu) doesn't abort the script:
it falls through to 'rm -rf triton-cpu' and exits 0. Docker/BuildKit then
caches that layer as a success, with an empty dist/. Because that cache is
local and persists across CI jobs, any agent that ever hits this once keeps
silently falling back to the requirements/test/cpu.txt-pinned triton==3.6.0
instead of triton-cpu, with no error anywhere (confirmed against build
#87100, where two different CPU CI agents had exactly this stale cache).

Add 'set -ex' so a failure inside the build aborts the RUN and BuildKit
correctly treats the layer as failed instead of caching it.

Signed-off-by: jiang1.li <jiang1.li@intel.com>
@bigPYJ1151

Copy link
Copy Markdown
Member Author

/ci run

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

✅ Triggered Buildkite CI #87235 for commit f2b6f9224757.

@bigPYJ1151

Copy link
Copy Markdown
Member Author

/ci run

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

✅ Triggered Buildkite CI #87241 for commit 4c2ec7bdec98.

@bigPYJ1151
bigPYJ1151 force-pushed the fix-cpu-ci-log-level-and-triton-cache branch from 4c2ec7b to 7df33c9 Compare September 4, 2026 11:36
@bigPYJ1151

Copy link
Copy Markdown
Member Author

/ci run

@github-actions

github-actions Bot commented Sep 4, 2026

Copy link
Copy Markdown

✅ Triggered Buildkite CI #87243 for commit 7df33c9f9df9.

The docstring above concat_and_cache_mla_cpu got mangled across lines
by a previous clang-format pass, splitting field names mid-sentence.

Signed-off-by: jiang1.li <jiang1.li@intel.com>
@bigPYJ1151 bigPYJ1151 changed the title [CI/Build][CPU] Harden CPU CI image builds against silent cache/log failures [CI/Build] Fix flaky failures in CPU CI image building Sep 4, 2026
@bigPYJ1151
bigPYJ1151 merged commit 8340fe1 into vllm-project:main Sep 4, 2026
52 checks passed
@bigPYJ1151
bigPYJ1151 deleted the fix-cpu-ci-log-level-and-triton-cache branch September 4, 2026 12:27
ItsRoy69 pushed a commit to ItsRoy69/vllm that referenced this pull request Sep 10, 2026
…55317)

Signed-off-by: jiang1.li <jiang1.li@intel.com>
Signed-off-by: Jyotirmoy Roy <jyotirmoyroy649@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci/build cpu Related to CPU backends

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants