RHIDP-14303: add config fields for saved prompts#2071
Conversation
Signed-off-by: Jordan Dubrick <[email protected]>
Signed-off-by: Jordan Dubrick <[email protected]>
Signed-off-by: Jordan Dubrick <[email protected]>
Signed-off-by: Jordan Dubrick <[email protected]>
|
Warning Review limit reached
Next review available in: 50 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Run ID: 📒 Files selected for processing (1)
WalkthroughThis PR introduces a ChangesSaved Prompts Configuration
Estimated code review effort: 2 (Simple) | ~15 minutes Sequence Diagram(s)sequenceDiagram
participant Configuration
participant SavedPromptsConfiguration
participant constants
Configuration->>SavedPromptsConfiguration: instantiate saved_prompts field
SavedPromptsConfiguration->>SavedPromptsConfiguration: apply_defaults_and_validate_bounds()
SavedPromptsConfiguration->>constants: read default and upper-bound values
alt value exceeds upper bound
SavedPromptsConfiguration-->>Configuration: raise ValueError
else value missing
SavedPromptsConfiguration-->>Configuration: apply default, log info
else valid value provided
SavedPromptsConfiguration-->>Configuration: keep provided value
end
Related Issues: Not specified in the provided information. Related PRs: Not specified in the provided information. Suggested labels: enhancement, configuration, tests Suggested reviewers: Not specified in the provided information. 🐰 A prompt shall have its bounds and place, 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
✨ Simplify code
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. Comment |
Signed-off-by: Jordan Dubrick <[email protected]>
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/openapi.json`:
- Around line 12226-12230: The OpenAPI JSON is stale and no longer matches the
generated schema. Regenerate the schema using scripts/generate_openapi_schema.py
for docs/openapi.json, then commit the updated output so the
SavedPromptsConfiguration and related schema sections stay in sync with CI
expectations. Apply the same regeneration to the referenced schema block around
saved_prompts as well.
In `@src/models/config.py`:
- Around line 2416-2422: The saved_prompts defaulting block in the config loader
uses a different string-joining style than the surrounding code. Update the
logger.info call in the method containing max_content_length handling to use the
same implicit adjacent-literal concatenation style used in the nearby
saved_prompts blocks, keeping the message text and behavior unchanged while
matching the rest of the method’s formatting.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
Run ID: 1ae425c6-6e24-4ad2-92cc-2cd951d08102
📒 Files selected for processing (5)
docs/openapi.jsonsrc/constants.pysrc/models/config.pytests/unit/models/config/test_dump_configuration.pytests/unit/models/test_saved_prompts_config.py
📜 Review details
⏰ Context from checks skipped due to timeout. (15)
- GitHub Check: build-pr
- GitHub Check: integration_tests (3.12)
- GitHub Check: unit_tests (3.13)
- GitHub Check: unit_tests (3.12)
- GitHub Check: integration_tests (3.13)
- GitHub Check: Pylinter
- GitHub Check: E2E: library mode / ci / group 2
- GitHub Check: E2E: server mode / ci / group 3
- GitHub Check: E2E: server mode / ci / group 1
- GitHub Check: E2E: library mode / ci / group 1
- GitHub Check: E2E: server mode / ci / group 2
- GitHub Check: E2E: library mode / ci / group 3
- GitHub Check: E2E Tests for Lightspeed Evaluation job
- GitHub Check: Konflux kflux-prd-rh02 / lightspeed-stack-0-6-on-pull-request
- GitHub Check: Konflux kflux-prd-rh02 / lightspeed-stack-on-pull-request
⚠️ CI failures not shown inline (1)
GitHub Actions: OpenAPI (Spectral) / 0_spectral.txt: RHIDP-14303: add config fields for saved prompts
Conclusion: failure
##[group]Run set -euo pipefail
�[36;1mset -euo pipefail�[0m
�[36;1muv run python scripts/generate_openapi_schema.py /tmp/openapi-generated.json�[0m
�[36;1mif ! diff -u docs/openapi.json /tmp/openapi-generated.json; then�[0m
�[36;1m echo "::error::docs/openapi.json is out of date. Regenerate with: uv run scripts/generate_openapi_schema.py docs/openapi.json"�[0m
🧰 Additional context used
📓 Path-based instructions (4)
src/**/*.py
📄 CodeRabbit inference engine (AGENTS.md)
src/**/*.py: Use absolute imports for internal modules:from authentication import get_auth_dependency
Llama Stack imports: Usefrom llama_stack_client import AsyncLlamaStackClient
Checkconstants.pyfor shared constants before defining new ones
All modules must start with descriptive docstrings explaining purpose
Uselogger = get_logger(__name__)fromlog.pyfor module logging
All functions must have complete type annotations for parameters and return types, use modern syntax (str | int), and include descriptive docstrings
Use snake_case with descriptive, action-oriented names for functions (get_, validate_, check_)
Avoid in-place parameter modification anti-patterns; return new data structures instead of modifying function parameters
Useasync deffor I/O operations and external API calls
Use standard log levels with clear purposes:debug()for diagnostic info,info()for program execution,warning()for unexpected events,error()for serious problems
All classes must have descriptive docstrings explaining purpose and use PascalCase with standard suffixes:Configuration,Error/Exception,Resolver,Interface
Abstract classes must use ABC with@abstractmethoddecorators
Follow Google Python docstring conventions with required sections: Parameters, Returns, Raises, and Attributes for classes
Files:
src/models/config.pysrc/constants.py
src/models/**/*.py
📄 CodeRabbit inference engine (AGENTS.md)
Pydantic models must use
@model_validatorand@field_validatorfor validation and complete type annotations for all attributes, avoidingAnytype
Files:
src/models/config.py
src/constants.py
📄 CodeRabbit inference engine (AGENTS.md)
Use
constants.pyfor shared constants with descriptive comments and type hints usingFinal[type]
Files:
src/constants.py
tests/**/*.py
📄 CodeRabbit inference engine (AGENTS.md)
tests/**/*.py: Use pytest for all unit and integration tests; do not use unittest
Usepytest.mark.asynciomarker for async tests
Files:
tests/unit/models/test_saved_prompts_config.pytests/unit/models/config/test_dump_configuration.py
🧠 Learnings (3)
📚 Learning: 2026-01-12T10:58:40.230Z
Learnt from: blublinsky
Repo: lightspeed-core/lightspeed-stack PR: 972
File: src/models/config.py:459-513
Timestamp: 2026-01-12T10:58:40.230Z
Learning: In lightspeed-core/lightspeed-stack, for Python files under src/models, when a user claims a fix is done but the issue persists, verify the current code state before accepting the fix. Steps: review the diff, fetch the latest changes, run relevant tests, reproduce the issue, search the codebase for lingering references to the original problem, confirm the fix is applied and not undone by subsequent commits, and validate with local checks to ensure the issue is resolved.
Applied to files:
src/models/config.py
📚 Learning: 2026-02-25T07:46:33.545Z
Learnt from: asimurka
Repo: lightspeed-core/lightspeed-stack PR: 1211
File: src/models/responses.py:8-16
Timestamp: 2026-02-25T07:46:33.545Z
Learning: In the Python codebase, requests.py should use OpenAIResponseInputTool as Tool while responses.py uses OpenAIResponseTool as Tool. This difference is intentional due to differing schemas for input vs output tools in llama-stack-api. Apply this distinction consistently to other models under src/models (e.g., ensure request-related tools use the InputTool variant and response-related tools use the ResponseTool variant). If adding new tools, choose the corresponding InputTool or Tool class based on whether the tool represents input or output, and document the rationale in code comments.
Applied to files:
src/models/config.py
📚 Learning: 2026-06-24T13:45:37.249Z
Learnt from: Jdubrick
Repo: lightspeed-core/lightspeed-stack PR: 1971
File: src/utils/markdown_repair.py:31-36
Timestamp: 2026-06-24T13:45:37.249Z
Learning: In the lightspeed-stack repository, docstrings must use the section header name "Parameters:" (not "Args:") for function arguments, even if the project references Google Python docstring conventions. Ensure docstrings follow the project’s established "Parameters:" header format for any documented function parameters.
Applied to files:
src/models/config.pysrc/constants.pytests/unit/models/test_saved_prompts_config.pytests/unit/models/config/test_dump_configuration.py
🪛 ast-grep (0.44.1)
tests/unit/models/test_saved_prompts_config.py
[warning] 174-174: Do not make http calls without encryption
Context: "http://test.com:1234"
Note: [CWE-319] Cleartext Transmission of Sensitive Information.
(requests-http)
🪛 GitHub Actions: OpenAPI (Spectral) / 0_spectral.txt
docs/openapi.json
[error] 1-1: OpenAPI schema check failed: docs/openapi.json is out of date versus generated /tmp/openapi-generated.json. Regenerate with: uv run python scripts/generate_openapi_schema.py docs/openapi.json
🪛 GitHub Actions: OpenAPI (Spectral) / spectral
docs/openapi.json
[error] 1-1: CI failed because docs/openapi.json is out of date. Step: diff -u docs/openapi.json /tmp/openapi-generated.json. Regenerate with: uv run python scripts/generate_openapi_schema.py docs/openapi.json
🔇 Additional comments (5)
tests/unit/models/config/test_dump_configuration.py (1)
37-42: LGTM!Also applies to: 232-232, 455-455, 829-829, 1087-1087, 1325-1325, 1543-1543, 1921-1921, 2145-2145, 2369-2369, 2600-2600
tests/unit/models/test_saved_prompts_config.py (1)
1-204: LGTM!src/constants.py (1)
354-365: LGTM!src/models/config.py (2)
2333-2432: LGTM!
2727-2733: LGTM!
Signed-off-by: Jordan Dubrick <[email protected]>
Signed-off-by: Jordan Dubrick <[email protected]>
Description
- Currently is just the fields, logic utilizing these fields will come in follow up PRs
Type of change
Tools used to create PR
Identify any AI code assistants used in this PR (for transparency and review context)
Related Tickets & Documents
Checklist before requesting a review
Testing
Summary by CodeRabbit
New Features
Bug Fixes
Tests