Skip to content

LCORE-2338: LS container entrypoint + deployment artifacts for unified mode - #2319

Open
max-svistunov wants to merge 2 commits into
lightspeed-core:mainfrom
max-svistunov:lcore-2338-unified-mode-deployment
Open

LCORE-2338: LS container entrypoint + deployment artifacts for unified mode#2319
max-svistunov wants to merge 2 commits into
lightspeed-core:mainfrom
max-svistunov:lcore-2338-unified-mode-deployment

Conversation

@max-svistunov

@max-svistunov max-svistunov commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Description

Implements LCORE-2338: server mode works end to end from a single unified lightspeed-stack.yaml.

The ticket assumed the Python CLI already auto-detected unified vs legacy configs — it did not: main() only performed legacy enrichment, so a container handed a unified config (no external run.yaml) could not start. This PR closes that gap and updates the deployment artifacts around it:

  • CLI auto-detection (src/llama_stack_configuration.py): main() dispatches on a new has_synthesis_input() helper mirroring the root Configuration.check_unified_vs_legacy detection (non-empty inference.providers, non-empty vector_store.providers, or a llama_stack.config block). Unified configs are synthesized via synthesize_to_file (--input ignored and need not exist; relative profile: resolves against the --config dir, R8; output keeps mode 0600, R10). Legacy configs enrich --input exactly as before, so existing layouts and the CI provider-matrix workflows are untouched.
  • Entrypoint (scripts/llama-stack-entrypoint.sh): documents the two startup modes, adopts the post-rename ogx stack run command, and fails with a clear error when generation fails and no fallback run.yaml is mounted. (Note for a follow-up: ogx stack run already emits a FutureWarning recommending ogx run — inherited from the rename, kept for consistency with the rest of main.)
  • Container image (deploy/llama-stack/test.containerfile): ships src/data/ to /opt/app-root/data so load_default_baseline() resolves next to the standalone-copied script.
  • Compose (docker-compose.yaml): one file serves both modes — mode is chosen by the content of lightspeed-stack.yaml; the run.yaml mount is documented as legacy-only and is inert in unified mode. Adds the src/data host-copy mount beside the existing script mounts.
  • Docs (deploy/llama-stack/README.md, new): image contents, the two startup modes, a minimal unified-only compose snippet (no run.yaml mount), and rebuild guidance.

.tekton/ pipelines reference no compose files and need no changes (flagging for @radofuchs as the Konflux owner per the ticket).

Type of change

  • Refactor
  • New feature
  • Bug fix
  • CVE fix
  • Optimization
  • Documentation Update
  • Configuration Update
  • Bump-up service version
  • Bump-up dependent library
  • Bump-up library or tool used for development (does not change the final image)
  • CI configuration change
  • Konflux configuration change
  • Unit tests improvement
  • Integration tests improvement
  • End to end tests improvement
  • Benchmarks improvement

Tools used to create PR

Identify any AI code assistants used in this PR (for transparency and review context)

  • Assisted-by: Claude Opus 4.8
  • Generated by: Claude Opus 4.8

Related Tickets & Documents

  • Related Issue # LCORE-2336, LCORE-2337
  • Closes # LCORE-2338

Checklist before requesting a review

  • I have performed a self-review of my code.
  • PR has passed all pre-merge test jobs.
  • If it is a core feature, I have added thorough tests.

