fix: Windows daemon hanging - replace sys.exit() with return in _star… #1022
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "🔄 UV Self-Downgrades → Auto-Revert" | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: ['development'] | |
| jobs: | |
| uv-revert-test: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: 🏁 Checkout code | |
| uses: actions/checkout@v4 | |
| - name: 🐍 Set up Python 3.11 | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: 🔧 Install Redis for omnipkg | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y redis-server | |
| sudo systemctl start redis-server | |
| redis-cli ping | |
| - name: 📦 Install omnipkg | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -e . | |
| - name: ⚙️ Configure omnipkg for non-interactive use | |
| run: | | |
| python - << 'EOF' | |
| import sys | |
| import site | |
| import json | |
| from pathlib import Path | |
| import os | |
| site_packages_path = site.getsitepackages()[0] | |
| python_executable_path = sys.executable | |
| project_root = Path(os.environ['GITHUB_WORKSPACE']) | |
| config_data = { | |
| 'site_packages_path': site_packages_path, | |
| 'multiversion_base': str(Path(site_packages_path) / '.omnipkg_versions'), | |
| 'python_executable': python_executable_path, | |
| 'builder_script_path': str(project_root / 'omnipkg' / 'package_meta_builder.py'), | |
| 'redis_host': 'localhost', | |
| 'redis_port': 6379, | |
| 'redis_key_prefix': 'omnipkg:pkg:', | |
| 'paths_to_index': [str(Path(python_executable_path).parent), '/usr/local/bin', '/usr/bin', '/bin', '/usr/sbin', '/sbin'], | |
| 'auto_cleanup': True, | |
| 'cleanup_threshold_days': 30 | |
| } | |
| config_dir = Path.home() / '.config' / 'omnipkg' | |
| config_dir.mkdir(parents=True, exist_ok=True) | |
| config_path = config_dir / 'config.json' | |
| with open(config_path, 'w') as f: | |
| json.dump(config_data, f, indent=2) | |
| print(f'omnipkg config created at {config_path}:') | |
| print(json.dumps(config_data, indent=2)) | |
| EOF | |
| - name: 🚀 Install uv (latest) using omnipkg - Establish "Good State" | |
| id: install_uv_latest | |
| run: | | |
| echo "--- Installing uv (latest) with omnipkg to establish a 'good state' with snapshot ---" | |
| # FIX: Removed '-y'. Omnipkg detects CI environment automatically (see logs), | |
| # and '-y' was raising "unrecognized arguments". | |
| omnipkg install uv==0.8.13 2>&1 | tee /tmp/initial_uv_install_output.txt | |
| # PIPESTATUS[0] captures the exit code of omnipkg, not tee. | |
| if [ ${PIPESTATUS[0]} -ne 0 ]; then | |
| echo "omnipkg_install_uv_success=false" >> $GITHUB_OUTPUT | |
| exit 1 | |
| fi | |
| echo "Initial uv version (omnipkg-installed):" | tee /tmp/initial_uv_version.txt | |
| uv --version | tee -a /tmp/initial_uv_version.txt | |
| echo "omnipkg status after installing uv:" | tee -a /tmp/initial_uv_version.txt | |
| # Use --non-interactive instead of a pipe | |
| omnipkg status --non-interactive | tee -a /tmp/initial_uv_version.txt | |
| echo "omnipkg snapshot created - now we can revert uv's self-sabotage!" | |
| - name: 💥 Force UV to Downgrade Itself (with --system) | |
| id: uv_self_downgrade | |
| run: | | |
| echo "--- Forcing uv to downgrade itself to 0.7.13 using 'uv pip install --system' ---" | |
| echo "Note: Using --system to allow uv to operate within this non-uv-managed virtual environment." | |
| uv pip install uv==0.7.13 --system > /tmp/uv_downgrade_output.txt 2>&1 | |
| UV_EXIT_CODE=$? | |
| echo "UV_EXIT_CODE=$UV_EXIT_CODE" >> $GITHUB_OUTPUT | |
| if [ $UV_EXIT_CODE -eq 0 ]; then | |
| echo "downgrade_outcome=success" >> $GITHUB_OUTPUT | |
| echo "uv self-downgraded successfully." | |
| echo "Current uv version (after uv's operation):" | tee -a /tmp/uv_downgrade_output.txt | |
| uv --version | tee -a /tmp/uv_downgrade_output.txt || true | |
| else | |
| echo "downgrade_outcome=failure" >> $GITHUB_OUTPUT | |
| echo "uv self-downgrade failed unexpectedly. Review output." | |
| ERROR_MSG=$(grep -Eo 'error: No virtual environment found|failed to hardlink files|permission denied|Error: Process completed with exit code [0-9]+' /tmp/uv_downgrade_output.txt | head -n 1) | |
| echo "uv_error_message=$ERROR_MSG" >> $GITHUB_OUTPUT | |
| fi | |
| echo "Full output from uv self-downgrade attempt captured to /tmp/uv_downgrade_output.txt" | |
| cat /tmp/uv_downgrade_output.txt | |
| - name: 🚑 Run omnipkg Revert (Regardless of UV's Previous Outcome) | |
| id: omnipkg_revert | |
| run: | | |
| echo "--- Running omnipkg revert to restore good state (omnipkg can recover from other tools' actions) ---" | |
| omnipkg revert --yes | |
| if [ $? -eq 0 ]; then | |
| echo "revert_success=true" >> $GITHUB_OUTPUT | |
| echo "omnipkg revert completed successfully." | |
| else | |
| echo "revert_success=false" >> $GITHUB_OUTPUT | |
| echo "omnipkg revert failed. See logs for details." | |
| exit 1 | |
| fi | |
| - name: ✅ Verify Final UV Version After Revert | |
| if: steps.omnipkg_revert.outputs.revert_success == 'true' | |
| run: | | |
| echo "--- Verifying UV version after omnipkg revert ---" | tee /tmp/final_uv_version.txt | |
| uv --version | tee -a /tmp/final_uv_version.txt || echo "uv command not found or failed after revert." | tee -a /tmp/final_uv_version.txt | |
| echo "--- omnipkg status after revert ---" | tee -a /tmp/final_uv_version.txt | |
| omnipkg status --non-interactive | tee -a /tmp/final_uv_version.txt | |
| echo "--- omnipkg info uv after revert ---" | tee -a /tmp/final_uv_version.txt | |
| # Use positional argument '1' and --non-interactive | |
| omnipkg info uv 1 --non-interactive | tee -a /tmp/final_uv_version.txt | |
| - name: 📊 Generate Report | |
| if: always() | |
| run: | | |
| REPORT_FILE="uv_revert_test_report.md" | |
| echo "# 🚨 UV Self-Downgrade & omnipkg Revert Test Report" > $REPORT_FILE | |
| echo "" >> $REPORT_FILE | |
| echo "**Workflow Run:** [${{ github.run_id }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})" >> $REPORT_FILE | |
| echo "**Test Status:** \`${{ job.status }}\`" >> $REPORT_FILE | |
| echo "" >> $REPORT_FILE | |
| echo "## Test Scenario" >> $REPORT_FILE | |
| echo "\`\`\`bash" >> $REPORT_FILE | |
| echo "# 1. Install uv (latest) using omnipkg to establish 'good state'" >> $REPORT_FILE | |
| echo "omnipkg install uv" >> $REPORT_FILE | |
| echo "" >> $REPORT_FILE | |
| echo "# 2. Force uv to downgrade itself using 'uv pip install --system'" >> $REPORT_FILE | |
| echo "uv pip install uv==0.7.13 --system" >> $REPORT_FILE | |
| echo "" >> $REPORT_FILE | |
| echo "# 3. Run omnipkg revert to restore environment" >> $REPORT_FILE | |
| echo "omnipkg revert --yes" >> $REPORT_FILE | |
| echo "\`\`\`" >> $REPORT_FILE | |
| echo "" >> $REPORT_FILE | |
| echo "## Initial State (omnipkg-installed UV)" >> $REPORT_FILE | |
| echo "\`\`\`" >> $REPORT_FILE | |
| cat /tmp/initial_uv_install_output.txt 2>/dev/null || echo 'N/A: Initial UV install output missing.' >> $REPORT_FILE | |
| echo "---" >> $REPORT_FILE | |
| cat /tmp/initial_uv_version.txt 2>/dev/null || echo 'N/A: Initial UV version check failed.' >> $REPORT_FILE | |
| echo "\`\`\`" >> $REPORT_FILE | |
| echo "" >> $REPORT_FILE | |
| echo "## UV Self-Downgrade Attempt Result (via \`uv pip install --system\`)" >> $REPORT_FILE | |
| echo "\`\`\`" >> $REPORT_FILE | |
| cat /tmp/uv_downgrade_output.txt 2>/dev/null || echo 'N/A: UV downgrade attempt output missing.' >> $REPORT_FILE | |
| echo "\`\`\`" >> $REPORT_FILE | |
| echo "**UV Downgrade Attempt Outcome (uv's own operation):** \`${{ steps.uv_self_downgrade.outputs.downgrade_outcome }}\`" >> $REPORT_FILE | |
| if [ "${{ steps.uv_self_downgrade.outputs.downgrade_outcome }}" == "success" ]; then | |
| echo "**Note:** \`uv\` successfully self-downgraded in this standard virtual environment by explicitly using the \`--system\` flag, demonstrating its ability to modify the environment. \`omnipkg\` then proceeds to revert this change." >> $REPORT_FILE | |
| else | |
| echo "**Insight:** Even with \`--system\`, \`uv\` encountered an unexpected issue trying to operate within this standard environment (Error: \`${{ steps.uv_self_downgrade.outputs.uv_error_message }}\`). This still underscores \`omnipkg\`'s superior adaptability, as \`omnipkg\` will still attempt to recover the environment, highlighting its robustness where other tools might fail or act unpredictably." >> $REPORT_FILE | |
| fi | |
| echo "" >> $REPORT_FILE | |
| echo "## omnipkg Revert Result (and Final State)" >> $REPORT_FILE | |
| echo "\`\`\`" >> $REPORT_FILE | |
| cat /tmp/final_uv_version.txt 2>/dev/null || echo 'N/A: Final UV verification output missing.' >> $REPORT_FILE | |
| echo "\`\`\`" >> $REPORT_FILE | |
| echo "**omnipkg Revert Operation Outcome:** \`${{ steps.omnipkg_revert.outcome }}\`" >> $REPORT_FILE | |
| echo "" >> $REPORT_FILE | |
| if [ "${{ job.status }}" == "success" ]; then | |
| echo "### Conclusion" >> $REPORT_FILE | |
| echo "✅ **omnipkg successfully restored the environment to its last known good state, effectively reversing the \`uv\` self-downgrade (or demonstrating recovery from its operational challenges).** This test highlights \`omnipkg\`'s unparalleled ability to maintain environment integrity and provide robust recovery, even when faced with the specific operational modes of other package managers." >> $REPORT_FILE | |
| else | |
| echo "### Conclusion" >> $REPORT_FILE | |
| echo "❌ The \`omnipkg\` revert test failed. Review workflow logs for details." >> $REPORT_FILE | |
| fi | |
| - name: 📤 Upload Report Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: uv-revert-test-report | |
| path: uv_revert_test_report.md | |
| retention-days: 30 |