Skip to content

ci: fix 'Argument list too long' in release-on-main workflow#171

Merged
benvinegar merged 2 commits intomainfrom
fix/release-workflow-arg-list-too-long
Feb 24, 2026
Merged

ci: fix 'Argument list too long' in release-on-main workflow#171
benvinegar merged 2 commits intomainfrom
fix/release-workflow-arg-list-too-long

Conversation

@benvinegar
Copy link
Member

Problem

The release workflow fails with:

An error occurred trying to start process '/usr/bin/bash' with working directory
'/home/runner/work/baudbot/baudbot'. Argument list too long

Root cause: PR context (140+ merged PRs with full bodies = ~155KB of JSON) was passed through GITHUB_OUTPUT and then injected as PR_CONTEXT env vars in the "Decide release bump" and "Build changelog" steps. This exceeded Linux ARG_MAX, preventing bash from starting at all.

Since there are no release tags yet, the workflow gathered every merged PR since epoch.

Fix

  1. Write PR context to a file (/tmp/pr_context.json) instead of passing through GITHUB_OUTPUT → env vars
  2. Read from file in downstream steps (jq --slurpfile for the Anthropic payload, direct path for changelog)
  3. Truncate PR bodies to 200 chars — Claude only needs titles and a brief summary, not full PR descriptions
  4. Remove PR_CONTEXT env vars from both the decide and changelog steps

Verification

  • yaml-lint passes
  • actionlint passes (only shellcheck style suggestions, no errors)
  • jq --slurpfile behavior verified locally
  • ✅ Body truncation + null-body handling verified locally

To verify on CI without merging

You can test this workflow on the branch by triggering it manually:

gh workflow run release-on-main.yml --ref fix/release-workflow-arg-list-too-long

(Requires workflow_dispatch trigger, which is already configured)

PR context (140+ PRs with full bodies) was passed through GITHUB_OUTPUT
and injected as env vars, exceeding ARG_MAX and preventing bash from
starting.

Fix:
- Write PR context to /tmp/pr_context.json instead of GITHUB_OUTPUT
- Read from file in downstream steps (jq --slurpfile / direct path)
- Truncate PR bodies to 200 chars (Claude only needs titles + summary)
- Remove PR_CONTEXT env vars from 'decide' and 'changelog' steps
@greptile-apps
Copy link

greptile-apps bot commented Feb 24, 2026

Greptile Summary

Fixes Linux ARG_MAX error by writing PR context to /tmp/pr_context.json instead of passing through GITHUB_OUTPUT environment variables. PR bodies are truncated to 200 characters to reduce payload size. The jq --slurpfile approach correctly loads the file and accesses it via $prs[0] in the Anthropic API payload construction.

  • Removes pr_context output from GITHUB_OUTPUT and writes directly to file (line 81, 86)
  • Removes PR_CONTEXT env vars from both decide and changelog steps
  • Uses jq --slurpfile prs /tmp/pr_context.json with $prs[0] array access (line 124, 131)
  • Truncates PR bodies to 200 chars using (.body // "" | .[:200]) with null handling (line 85)
  • Directly reads from file in changelog step using jq -r (line 241)

Confidence Score: 5/5

  • Safe to merge - solves a critical production issue with a well-tested approach
  • The fix addresses a real production failure (ARG_MAX exceeded) with a proven solution (file-based passing). The jq --slurpfile syntax is correct, null body handling prevents edge cases, and the 200-char truncation is appropriate for Claude's use case. All downstream consumers properly read from the file.
  • No files require special attention

Important Files Changed

Filename Overview
.github/workflows/release-on-main.yml Replaces environment variable passing with file-based approach to avoid ARG_MAX limit, truncates PR bodies to 200 chars

Last reviewed commit: 740ca48

- When no prior tag exists, look back 30 days instead of all time
- Cap Claude's input to 50 most recent PRs (full list still used for
  changelog/release notes)
- Prevents unbounded growth as the repo accumulates PRs
@benvinegar benvinegar merged commit 5818327 into main Feb 24, 2026
9 checks passed
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.

1 participant