Skip to content

fix: handle du exit code for missing paths in sandbox script (Issue #57)#58

Merged
konard merged 3 commits intomainfrom
issue-57-3b7cfd0944e2
Feb 26, 2026
Merged

fix: handle du exit code for missing paths in sandbox script (Issue #57)#58
konard merged 3 commits intomainfrom
issue-57-3b7cfd0944e2

Conversation

@konard
Copy link
Member

@konard konard commented Feb 26, 2026

Summary

Fixes #57 — CI/CD "Measure Disk Space and Update README" fails with exit code 1 after the Issue #55 fix.

Root Cause

The Issue #55 fix changed Homebrew and Rust measurement to use du -sb on specific directories. When Homebrew installation fails (sandbox user cannot use sudo non-interactively), install_homebrew() returns 0 (due to || true), so the success branch runs. But then:

brew_bytes=$(du -sb /home/linuxbrew/.linuxbrew "$HOME/.linuxbrew" 2>/dev/null | awk ...)

$HOME/.linuxbrew doesn't exist → du exits with code 1set -euo pipefail kills the entire sandbox sub-script → CI step fails.

The 2>/dev/null suppresses the error message but not the exit code. This is the regression.

Fix

Before calling du, build an array of only the paths that actually exist:

brew_paths=()
[[ -d /home/linuxbrew/.linuxbrew ]] && brew_paths+=(/home/linuxbrew/.linuxbrew)
[[ -d "$HOME/.linuxbrew" ]] && brew_paths+=("$HOME/.linuxbrew")
if [[ ${#brew_paths[@]} -gt 0 ]]; then
  brew_bytes=$(du -sb "${brew_paths[@]}" 2>/dev/null | awk '{sum+=$1} END{print sum+0}')
else
  brew_bytes=0
fi

Applied to both Homebrew and Rust du-based measurements in the sandbox sub-script.

Files Changed

  • scripts/measure-disk-space.sh — fix du to only measure existing paths
  • docs/case-studies/issue-57/CASE-STUDY.md — full root cause analysis, timeline, reproducers
  • docs/case-studies/issue-57/ci-job-64665886012.txt — CI failure log preserved

Verification

Local test confirms:

  • Old code: du -sb /nonexistent 2>/dev/null → exit code 1 → kills script
  • New code: only passes existing paths → never fails on missing dirs

This PR was created automatically by the AI issue solver

Adding CLAUDE.md with task information for AI processing.
This file will be removed when the task is complete.

Issue: #57
@konard konard self-assigned this Feb 26, 2026
Root cause: The Issue #55 fix switched Homebrew and Rust measurement to
use `du -sb` instead of `df` deltas. When Homebrew installation fails
(sandbox user has no NOPASSWD sudo for brew installer), `install_homebrew`
returns 0 (due to `|| true`) so the success branch is taken. However
`du -sb ... "$HOME/.linuxbrew"` exits with code 1 when `$HOME/.linuxbrew`
doesn't exist, and `set -euo pipefail` kills the entire sandbox sub-script
even though stderr is redirected with `2>/dev/null`.

Fix: Before calling `du`, build an array of only the paths that actually
exist, then conditionally call `du` only when at least one path exists.
Applied to both Rust (`.rustup`/`.cargo`) and Homebrew (`linuxbrew`
prefix paths) measurements.

Also adds docs/case-studies/issue-57/ with CASE-STUDY.md, CI log, and
timeline reconstruction of the regression.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@konard konard changed the title [WIP] We have CI/CD failed fix: handle du exit code for missing paths in sandbox script (Issue #57) Feb 26, 2026
@konard konard marked this pull request as ready for review February 26, 2026 11:34
@konard
Copy link
Member Author

konard commented Feb 26, 2026

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Public pricing estimate: $3.562345
  • Calculated by Anthropic: $3.155418 USD
  • Difference: $-0.406927 (-11.42%)
    📎 Log file uploaded as Gist (2732KB)
    🔗 View complete solution draft log

Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Member Author

konard commented Feb 26, 2026

✅ Ready to merge

This pull request is now ready to be merged:

  • All CI checks have passed
  • No merge conflicts
  • No pending changes

Monitored by hive-mind with --auto-restart-until-mergeable flag

@konard konard merged commit b7462ab into main Feb 26, 2026
19 checks passed
konard added a commit that referenced this pull request Feb 26, 2026
Not intended for the main codebase. Follows same pattern as PR #58.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
konard added a commit that referenced this pull request Mar 2, 2026
… releases

Analysis of why v1.3.11 was never released after PR #58 merged, and why
the manual workflow_dispatch created v1.3.12 instead of retrying v1.3.11.

Root causes identified:
1. Transient network timeouts on GitHub-hosted runners caused the push-triggered
   build for v1.3.11 to fail (ghcr.io/Docker Hub connectivity issues)
2. GITHUB_TOKEN-based pushes (from apply-changesets) don't trigger new on:push
   workflows — so when the build fails, there is no automatic retry path
3. No release-only workflow_dispatch mode — bump-and-release always creates
   extra version increment

Includes full CI logs for both relevant workflow runs, timeline reconstruction,
root cause analysis, online research, and proposed solutions.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.

We have CI/CD failed

1 participant