Skip to content

Fix ARG_MAX crash on large PRs in docs-preview-local workflow - #4156

Open
Mpdreamz wants to merge 1 commit into
mainfrom
fix/build-check
Open

Mpdreamz wants to merge 1 commit into
mainfrom
fix/build-check

Conversation

@Mpdreamz

Copy link
Copy Markdown
Member

The docs-preview-local workflow crashes before any step runs when a pull request touches more than a few hundred files. This mirrors the same fix applied to elastic/docs-actions#353.

Affects: Deploys & previews, Automation

Prompt summary: A massive detection-rules PR was failing the docs CI check with "Argument list too long". The ask was to identify the root cause, confirm the PR was safe to merge from a docs perspective, and fix the workflow so large PRs no longer crash it.

Why

The check-modified-file-detail step joins every changed file path into a space-separated string and sets it as a job-level environment variable. When a PR touches hundreds or thousands of files, the combined environment exceeds Linux's ARG_MAX limit (~2 MB). Every subsequent bash shell fails to start with Argument list too long — including the "Skip build" step — so the job exits with an error before the docs builder runs at all. The docs content never failed; the runner infrastructure did.

What

File-list cap in check-modified-file-detail

When the total number of changed files exceeds 500, the step now outputs empty strings for added_files, modified_files, deleted_files, and renamed_files instead of joining them all. The docs builder CLI interprets empty file lists as a signal to do a full rebuild rather than an incremental one. PRs under 500 files continue to use the incremental path unchanged.

🤖 Generated with Claude Code

When a pull request touches more than 500 files, joining all changed
paths into space-separated environment variables exceeds Linux's ARG_MAX
limit. Every bash shell then fails to start with "Argument list too long",
crashing the job before the docs builder runs.

When the total file count exceeds 500, the file list outputs are now
cleared. An empty list tells the docs builder to do a full rebuild
rather than an incremental one.

Mirrors the same fix applied to elastic/docs-actions#353.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me.


What is this? | From workflow: PR Review

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant