Skip to content

fix(lora): preserve profile defaults and report selector errors - #837

Merged
svonava merged 2 commits into
mainfrom
fix/lora-profile-defaults-01a145dd
Oct 20, 2026
Merged

svonava merged 2 commits into
mainfrom
fix/lora-profile-defaults-01a145dd

Conversation

@svonava

@svonava svonava commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Profiles can declare a served LoRA alias separately from its source, such as lora: legal and lora_id: org/legal. Resolve those defaults through the selected profile's declarations while preserving the served selector. Explicit request selections, including null for the base model, override defaults. Both defaults and caller selections now require an actual declaration in that profile; a runtime.lora value cannot authorize a source declared only by another profile.

Request aliases still require exact agreement, and legacy lora_id remains source-only. Decisions and System One gateway errors now identify the invalid or conflicting selector in error.param instead of always naming lora_adapter.

Follow-up to #830, correcting findings raised on #829. No SDK, adapter, model catalog, or dependency changes.

Validation:

  • 429 focused Python tests passed, including HTTP/MessagePack, actual queue-worker selection, pre-fetch/dispatch rejection, and existing local PEFT lifecycle coverage.
  • 64 focused Rust tests passed, including raw Decisions/System One request validation.
  • Python lint, formatting and type checks; Rust formatting and Clippy passed.
  • Independent request-boundary review completed before publication.

Summary by CodeRabbit

  • New Features

    • Added support for selecting LoRA adapters using configured aliases or source references.
    • Profile-defined LoRA defaults are now preserved and applied consistently across request types and execution paths.
    • LoRA selection supports JSON and MessagePack requests.
  • Bug Fixes

    • Validation errors now identify the specific selector field and provide the relevant message.
    • Invalid, undeclared, empty, or conflicting LoRA selections are rejected before processing begins.
    • Explicitly clearing a LoRA selection is handled correctly.

@svonava
svonava requested a review from a team as a code owner October 20, 2026 06:15
@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Team
  • Run ID: 16e612ed-3eb0-4ed2-bac7-63b16e5fe577
📥 Commits

Reviewing files that changed from the base of the PR and between 23204d8 and b4f642e.

📒 Files selected for processing: 7
  • packages/sie_gateway/src/handlers/decisions.rs
  • packages/sie_gateway/src/handlers/lora.rs
  • packages/sie_gateway/src/handlers/systemone.rs
  • packages/sie_server/src/sie_server/core/runtime_options.py
  • packages/sie_server/tests/api/test_lora_aliases.py
  • packages/sie_server/tests/core/test_runtime_options.py
  • packages/sie_server/tests/test_queue_executor.py

Included review availability: This review used your included allowance. 8 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 10 reviews per hour.

📝 Walkthrough

The change adds structured LoRA selector errors in gateway handlers and updates runtime option merging to resolve profile aliases and validate profile defaults against declared adapters. Tests cover request overrides, JSON and MessagePack dispatch, and rejection before routing, loading, worker startup, or queue forwarding.

Changes: LoRA Selection and Profile Defaults

Layer / File(s) Summary
Resolve profile LoRA selections
packages/sie_server/src/sie_server/core/runtime_options.py, packages/sie_server/tests/core/test_runtime_options.py
Runtime option merging resolves profile aliases, validates defaults against declared adapters, and applies request-level selectors as overrides. Tests cover defaults, overrides, invalid selections, and configuration immutability.
Preserve gateway selector errors
packages/sie_gateway/src/handlers/lora.rs, packages/sie_gateway/src/handlers/decisions.rs, packages/sie_gateway/src/handlers/systemone.rs
The shared selector validator returns the offending field and message. Gateway routes use those values in validation responses.
Verify selection and dispatch behavior
packages/sie_server/tests/api/test_lora_aliases.py, packages/sie_server/tests/test_queue_executor.py
API and queue tests cover profile defaults, selector overrides, adapter invocation, and rejection of undeclared sources before routing, loading, worker startup, or queue forwarding.

Sequence Diagram(s)

sequenceDiagram
  participant Request
  participant runtime_options
  participant LoRAAdapter
  participant LoRALoader
  Request->>runtime_options: Provide profile and request selectors
  runtime_options-->>Request: Return validated LoRA selection
  Request->>LoRAAdapter: Invoke adapter with selection
  LoRAAdapter->>LoRALoader: Load selected source
Loading

Suggested reviewers: krisztian-gajdar, huronat

Priority: ⬇️ Low

Merge Risk: ⚪ Minimal · up to b4f64

The reviewed changes are mergeable after normal checks; no outstanding issue is established.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 37.93% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 29 functions across 7 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely describes the two primary changes: preserving LoRA profile defaults and reporting selector errors.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@svonava
svonava merged commit a08f9af into main Oct 20, 2026
22 checks passed
@svonava
svonava deleted the fix/lora-profile-defaults-01a145dd branch October 20, 2026 07:02
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