Skip to content

LCORE-4753: Remove degraded-mode machinery - #3227

Merged
tisnik merged 1 commit into
lightspeed-core:mainfrom
Jazzcort:remove-degraded-mode
Nov 17, 2026
Merged

tisnik merged 1 commit into
lightspeed-core:mainfrom
Jazzcort:remove-degraded-mode

Conversation

@Jazzcort

@Jazzcort Jazzcort commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Description

Degraded mode allowed LCORE to start without OGX connectivity and report overall_status=degraded from readiness. With the move to in-process inference via the provider registry, this fallback is no longer needed — OGX/registry failure now aborts startup.

Removed: DegradedModeTracker, allow_degraded_mode config flag, ls_started_in_degraded_mode metric, degraded startup branch, readiness degraded path, degraded-mode e2e tests and config, E2E_SKIP_OGX_RESTORE_ON_LCS_RESTART flag, and related docs.

Type of change

  • Refactor
  • New feature
  • Bug fix
  • CVE fix
  • Optimization
  • Documentation Update
  • Configuration Update
  • Bump-up service version
  • Bump-up dependent library [pyproject.toml + uv.lock]
  • Bump-up dependent library [requirements.*.txt for Konflux]
  • 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

Used Claude to double check the removal is clean and no leftover references

Related Tickets & Documents

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

  • Please provide detailed steps to perform tests related to this code change.
  • How were the fix/results from this change verified? Please provide relevant screenshots or results.

Summary by CodeRabbit

  • Behavior Changes
    • Removed degraded-mode startup support. The service now requires OGX to be available at startup; OGX health checks and restoration are no longer optional.
    • Readiness reports only healthy or unhealthy status. Unhealthy provider or model checks return a 503 response.
    • Removed the allow_degraded_mode configuration setting and the associated degraded-status metric.

Degraded mode allowed LCORE to start without OGX connectivity and
report overall_status=degraded from readiness. With the move to
in-process inference via the provider registry, this fallback is
no longer needed — OGX/registry failure now aborts startup.

Removed: DegradedModeTracker, allow_degraded_mode config flag,
ls_started_in_degraded_mode metric, degraded startup branch,
readiness degraded path, degraded-mode e2e tests and config,
E2E_SKIP_OGX_RESTORE_ON_LCS_RESTART flag, and related docs.
@coderabbitai

coderabbitai Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The pull request removes degraded-mode configuration and runtime behavior. Readiness now reports healthy or unhealthy status. Startup, metrics, E2E workflows, tests, and documentation no longer include degraded-mode support.

Changes

Degraded-mode removal

Layer / File(s) Summary
Health and readiness contracts
src/models/common/health.py, src/models/api/responses/successful/probes.py, docs/devel_doc/openapi.*, docs/models/successful_responses.*, tests/unit/...
The DEGRADED health status and degraded readiness examples are removed. Readiness descriptions now cover healthy and unhealthy status.
Configuration and schema removal
src/models/config.py, src/telemetry/configuration_snapshot.py, docs/..., tests/unit/models/config/*, tests/unit/telemetry/*
OgxConfiguration.allow_degraded_mode and its snapshot passthrough are removed, along with associated schemas, documentation, examples, and test expectations.
Startup and readiness behavior
src/app/main.py, src/app/endpoints/health.py, src/metrics/*, src/utils/degraded_mode.py, tests/unit/app/*, tests/unit/test_degraded_mode.py
Startup no longer tracks degraded state or suppresses OGX version-check failures. Readiness proceeds to provider and default-model health checks. The degraded-mode tracker and metric are removed.
E2E and workflow cleanup
.github/workflows/e2e_tests.yaml, Makefile, tests/e2e/*, tests/e2e-prow/*, docs/testing/integration_vs_e2e.md
Degraded-mode E2E scenarios, configuration, restart helpers, and tag selections are removed. The restart script now restores OGX when its health check fails.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Refactor

Possibly related issues

  • lightspeed-core/lightspeed-stack#3129 describes startup aborting after a provider registry initialization failure. This change removes the degraded fallback and leaves startup failures unhandled, but does not implement the issue’s partial-cleanup fix.

Suggested reviewers: tisnik, asimurka, anik120

Merge Risk: Minimal · up to 62057

This change removes the degraded-mode fallback. Startup now fails if OGX is unavailable, and readiness reports only healthy or unhealthy. The change is intentional and consistent across code, tests, and docs, and no merge-blocking risk was found.

Pre-merge checks: Passed 6

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the main change: removal of the degraded-mode machinery. The changeset deletes DegradedModeTracker, the allow_degraded_mode config flag, the started_in_degraded_mode metric, degraded r…
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.
Performance And Algorithmic Complexity Passed The PR removes degraded-mode code. It does not add loops, queries, list operations, caches, buffers, or endpoints. I checked the committed diff for the runtime paths. - src/app/endpoints/health.py: …
Security And Secret Handling Passed Summary: No security or secret-handling violation found. This PR removes degraded-mode code. It adds no new endpoints, secrets, logging of sensitive data, or injection paths. Evidence checked:…
Full details: Title check

Explanation

The title names the main change: removal of the degraded-mode machinery. The changeset deletes DegradedModeTracker, the allow_degraded_mode config flag, the started_in_degraded_mode metric, degraded readiness paths, and related tests and docs. The LCORE-4753 ticket prefix is a tracker reference and does not affect the assessment. The title is specific and concise.

Full details: Performance And Algorithmic Complexity

Explanation

The PR removes degraded-mode code. It does not add loops, queries, list operations, caches, buffers, or endpoints. I checked the committed diff for the runtime paths. - src/app/endpoints/health.py: The DegradedModeTracker check and its early return are removed. Readiness now always runs get_providers_health_statuses() and the default-model check. Before this PR, that work ran on the non-degraded path, so the PR does not add new per-request cost. It removes one early-return branch. - src/app/main.py: setup_model_metrics() now runs on every startup. Before, it ran only when not degraded, which was the normal path. This is a single startup call, not a loop. The ApiException handling is unchanged. - src/metrics/__init__.py, src/metrics/recording.py, src/utils/degraded_mode.py: Removals only. No new collections or growth. - Other files are docs, config, and tests. None of the five listed criteria (quadratic algorithms, N+1 patterns, expensive work in loops, unbounded growth, missing pagination) matches a change in this diff. The check passes.

Full details: Security And Secret Handling

Explanation

Summary: No security or secret-handling violation found. This PR removes degraded-mode code. It adds no new endpoints, secrets, logging of sensitive data, or injection paths. Evidence checked: - Auth on endpoints: src/app/endpoints/health.py keeps @authorize(Action.INFO) and Depends(get_auth_dependency()) on the readiness handler. The degraded early return was removed. The provider and model checks still run after it. - Added lines: A scan of all + lines in the diff found no new secret, token, credential, logging of sensitive values, eval, exec, subprocess, or shell-injection patterns. The only logging change is a logger.warning call that keeps its existing exc_info. Its arguments are unchanged. - Masking: src/telemetry/configuration_snapshot.py removes one PASSTHROUGH field (ogx.allow_degraded_mode). Sensitive fields such as ogx.config.profile and native_override keep their SENSITIVE masking. - OGX startup: src/app/main.py now always re-raises ApiException from the OGX connection check. This fails closed and does not weaken any control. - E2E script: tests/e2e-prow/rhoai/scripts/e2e-ops.sh drops the skip-restore flag. The default health-check-and-restore path remains. - Residual references: git grep at the head revision finds leftover mentions only in docs/design/..., generated config.html/config.svg/config.puml, and a benchmark data file. None of these is executable security logic. Limits: The check covers the diff and the touched code paths. It does not include a full repository security scan.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
Simplify code

  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 2c3431c and 620570e.

Files selected for processing: 42

  • .github/workflows/e2e_tests.yaml
  • AGENTS.md
  • Makefile
  • README.md
  • docs/devel_doc/openapi.json
  • docs/devel_doc/openapi.md
  • docs/models/successful_responses.json
  • docs/models/successful_responses.md
  • docs/testing/integration_vs_e2e.md
  • docs/user_doc/config.json
  • docs/user_doc/config.md
  • src/app/endpoints/health.py
  • src/app/main.py
  • src/metrics/__init__.py
  • src/metrics/recording.py
  • src/metrics/utils.py
  • src/models/api/responses/successful/probes.py
  • src/models/common/health.py
  • src/models/config.py
  • src/telemetry/configuration_snapshot.py
  • src/utils/README.md
  • src/utils/degraded_mode.py
  • tests/e2e-prow/rhoai/scripts/e2e-ops.sh
  • tests/e2e/configuration/README.md
  • tests/e2e/configuration/server-mode/lightspeed-stack-degraded.yaml
  • tests/e2e/features/degraded_mode_startup.feature
  • tests/e2e/features/steps/common.py
  • tests/e2e/test_list.txt
  • tests/e2e/utils/utils.py
  • tests/integration/inference_registry/_helpers.py
  • tests/unit/README.md
  • tests/unit/app/endpoints/test_health.py
  • tests/unit/app/endpoints/test_metrics.py
  • tests/unit/app/test_main_startup.py
  • tests/unit/models/config/test_dump_configuration.py
  • tests/unit/models/config/test_ogx_configuration.py
  • tests/unit/models/responses/test_successful_responses.py
  • tests/unit/telemetry/conftest.py
  • tests/unit/telemetry/test_configuration_snapshot.py
  • tests/unit/test_configuration.py
  • tests/unit/test_degraded_mode.py
  • tests/unit/utils/dumpers/test_models_dumper.py
Files with no reviewable changes: 29

  • AGENTS.md
  • README.md
  • docs/devel_doc/openapi.md
  • docs/user_doc/config.json
  • docs/user_doc/config.md
  • src/metrics/init.py
  • src/metrics/recording.py
  • src/metrics/utils.py
  • src/models/common/health.py
  • src/models/config.py
  • src/telemetry/configuration_snapshot.py
  • src/utils/README.md
  • src/utils/degraded_mode.py
  • tests/e2e/configuration/server-mode/lightspeed-stack-degraded.yaml
  • tests/e2e/features/degraded_mode_startup.feature
  • tests/e2e/features/steps/common.py
  • tests/e2e/test_list.txt
  • tests/e2e/utils/utils.py
  • tests/integration/inference_registry/_helpers.py
  • tests/unit/README.md
  • tests/unit/app/endpoints/test_health.py
  • tests/unit/app/endpoints/test_metrics.py
  • tests/unit/app/test_main_startup.py
  • tests/unit/models/config/test_dump_configuration.py
  • tests/unit/models/config/test_ogx_configuration.py
  • tests/unit/telemetry/conftest.py
  • tests/unit/telemetry/test_configuration_snapshot.py
  • tests/unit/test_configuration.py
  • tests/unit/test_degraded_mode.py

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

Recent review details

Context from checks skipped due to timeout: 16

  • GitHub Check: E2E: library / ci / rbac
  • GitHub Check: E2E: library / ci / default
  • GitHub Check: E2E: library / ci / shields
  • GitHub Check: E2E: server / ci / other
  • GitHub Check: E2E: server / ci / default
  • GitHub Check: E2E: library / ci / mcp
  • GitHub Check: E2E: library / ci / authorized
  • GitHub Check: E2E: library / ci / skills
  • GitHub Check: E2E: library / ci / other
  • GitHub Check: E2E: server / ci / rbac
  • GitHub Check: E2E: server / ci / skills
  • GitHub Check: Pylinter
  • GitHub Check: integration_tests (3.14)
  • GitHub Check: build-pr
  • GitHub Check: integration_tests (3.12)
  • GitHub Check: integration_tests (3.13)
CI failures not shown inline: 1

GitHub Check: Konflux kflux-prd-rh02 / lightspeed-stack-0-8-on-pull-request: pipelinerun start failure

Conclusion: failure

View job details

Konflux kflux-prd-rh02/lightspeed-stack-0-8-on-pull-request has <b>failed</b>.
There was an error creating the PipelineRun: <b>lightspeed-stack-0-8-on-pull-request-</b>
cannot use the API on the provider platform to create a in_progress status: PATCH https://api.github.com/repos/lightspeed-core/lightspeed-stack/check-runs/131465638908: 404 Not Found []
Additional context used

Code guidelines: 2

AGENTS.md — auto-discovered
CLAUDE.md — auto-discovered
Path-based instructions: 4

Source excerpt: **Required**: Use pytest for all unit and integration tests Source excerpt: **Forbidden**: Do not use unittest - pytest is the standard for this project Source excerpt: **Coverage**: Unit tests require 60% coverage, integrat...

CodeRabbit inference engine (AGENTS.md)

Files:

  • tests/unit/models/responses/test_successful_responses.py
  • tests/unit/utils/dumpers/test_models_dumper.py
Source excerpt: **Fixtures**: Use `conftest.py` for shared fixtures Source excerpt: **Mocking**: `pytest-mock` for AsyncMock objects Source excerpt: **Async tests**: Use marker `pytest.mark.asyncio`

CodeRabbit inference engine (AGENTS.md)

Files:

  • tests/unit/models/responses/test_successful_responses.py
  • tests/unit/utils/dumpers/test_models_dumper.py
Source excerpt: **Fixtures**: Use `conftest.py` for shared fixtures Source excerpt: **Mocking**: `pytest-mock` for AsyncMock objects Source excerpt: **Auth Mock**: `MOCK_AUTH = ("mock_user_id", "mock_username", False, "mock_token")` Source...

CodeRabbit inference engine (CLAUDE.md)

Files:

  • tests/unit/models/responses/test_successful_responses.py
  • tests/unit/utils/dumpers/test_models_dumper.py
Source excerpt: **E2E Tests**: Use behave (BDD) framework for end-to-end testing

CodeRabbit inference engine (AGENTS.md)

Files:

  • tests/e2e/configuration/README.md
Checkov (3.3.30)

docs/devel_doc/openapi.json

[high] 1-24170: Ensure that the global security field has rules defined

(CKV_OPENAPI_4)

[high] 1-24170: Ensure that security operations is not empty.

(CKV_OPENAPI_5)

docs/models/successful_responses.json

[high] 1-8156: Ensure that the global security field has rules defined

(CKV_OPENAPI_4)

zizmor (1.31.1)

.github/workflows/e2e_tests.yaml

[warning] 2-358: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block

(excessive-permissions)

[warning] 18-358: overly broad permissions (excessive-permissions): default permissions used due to no permissions: block

(excessive-permissions)

Additional comments: 11

docs/models/successful_responses.json: 1

2168-2168: LGTM!

Also applies to: 5544-5544, 5587-5587, 8156-8156

docs/models/successful_responses.md: 1

2288-2289: LGTM!

Also applies to: 2298-2298

tests/unit/models/responses/test_successful_responses.py: 1

399-399: LGTM!

Also applies to: 410-411

tests/unit/utils/dumpers/test_models_dumper.py: 1

2410-2410: LGTM!

Also applies to: 6360-6360, 6400-6400

src/app/endpoints/health.py: 1

131-131: LGTM!

Also applies to: 141-141, 145-145, 147-148

src/app/main.py: 1

125-125: LGTM!

Also applies to: 133-136

.github/workflows/e2e_tests.yaml: 1

45-45: LGTM!

Also applies to: 88-88, 290-290

Makefile: 1

181-181: LGTM!

docs/testing/integration_vs_e2e.md: 1

50-50: LGTM!

tests/e2e-prow/rhoai/scripts/e2e-ops.sh: 1

417-417: LGTM!

tests/e2e/configuration/README.md: 1

77-77: LGTM!

@Jazzcort

Copy link
Copy Markdown
Contributor Author

e2e tests were failing because the pipeline was having problem with pulling the ubi image. Are we having a service down issue?

target lightspeed-stack: failed to solve: registry.access.redhat.com/ubi9/python-312: failed to resolve source metadata for registry.access.redhat.com/ubi9/python-312:latest: unexpected status from HEAD request to https://registry.access.redhat.com/v2/ubi9/python-312/manifests/latest: 502 Bad Gateway

might be better to just rerun them tomorrow 🤞.

@Jazzcort

Copy link
Copy Markdown
Contributor Author

@asimurka Should be good to review. Feel free to review it when you're available! 😁

@asimurka asimurka left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@asimurka
asimurka requested a review from tisnik November 16, 2026 15:52

@tisnik tisnik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tisnik
tisnik merged commit b9f3af7 into lightspeed-core:main Nov 17, 2026
71 of 82 checks passed
openshift-merge-bot Bot pushed a commit to openstack-k8s-operators/lightspeed-tests that referenced this pull request Nov 23, 2026
The test asserted that /metrics exposes ls_started_in_degraded_mode,
but it was removed in [1]. Since we are migrating to a newer version
of lightspeed-stack that already contains [1], we have to remove it from
the test (otherwise, it will fail).

[1] lightspeed-core/lightspeed-stack#3227
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.

3 participants