Skip to content

Commit cd5bef1

Browse files
authored
Merge branch 'main' into dead_code_removal
2 parents 8809a34 + 696fefb commit cd5bef1

File tree

927 files changed

+175696
-106537
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

927 files changed

+175696
-106537
lines changed

.github/CODEOWNERS

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
# These owners will be the default owners for everything in
44
# the repo. Unless a later match takes precedence,
5-
* @ashwinb @yanxi0830 @hardikjshah @raghotham @ehhuang @terrytangyuan @leseb @bbrowning @reluctantfuturist @mattf @slekkala1
5+
* @ashwinb @yanxi0830 @hardikjshah @raghotham @ehhuang @terrytangyuan @leseb @bbrowning @reluctantfuturist @mattf @slekkala1 @franciscojavierarceo

.github/TRIAGERS.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
11
# This file documents Triage members in the Llama Stack community
2-
@franciscojavierarceo

.github/workflows/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Llama Stack uses GitHub Actions for Continuous Integration (CI). Below is a tabl
1212
| Integration Tests (Replay) | [integration-tests.yml](integration-tests.yml) | Run the integration test suites from tests/integration in replay mode |
1313
| Vector IO Integration Tests | [integration-vector-io-tests.yml](integration-vector-io-tests.yml) | Run the integration test suite with various VectorIO providers |
1414
| Pre-commit | [pre-commit.yml](pre-commit.yml) | Run pre-commit checks |
15+
| Pre-commit Bot | [precommit-trigger.yml](precommit-trigger.yml) | Pre-commit bot for PR |
1516
| Test Llama Stack Build | [providers-build.yml](providers-build.yml) | Test llama stack build |
1617
| Python Package Build Test | [python-build-test.yml](python-build-test.yml) | Test building the llama-stack PyPI project |
1718
| Integration Tests (Record) | [record-integration-tests.yml](record-integration-tests.yml) | Run the integration test suite from tests/integration |

.github/workflows/integration-auth-tests.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,8 @@ jobs:
8484
yq eval '.server.auth.provider_config.jwks.token = "${{ env.TOKEN }}"' -i $run_dir/run.yaml
8585
cat $run_dir/run.yaml
8686
87+
# avoid line breaks in the server log, especially because we grep it below.
88+
export COLUMNS=1984
8789
nohup uv run llama stack run $run_dir/run.yaml --image-type venv > server.log 2>&1 &
8890
8991
- name: Wait for Llama Stack server to be ready

.github/workflows/integration-tests.yml

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,27 @@ jobs:
4242

4343
run-replay-mode-tests:
4444
runs-on: ubuntu-latest
45-
name: ${{ format('Integration Tests ({0}, {1}, {2}, client={3}, {4})', matrix.client-type, matrix.setup, matrix.python-version, matrix.client-version, matrix.suite) }}
45+
name: ${{ format('Integration Tests ({0}, {1}, {2}, client={3}, {4})', matrix.client-type, matrix.config.setup, matrix.python-version, matrix.client-version, matrix.config.suite) }}
4646

4747
strategy:
4848
fail-fast: false
4949
matrix:
5050
client-type: [library, server]
51-
# Use vllm on weekly schedule, otherwise use test-setup input (defaults to ollama)
52-
setup: ${{ (github.event.schedule == '1 0 * * 0') && fromJSON('["vllm"]') || fromJSON(format('["{0}"]', github.event.inputs.test-setup || 'ollama')) }}
5351
# Use Python 3.13 only on nightly schedule (daily latest client test), otherwise use 3.12
5452
python-version: ${{ github.event.schedule == '0 0 * * *' && fromJSON('["3.12", "3.13"]') || fromJSON('["3.12"]') }}
5553
client-version: ${{ (github.event.schedule == '0 0 * * *' || github.event.inputs.test-all-client-versions == 'true') && fromJSON('["published", "latest"]') || fromJSON('["latest"]') }}
56-
suite: [base, vision]
54+
# Define (setup, suite) pairs - they are always matched and cannot be independent
55+
# Weekly schedule (Sun 1 AM): vllm+base
56+
# Input test-setup=ollama-vision: ollama-vision+vision
57+
# Default (including test-setup=ollama): both ollama+base and ollama-vision+vision
58+
config: >-
59+
${{
60+
github.event.schedule == '1 0 * * 0'
61+
&& fromJSON('[{"setup": "vllm", "suite": "base"}]')
62+
|| github.event.inputs.test-setup == 'ollama-vision'
63+
&& fromJSON('[{"setup": "ollama-vision", "suite": "vision"}]')
64+
|| fromJSON('[{"setup": "ollama", "suite": "base"}, {"setup": "ollama-vision", "suite": "vision"}]')
65+
}}
5766
5867
steps:
5968
- name: Checkout repository
@@ -64,14 +73,14 @@ jobs:
6473
with:
6574
python-version: ${{ matrix.python-version }}
6675
client-version: ${{ matrix.client-version }}
67-
setup: ${{ matrix.setup }}
68-
suite: ${{ matrix.suite }}
76+
setup: ${{ matrix.config.setup }}
77+
suite: ${{ matrix.config.suite }}
6978
inference-mode: 'replay'
7079

7180
- name: Run tests
7281
uses: ./.github/actions/run-and-record-tests
7382
with:
7483
stack-config: ${{ matrix.client-type == 'library' && 'ci-tests' || 'server:ci-tests' }}
75-
setup: ${{ matrix.setup }}
84+
setup: ${{ matrix.config.setup }}
7685
inference-mode: 'replay'
77-
suite: ${{ matrix.suite }}
86+
suite: ${{ matrix.config.suite }}
Lines changed: 227 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,227 @@
1+
name: Pre-commit Bot
2+
3+
run-name: Pre-commit bot for PR #${{ github.event.issue.number }}
4+
5+
on:
6+
issue_comment:
7+
types: [created]
8+
9+
jobs:
10+
pre-commit:
11+
# Only run on pull request comments
12+
if: github.event.issue.pull_request && contains(github.event.comment.body, '@github-actions run precommit')
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: write
16+
pull-requests: write
17+
18+
steps:
19+
- name: Check comment author and get PR details
20+
id: check_author
21+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
22+
with:
23+
github-token: ${{ secrets.GITHUB_TOKEN }}
24+
script: |
25+
// Get PR details
26+
const pr = await github.rest.pulls.get({
27+
owner: context.repo.owner,
28+
repo: context.repo.repo,
29+
pull_number: context.issue.number
30+
});
31+
32+
// Check if commenter has write access or is the PR author
33+
const commenter = context.payload.comment.user.login;
34+
const prAuthor = pr.data.user.login;
35+
36+
let hasPermission = false;
37+
38+
// Check if commenter is PR author
39+
if (commenter === prAuthor) {
40+
hasPermission = true;
41+
console.log(`Comment author ${commenter} is the PR author`);
42+
} else {
43+
// Check if commenter has write/admin access
44+
try {
45+
const permission = await github.rest.repos.getCollaboratorPermissionLevel({
46+
owner: context.repo.owner,
47+
repo: context.repo.repo,
48+
username: commenter
49+
});
50+
51+
const level = permission.data.permission;
52+
hasPermission = ['write', 'admin', 'maintain'].includes(level);
53+
console.log(`Comment author ${commenter} has permission: ${level}`);
54+
} catch (error) {
55+
console.log(`Could not check permissions for ${commenter}: ${error.message}`);
56+
}
57+
}
58+
59+
if (!hasPermission) {
60+
await github.rest.issues.createComment({
61+
owner: context.repo.owner,
62+
repo: context.repo.repo,
63+
issue_number: context.issue.number,
64+
body: `❌ @${commenter} You don't have permission to trigger pre-commit. Only PR authors or repository collaborators can run this command.`
65+
});
66+
core.setFailed(`User ${commenter} does not have permission`);
67+
return;
68+
}
69+
70+
// Save PR info for later steps
71+
core.setOutput('pr_number', context.issue.number);
72+
core.setOutput('pr_head_ref', pr.data.head.ref);
73+
core.setOutput('pr_head_sha', pr.data.head.sha);
74+
core.setOutput('pr_head_repo', pr.data.head.repo.full_name);
75+
core.setOutput('pr_base_ref', pr.data.base.ref);
76+
core.setOutput('is_fork', pr.data.head.repo.full_name !== context.payload.repository.full_name);
77+
core.setOutput('authorized', 'true');
78+
79+
- name: React to comment
80+
if: steps.check_author.outputs.authorized == 'true'
81+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
82+
with:
83+
github-token: ${{ secrets.GITHUB_TOKEN }}
84+
script: |
85+
await github.rest.reactions.createForIssueComment({
86+
owner: context.repo.owner,
87+
repo: context.repo.repo,
88+
comment_id: context.payload.comment.id,
89+
content: 'rocket'
90+
});
91+
92+
- name: Comment starting
93+
if: steps.check_author.outputs.authorized == 'true'
94+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
95+
with:
96+
github-token: ${{ secrets.GITHUB_TOKEN }}
97+
script: |
98+
await github.rest.issues.createComment({
99+
owner: context.repo.owner,
100+
repo: context.repo.repo,
101+
issue_number: ${{ steps.check_author.outputs.pr_number }},
102+
body: `⏳ Running pre-commit hooks on PR #${{ steps.check_author.outputs.pr_number }}...`
103+
});
104+
105+
- name: Checkout PR branch (same-repo)
106+
if: steps.check_author.outputs.authorized == 'true' && steps.check_author.outputs.is_fork == 'false'
107+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
108+
with:
109+
ref: ${{ steps.check_author.outputs.pr_head_ref }}
110+
fetch-depth: 0
111+
token: ${{ secrets.GITHUB_TOKEN }}
112+
113+
- name: Checkout PR branch (fork)
114+
if: steps.check_author.outputs.authorized == 'true' && steps.check_author.outputs.is_fork == 'true'
115+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
116+
with:
117+
repository: ${{ steps.check_author.outputs.pr_head_repo }}
118+
ref: ${{ steps.check_author.outputs.pr_head_ref }}
119+
fetch-depth: 0
120+
token: ${{ secrets.GITHUB_TOKEN }}
121+
122+
- name: Verify checkout
123+
if: steps.check_author.outputs.authorized == 'true'
124+
run: |
125+
echo "Current SHA: $(git rev-parse HEAD)"
126+
echo "Expected SHA: ${{ steps.check_author.outputs.pr_head_sha }}"
127+
if [[ "$(git rev-parse HEAD)" != "${{ steps.check_author.outputs.pr_head_sha }}" ]]; then
128+
echo "::error::Checked out SHA does not match expected SHA"
129+
exit 1
130+
fi
131+
132+
- name: Set up Python
133+
if: steps.check_author.outputs.authorized == 'true'
134+
uses: actions/setup-python@e797f83bcb11b83ae66e0230d6156d7c80228e7c # v6.0.0
135+
with:
136+
python-version: '3.12'
137+
cache: pip
138+
cache-dependency-path: |
139+
**/requirements*.txt
140+
.pre-commit-config.yaml
141+
142+
- name: Set up Node.js
143+
if: steps.check_author.outputs.authorized == 'true'
144+
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
145+
with:
146+
node-version: '20'
147+
cache: 'npm'
148+
cache-dependency-path: 'llama_stack/ui/'
149+
150+
- name: Install npm dependencies
151+
if: steps.check_author.outputs.authorized == 'true'
152+
run: npm ci
153+
working-directory: llama_stack/ui
154+
155+
- name: Run pre-commit
156+
if: steps.check_author.outputs.authorized == 'true'
157+
id: precommit
158+
uses: pre-commit/action@2c7b3805fd2a0fd8c1884dcaebf91fc102a13ecd # v3.0.1
159+
continue-on-error: true
160+
env:
161+
SKIP: no-commit-to-branch
162+
RUFF_OUTPUT_FORMAT: github
163+
164+
- name: Check for changes
165+
if: steps.check_author.outputs.authorized == 'true'
166+
id: changes
167+
run: |
168+
if ! git diff --exit-code || [ -n "$(git ls-files --others --exclude-standard)" ]; then
169+
echo "has_changes=true" >> $GITHUB_OUTPUT
170+
echo "Changes detected after pre-commit"
171+
else
172+
echo "has_changes=false" >> $GITHUB_OUTPUT
173+
echo "No changes after pre-commit"
174+
fi
175+
176+
- name: Commit and push changes
177+
if: steps.check_author.outputs.authorized == 'true' && steps.changes.outputs.has_changes == 'true'
178+
run: |
179+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
180+
git config --local user.name "github-actions[bot]"
181+
182+
git add -A
183+
git commit -m "style: apply pre-commit fixes
184+
185+
🤖 Applied by @github-actions bot via pre-commit workflow"
186+
187+
# Push changes
188+
git push origin HEAD:${{ steps.check_author.outputs.pr_head_ref }}
189+
190+
- name: Comment success with changes
191+
if: steps.check_author.outputs.authorized == 'true' && steps.changes.outputs.has_changes == 'true'
192+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
193+
with:
194+
github-token: ${{ secrets.GITHUB_TOKEN }}
195+
script: |
196+
await github.rest.issues.createComment({
197+
owner: context.repo.owner,
198+
repo: context.repo.repo,
199+
issue_number: ${{ steps.check_author.outputs.pr_number }},
200+
body: `✅ Pre-commit hooks completed successfully!\n\n🔧 Changes have been committed and pushed to the PR branch.`
201+
});
202+
203+
- name: Comment success without changes
204+
if: steps.check_author.outputs.authorized == 'true' && steps.changes.outputs.has_changes == 'false' && steps.precommit.outcome == 'success'
205+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
206+
with:
207+
github-token: ${{ secrets.GITHUB_TOKEN }}
208+
script: |
209+
await github.rest.issues.createComment({
210+
owner: context.repo.owner,
211+
repo: context.repo.repo,
212+
issue_number: ${{ steps.check_author.outputs.pr_number }},
213+
body: `✅ Pre-commit hooks passed!\n\n✨ No changes needed - your code is already formatted correctly.`
214+
});
215+
216+
- name: Comment failure
217+
if: failure()
218+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
219+
with:
220+
github-token: ${{ secrets.GITHUB_TOKEN }}
221+
script: |
222+
await github.rest.issues.createComment({
223+
owner: context.repo.owner,
224+
repo: context.repo.repo,
225+
issue_number: ${{ steps.check_author.outputs.pr_number }},
226+
body: `❌ Pre-commit workflow failed!\n\nPlease check the [workflow logs](https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}) for details.`
227+
});

.github/workflows/providers-build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ jobs:
112112
fi
113113
entrypoint=$(docker inspect --format '{{ .Config.Entrypoint }}' $IMAGE_ID)
114114
echo "Entrypoint: $entrypoint"
115-
if [ "$entrypoint" != "[python -m llama_stack.core.server.server /app/run.yaml]" ]; then
115+
if [ "$entrypoint" != "[llama stack run /app/run.yaml]" ]; then
116116
echo "Entrypoint is not correct"
117117
exit 1
118118
fi
@@ -150,7 +150,7 @@ jobs:
150150
fi
151151
entrypoint=$(docker inspect --format '{{ .Config.Entrypoint }}' $IMAGE_ID)
152152
echo "Entrypoint: $entrypoint"
153-
if [ "$entrypoint" != "[python -m llama_stack.core.server.server /app/run.yaml]" ]; then
153+
if [ "$entrypoint" != "[llama stack run /app/run.yaml]" ]; then
154154
echo "Entrypoint is not correct"
155155
exit 1
156156
fi

.github/workflows/python-build-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
2525

2626
- name: Install uv
27-
uses: astral-sh/setup-uv@b75a909f75acd358c2196fb9a5f1299a9a8868a4 # v6.7.0
27+
uses: astral-sh/setup-uv@d0cc045d04ccac9d8b7881df0226f9e82c39688e # v6.8.0
2828
with:
2929
python-version: ${{ matrix.python-version }}
3030
activate-environment: true

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
[![Unit Tests](https://github.com/meta-llama/llama-stack/actions/workflows/unit-tests.yml/badge.svg?branch=main)](https://github.com/meta-llama/llama-stack/actions/workflows/unit-tests.yml?query=branch%3Amain)
88
[![Integration Tests](https://github.com/meta-llama/llama-stack/actions/workflows/integration-tests.yml/badge.svg?branch=main)](https://github.com/meta-llama/llama-stack/actions/workflows/integration-tests.yml?query=branch%3Amain)
99

10-
[**Quick Start**](https://llamastack.github.io/latest/getting_started/index.html) | [**Documentation**](https://llamastack.github.io/latest/index.html) | [**Colab Notebook**](./docs/getting_started.ipynb) | [**Discord**](https://discord.gg/llama-stack)
10+
[**Quick Start**](https://llamastack.github.io/docs/getting_started/quickstart) | [**Documentation**](https://llamastack.github.io/docs) | [**Colab Notebook**](./docs/getting_started.ipynb) | [**Discord**](https://discord.gg/llama-stack)
1111

1212

1313
### ✨🎉 Llama 4 Support 🎉✨

docs/docs/building_applications/telemetry.mdx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -187,21 +187,21 @@ Configure telemetry behavior using environment variables:
187187
- **`OTEL_SERVICE_NAME`**: Service name for telemetry (default: empty string)
188188
- **`TELEMETRY_SINKS`**: Comma-separated list of sinks (default: `console,sqlite`)
189189

190-
## Visualization with Jaeger
190+
### Quick Setup: Complete Telemetry Stack
191191

192-
The `otel_trace` sink works with any service compatible with the OpenTelemetry collector. Traces and metrics use separate endpoints but can share the same collector.
193-
194-
### Starting Jaeger
195-
196-
Start a Jaeger instance with OTLP HTTP endpoint at 4318 and the Jaeger UI at 16686:
192+
Use the automated setup script to launch the complete telemetry stack (Jaeger, OpenTelemetry Collector, Prometheus, and Grafana):
197193

198194
```bash
199-
docker run --pull always --rm --name jaeger \
200-
-p 16686:16686 -p 4318:4318 \
201-
jaegertracing/jaeger:2.1.0
195+
./scripts/telemetry/setup_telemetry.sh
202196
```
203197

204-
Once running, you can visualize traces by navigating to [http://localhost:16686/](http://localhost:16686/).
198+
This sets up:
199+
- **Jaeger UI**: http://localhost:16686 (traces visualization)
200+
- **Prometheus**: http://localhost:9090 (metrics)
201+
- **Grafana**: http://localhost:3000 (dashboards with auto-configured data sources)
202+
- **OTEL Collector**: http://localhost:4318 (OTLP endpoint)
203+
204+
Once running, you can visualize traces by navigating to [Grafana](http://localhost:3000/) and login with login `admin` and password `admin`.
205205

206206
## Querying Metrics
207207

0 commit comments

Comments
 (0)