Testing

  1. Run the CLI dispatch unit tests:
    uv run pytest tests/unit/test_llama_stack_synthesize.py -k "main or has_synthesis" -v
    Expected: detection matrix + both dispatch paths pass, including synthesis with a nonexistent --input and relative-profile resolution.
    Actual: 4 passed (51 passed for the whole module; full unit suite 3176 passed).
  2. Unified server mode end to end (acceptance criterion 1). Produce a unified root config by migrating CI's server-mode pair, then start the stack:
    uv run python src/llama_stack_configuration.py (via migrate_config_dumb over tests/e2e/configs/run-ci.yaml + tests/e2e/configuration/server-mode/lightspeed-stack.yaml, enrichment inputs stripped) → root lightspeed-stack.yaml; docker compose up -d llama-stack lightspeed-stack
    Expected: llama-stack log shows the synthesis path; all containers healthy; /v1/query answers through LCORE → LS.
    Actual (re-verified after rebasing onto the OGX-rename main):
    • llama-stack | Generating llama-stack config from /opt/app-root/lightspeed-stack.yaml (mode auto-detected)...
    • llama-stack | Using generated config: /tmp/generated-run.yaml
    • docker compose ps: llama-stack, lightspeed-stack, mock-mcp, mock-tls-inference all healthy
    • curl -X POST http://localhost:8080/v1/query …{"response":"unified ogx works",…}
  3. Legacy layout still works (acceptance criterion 2). Restore a legacy-shaped root lightspeed-stack.yaml (CI server-mode config, no synthesis input) with run.yaml = run-ci.yaml, recreate the two containers:
    docker compose up -d --force-recreate llama-stack lightspeed-stack
    Expected: enrichment path taken (the config has no synthesis input, so only generate_configuration over the mounted run.yaml can produce the generated config); containers healthy; /v1/query answers.
    Actual (post-rebase): all containers healthy; BYOK enrichment visible in the generated config (backend: byok_e2e-test-docs_storage); curl …{"response":"legacy ogx works",…}
  4. uv run make format / uv run make verify
    Actual: clean, except 14 pre-existing mypy errors in tests/unit/utils/test_models_dumper.py that reproduce identically on untouched upstream/main.
  5. CI on the rebased head: 24 checks pass — including the group-1 e2e jobs in BOTH server and library modes, which exercise this PR's entrypoint/compose changes end-to-end in CI. The remaining e2e failures are the groups red on main itself (CI OpenAI quota).

@coderabbitai

coderabbitai Bot commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@max-svistunov, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 59 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 13cca963-315d-4e9e-a214-909bf5bf8ca3

📥 Commits

Reviewing files that changed from the base of the PR and between e6a4116 and 2f56509.

📒 Files selected for processing (6)
  • deploy/llama-stack/README.md
  • deploy/llama-stack/test.containerfile
  • docker-compose.yaml
  • scripts/llama-stack-entrypoint.sh
  • src/llama_stack_configuration.py
  • tests/unit/test_llama_stack_synthesize.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

The llama_stack_configuration.py CLI previously only performed legacy
enrichment: it always read the --input run.yaml and enriched it, so a
container handed a unified lightspeed-stack.yaml (with no external
run.yaml) could not start. The spec's server-mode trigger mechanism
requires the CLI to auto-detect the configuration shape.

main() now dispatches on a new has_synthesis_input() helper that mirrors
the root Configuration.check_unified_vs_legacy detection on the raw YAML
dict (non-empty inference.providers, non-empty vector_store.providers,
or a llama_stack.config block). Unified configs are synthesized via
synthesize_to_file — --input is ignored and need not exist, relative
profile: paths resolve against the --config directory (R8), and the
output keeps the 0600 secret-safety mode (R10). Legacy configs enrich
the --input run.yaml exactly as before, so existing container layouts
and CI provider-matrix runs are unaffected.

Tests cover the detection matrix (all three synthesis inputs, empty
provider lists, null sections, legacy path) and both CLI dispatch paths,
including synthesis with a nonexistent --input and relative-profile
resolution.
Make server mode work end to end from a single unified
lightspeed-stack.yaml, relying on the CLI's unified-vs-legacy
auto-detection:

- scripts/llama-stack-entrypoint.sh: document the two startup modes in
  the header (synthesis from a unified config vs legacy run.yaml
  enrichment — the Python CLI decides), rename the intermediate file to
  generated-run.yaml, and fail with a clear error when generation fails
  and no fallback run.yaml is mounted, instead of handing llama-stack a
  nonexistent path.
- deploy/llama-stack/test.containerfile: ship src/data/ to
  /opt/app-root/data so load_default_baseline() resolves next to the
  standalone-copied script (it reads ./data/default_run.yaml relative to
  its own location); chown it for the runtime user.
- docker-compose.yaml: mount the src/data host copy beside the existing
  script host-copies, and document that the run.yaml mount is only
  consumed in legacy mode — one compose file serves both modes, with the
  mode chosen by the content of lightspeed-stack.yaml, so the CI
  provider-matrix workflows that pair run-*.yaml files with this compose
  file keep working unchanged.
- deploy/llama-stack/README.md: document what the image bundles, the two
  startup modes, a minimal unified-only compose snippet (no run.yaml
  mount), and when a rebuild is needed vs covered by the host-copy
  mounts.

.tekton/ pipelines reference no compose files and need no changes.
@max-svistunov
max-svistunov force-pushed the lcore-2338-unified-mode-deployment branch from 69e9dff to 2f56509 Compare August 3, 2026 15:06
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.

1 participant