Skip to content

fix(ci): prevent setup-env BASH_ENV self-source recursion - #375

Merged
c-vigo merged 1 commit into
release/0.3.1from
bugfix/374-release-0-3-1-rc4-failed-rollback
Mar 19, 2026
Merged

c-vigo merged 1 commit into
release/0.3.1from
bugfix/374-release-0-3-1-rc4-failed-rollback

Conversation

@c-vigo

@c-vigo c-vigo commented Mar 19, 2026

Copy link
Copy Markdown
Contributor

Description

Fixes a release pipeline regression where setup-env could crash with exit 139 when invoked multiple times in the same job.
The retry-helper BASH_ENV merge now avoids self-referencing recursion, and changelogs are updated for issue tracking on release 0.3.1.

Type of Change

  • feat -- New feature
  • fix -- Bug fix
  • docs -- Documentation only
  • chore -- Maintenance task (deps, config, etc.)
  • refactor -- Code restructuring (no behavior change)
  • test -- Adding or updating tests
  • ci -- CI/CD pipeline changes
  • build -- Build system or dependency changes
  • revert -- Reverts a previous commit
  • style -- Code style (formatting, whitespace)

Modifiers

  • Breaking change (!) -- This change breaks backward compatibility

Changes Made

  • .github/actions/setup-env/action.yml
    • Add guard to skip retry-helper merge when PREV_BASH_ENV already equals RETRY_HELPER
    • Prevent setup-env-retry.sh from sourcing itself recursively on repeated setup invocations
  • CHANGELOG.md
    • Add Fixed entry for issue #374 in ## [0.3.1] - TBD
  • assets/workspace/.devcontainer/CHANGELOG.md
    • Sync mirrored changelog entry for issue #374

Changelog Entry

Fixed

  • Release setup-env no longer self-sources retry helper via BASH_ENV (#374)
    • Guard the retry-helper merge logic in .github/actions/setup-env/action.yml to skip merging when PREV_BASH_ENV already equals RETRY_HELPER
    • Prevent infinite source recursion and exit 139 crashes when setup-env is invoked multiple times in one job

Testing

  • Tests pass locally (just test)
  • Manual testing performed (describe below)

Manual Testing Details

N/A

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly (edit docs/templates/, then run just docs)
  • I have updated CHANGELOG.md in the [Unreleased] section (and pasted the entry above)
  • My changes generate no new warnings or errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published

Additional Notes

This addresses a regression chain related to the earlier uv sync stabilization work in #370/#371; root cause and implementation plan were documented on issue #374 comments before this patch.

Refs: #374, #370

@c-vigo c-vigo self-assigned this Mar 19, 2026
@c-vigo
c-vigo requested a review from Copilot March 19, 2026 13:42

Copilot AI 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.

Pull request overview

This PR fixes a CI regression in the shared setup-env composite action where repeated invocations in the same job could cause the retry-helper BASH_ENV script to recursively source itself and crash (exit 139), and it records the fix in the 0.3.1 changelog.

Changes:

  • Add a guard in .github/actions/setup-env/action.yml to avoid merging BASH_ENV when it already points at the retry-helper script (preventing self-source recursion).
  • Add a 0.3.1 “Fixed” changelog entry for issue #374 in CHANGELOG.md.
  • Sync the same changelog entry into assets/workspace/.devcontainer/CHANGELOG.md.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
.github/actions/setup-env/action.yml Prevents BASH_ENV merge logic from self-referencing the retry-helper script on repeated runs.
CHANGELOG.md Documents the fix for #374 under the 0.3.1 “Fixed” section.
assets/workspace/.devcontainer/CHANGELOG.md Mirrors the changelog update for the workspace/devcontainer template copy.
Comments suppressed due to low confidence (1)

.github/actions/setup-env/action.yml:208

  • When PREV_BASH_ENV == RETRY_HELPER the merge is skipped, but the helper file was already overwritten earlier in the step (cat > "$RETRY_HELPER"). This means any original job-provided BASH_ENV that was merged on the first invocation can be lost after a second setup-env run in the same job. Consider persisting the original BASH_ENV in a separate env var (written once to $GITHUB_ENV) and always sourcing that, or merging from a saved copy of the previous helper to avoid both recursion and dropping prior content.
        if [ -n "$PREV_BASH_ENV" ] && [ -f "$PREV_BASH_ENV" ] && [ "$PREV_BASH_ENV" != "$RETRY_HELPER" ]; then
          {
            echo "source \"$PREV_BASH_ENV\""
            cat "$RETRY_HELPER"
          } > "${RETRY_HELPER}.merged"

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@c-vigo
c-vigo merged commit 938aa4d into release/0.3.1 Mar 19, 2026
16 checks passed
@c-vigo
c-vigo deleted the bugfix/374-release-0-3-1-rc4-failed-rollback branch March 19, 2026 13:52
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.

2 participants