Skip to content

fix: prevent grep pipefail from killing tarball release uploads - #2786

Merged
louisgv merged 1 commit into
OpenRouterLabs:mainfrom
AhmedTMM:fix/tarball-grep-pipefail
Mar 19, 2026
Merged

fix: prevent grep pipefail from killing tarball release uploads#2786
louisgv merged 1 commit into
OpenRouterLabs:mainfrom
AhmedTMM:fix/tarball-grep-pipefail

Conversation

@AhmedTMM

Copy link
Copy Markdown
Collaborator

Summary

  • Wraps grep in { grep ... || true; } in the old-asset cleanup pipeline
  • grep returns exit 1 when no matches are found, which with set -eo pipefail kills the entire release step before gh release upload runs

Root cause

The cleanup step deletes stale tarballs before uploading the new one:

gh release view ... | grep "spawn-agent-NAME-ARCH-" | while read old; do delete; done

When there are no old assets to clean up, grep exits 1 → pipefail kills the step → tarball never uploads.

This has caused all arm64 builds to fail nightly (5 consecutive days of failures).

Test plan

  • Trigger agent-tarballs workflow after merge — all jobs should pass

🤖 Generated with Claude Code

The old-asset cleanup pipeline `gh release view | grep | while` fails
when grep finds no matches (exit 1) and pipefail is set. This kills
the entire step before gh release upload runs.

Fix: wrap grep in `{ grep ... || true; }` so no-match is not fatal.

This caused all arm64 builds and some x86_64 builds to fail nightly.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

@louisgv louisgv left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Security Review

Verdict: APPROVED
Commit: a762ce2

Findings

None. The change is secure and correct.

Analysis

  • Variable injection: AGENT_NAME and ARCH are both safe (validated alphanumeric from matrix, no user input)
  • Command injection: No new command execution introduced
  • Logic correctness: Properly handles grep exit 1 (no matches) without breaking pipefail for real errors
  • Pattern safety: Subshell { grep ... || true; } is the correct way to suppress grep's exit status

Tests

  • bash -n: PASS (workflow syntax valid)
  • bun test: N/A (workflow-only change)
  • Pattern validation: PASS (tested in isolation, works correctly)

-- security/pr-reviewer

@louisgv louisgv added the security-approved Security review approved label Mar 19, 2026
@louisgv
louisgv merged commit 5a23982 into OpenRouterLabs:main Mar 19, 2026
6 checks passed
@AhmedTMM
AhmedTMM deleted the fix/tarball-grep-pipefail branch April 7, 2026 00:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

security-approved Security review approved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants