Skip to content

Conversation

@ashwinb
Copy link
Contributor

@ashwinb ashwinb commented Oct 31, 2025

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. 2c56a85 - fix(context): prevent provider data leak between streaming requests (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. ddd32b1 - fix(inference): enable routing of models with provider_data alone (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. f7c2973 - fix: Avoid BadRequestError due to invalid max_tokens (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. d7f9da6 - fix(responses): sync conversation before yielding terminal events in streaming (fix(responses): sync conversation before yielding terminal events in streaming #3888)

    • Ensures conversation sync executes even when streaming consumers break early
  5. 0ffa865 - fix(logging): ensure logs go to stderr, loggers obey levels (fix(logging): ensure logs go to stderr, loggers obey levels #3885)

    • Fixes logging infrastructure
  6. 75b49cb - ci: support release branches and match client branch (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.tracingllama_stack.providers.utils.telemetry.tracing
  • Fixed import paths: llama_stack.core.telemetry.telemetryllama_stack.apis.telemetry
  • Changed self.telemetry_enabledself.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.

…3924)

## Summary

- `preserve_contexts_async_generator` left `PROVIDER_DATA_VAR` (and
other context vars) populated after a streaming generator completed on
HEAD~1, so the asyncio context for request N+1 started with request N's
provider payload.
- FastAPI dependencies and middleware execute before
`request_provider_data_context` rebinds the header data, meaning
auth/logging hooks could observe a prior tenant's credentials or treat
them as authenticated. Traces and any background work that inspects the
context outside the `with` block leak as well—this is a real security
regression, not just a CLI artifact.
- The wrapper now restores each tracked `ContextVar` to the value it
held before the iteration (falling back to clearing when necessary)
after every yield and when the generator terminates, so provider data is
wiped while callers that set their own defaults keep them.

## Test Plan

- `uv run pytest tests/unit/core/test_provider_data_context.py -q`
- `uv run pytest tests/unit/distribution/test_context.py -q`

Both suites fail on HEAD~1 and pass with this change.
@meta-cla meta-cla bot added the CLA Signed This label is managed by the Meta Open Source bot. label Oct 31, 2025
We will be updating our release procedure to be more "normal" or "sane".
We will
- create release branches like normal people
- land cherry-picks onto those branches
- run releases off of those branches
- no more "rc" branch pollution either

Given that, this PR cleans things up a bit
- Remove `-maint` suffix from release branch patterns in CI workflows
- Update branch matching to `release-X.Y.x` format
Regenerate package-lock.json to match package.json dependency version.
Update all CI workflows and actions to use the standardized release branch
naming convention 'release-X.Y.x' (e.g., release-0.3.x) instead of matching
multiple numeric patterns.

Changes:
- Update workflow triggers to match 'release-[0-9]+.[0-9]+.x' pattern
- Update bash regex in setup-test-environment to match new format
- Simplifies branch pattern from multiple variants to single standard
@ashwinb
Copy link
Contributor Author

ashwinb commented Oct 31, 2025

For some reason, we are still not installing the correct llama-stack-client-python branch it seems.

@ashwinb
Copy link
Contributor Author

ashwinb commented Oct 31, 2025

Arghhh. LLAMA_STACK_CLIENT_DIR is no longer used but we still use it in our setup-test-environment action.

The LLAMA_STACK_CLIENT_DIR variable was used by the old `llama stack build`
command but is no longer used after switching to `llama stack list-deps`.

Replace with direct `uv pip install --force-reinstall` when targeting
release branches to ensure the matching client version is installed.
@ashwinb
Copy link
Contributor Author

ashwinb commented Oct 31, 2025

Yay, CI is green!

@ashwinb ashwinb merged commit 39f33f7 into release-0.3.x Oct 31, 2025
21 checks passed
@ashwinb ashwinb deleted the cherry-picks branch October 31, 2025 04:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants