mirror of
https://github.com/meta-llama/llama-stack.git
synced 2025-12-03 09:53:45 +00:00
## Summary Cherry-picks 5 critical fixes from main to the release-0.3.x branch for the v0.3.1 release, plus CI workflow updates. **Note**: This recreates the cherry-picks from the closed PR #3991, now targeting the renamed `release-0.3.x` branch (previously `release-0.3.x-maint`). ## Commits 1. **2c56a8560** - fix(context): prevent provider data leak between streaming requests (#3924) - **CRITICAL SECURITY FIX**: Prevents provider credentials from leaking between requests - Fixed import path for 0.3.0 compatibility 2. **ddd32b187** - fix(inference): enable routing of models with provider_data alone (#3928) - Enables routing for fully qualified model IDs with provider_data - Resolved merge conflicts, adapted for 0.3.0 structure 3. **f7c2973aa** - fix: Avoid BadRequestError due to invalid max_tokens (#3667) - Fixes failures with Gemini and other providers that reject max_tokens=0 - Non-breaking API change 4. **d7f9da616** - fix(responses): sync conversation before yielding terminal events in streaming (#3888) - Ensures conversation sync executes even when streaming consumers break early 5. **0ffa8658b** - fix(logging): ensure logs go to stderr, loggers obey levels (#3885) - Fixes logging infrastructure 6. **75b49cb3c** - ci: support release branches and match client branch (#3990) - Updates CI workflows to support release-X.Y.x branches - Matches client branch from llama-stack-client-python for release testing - Fixes artifact name collisions ## Adaptations for 0.3.0 - Fixed import paths: `llama_stack.core.telemetry.tracing` → `llama_stack.providers.utils.telemetry.tracing` - Fixed import paths: `llama_stack.core.telemetry.telemetry` → `llama_stack.apis.telemetry` - Changed `self.telemetry_enabled` → `self.telemetry` (0.3.0 attribute name) - Removed `rerank()` method that doesn't exist in 0.3.0 ## Testing All imports verified and tests should pass once CI is set up.
113 lines
3.9 KiB
YAML
113 lines
3.9 KiB
YAML
name: Pre-commit
|
|
|
|
run-name: Run pre-commit checks
|
|
|
|
on:
|
|
pull_request:
|
|
push:
|
|
branches:
|
|
- main
|
|
- 'release-[0-9]+.[0-9]+.x'
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_id || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
pre-commit:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
|
with:
|
|
# For dependabot PRs, we need to checkout with a token that can push changes
|
|
token: ${{ github.actor == 'dependabot[bot]' && secrets.GITHUB_TOKEN || github.token }}
|
|
# Fetch full history for dependabot PRs to allow commits
|
|
fetch-depth: ${{ github.actor == 'dependabot[bot]' && 0 || 1 }}
|
|
|
|
- name: Set up Python
|
|
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
|
|
with:
|
|
python-version: '3.12'
|
|
cache: pip
|
|
cache-dependency-path: |
|
|
**/requirements*.txt
|
|
.pre-commit-config.yaml
|
|
|
|
- name: Set up Node.js
|
|
uses: actions/setup-node@2028fbc5c25fe9cf00d9f06a71cc4710d4507903 # v6.0.0
|
|
with:
|
|
node-version: '20'
|
|
cache: 'npm'
|
|
cache-dependency-path: 'llama_stack/ui/'
|
|
|
|
- name: Install npm dependencies
|
|
run: npm ci
|
|
working-directory: llama_stack/ui
|
|
|
|
- name: Run pre-commit
|
|
id: precommit
|
|
uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
|
|
continue-on-error: true
|
|
env:
|
|
SKIP: no-commit-to-branch
|
|
RUFF_OUTPUT_FORMAT: github
|
|
|
|
- name: Check pre-commit results
|
|
if: steps.precommit.outcome == 'failure'
|
|
run: |
|
|
echo "::error::Pre-commit hooks failed. Please run 'pre-commit run --all-files' locally and commit the fixes."
|
|
echo "::warning::Some pre-commit hooks failed. Check the output above for details."
|
|
exit 1
|
|
|
|
- name: Debug
|
|
run: |
|
|
echo "github.ref: ${{ github.ref }}"
|
|
echo "github.actor: ${{ github.actor }}"
|
|
|
|
- name: Commit changes for dependabot PRs
|
|
if: github.actor == 'dependabot[bot]'
|
|
run: |
|
|
if ! git diff --exit-code || [ -n "$(git ls-files --others --exclude-standard)" ]; then
|
|
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
|
git config --local user.name "github-actions[bot]"
|
|
|
|
# Ensure we're on the correct branch
|
|
git checkout -B ${{ github.head_ref }}
|
|
git add -A
|
|
git commit -m "Apply pre-commit fixes"
|
|
|
|
# Pull latest changes from the PR branch and rebase our commit on top
|
|
git pull --rebase origin ${{ github.head_ref }}
|
|
|
|
# Push to the PR branch
|
|
git push origin ${{ github.head_ref }}
|
|
echo "Pre-commit fixes committed and pushed"
|
|
else
|
|
echo "No changes to commit"
|
|
fi
|
|
|
|
- name: Verify no uncommitted changes
|
|
if: github.actor != 'dependabot[bot]'
|
|
run: |
|
|
if ! git diff --exit-code; then
|
|
echo "::error::There are uncommitted changes after pre-commit. Please run 'pre-commit run --all-files' locally and commit the fixes."
|
|
echo "::warning::Files with changes:"
|
|
git diff --name-status
|
|
exit 1
|
|
fi
|
|
|
|
- name: Verify if there are any new files after pre-commit
|
|
if: github.actor != 'dependabot[bot]'
|
|
run: |
|
|
unstaged_files=$(git ls-files --others --exclude-standard)
|
|
if [ -n "$unstaged_files" ]; then
|
|
echo "::error::There are new untracked files after pre-commit. Please run 'pre-commit run --all-files' locally and commit the fixes."
|
|
echo "::warning::New files:"
|
|
echo "$unstaged_files"
|
|
exit 1
|
|
fi
|