fix(settings): recreate every service that reads LLM_API_URL - #2518
Open
Hoang130203 wants to merge 1 commit into
Open
fix(settings): recreate every service that reads LLM_API_URL#2518Hoang130203 wants to merge 1 commit into
Hoang130203 wants to merge 1 commit into
Conversation
_match_apply_service() names one owner per key. LLM_API_URL is owned by
llama-server, so changing it scheduled llama-server and returned — while
six other services read the same variable from compose:
open-webui OPENAI_API_BASE_URL falls back to ${LLM_API_URL}/v1
openclaw compose.yaml
perplexica compose.yaml
privacy-shield compose.yaml
token-spy compose.yaml
dashboard-api OLLAMA_URL and LLM_URL both fall back to it
All of them kept the old endpoint, and the dashboard reported "Saved
changes are ready to apply to llama-server" — success, with no
manual-restart warning. This is the one silently-wrong case in the apply
plan: everywhere else an unrouted key at least tells the user to restart
the stack themselves.
Adds _EXTRA_APPLY_SERVICES, an explicit table of additional consumers,
applied after the primary service and filtered through the same
_SETTINGS_APPLY_ALLOWED_SERVICES gate. dashboard-api is deliberately not
listed: it is the process running the apply, and it is not in the allowed
set.
Now:
services: llama-server, open-webui, openclaw, perplexica,
privacy-shield, token-spy
Uninstalled consumers are staged rather than scheduled, via the existing
schedule() path, so a box without perplexica does not get a phantom
service in its plan.
Five assertions, including one that reads the compose files and fails if
a service listed in the table does not actually reference the key, and
one that fails if a listed service is not in the allowed set.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
_match_apply_service()names one owner per.envkey.LLM_API_URLisowned by
llama-server, so changing it scheduled llama-server and returned —while six other services read the same variable straight out of compose:
plus
openclaw,perplexica,privacy-shieldandtoken-spyin their owncompose.yaml.All of them kept the old endpoint, and the dashboard reported:
Success, no manual-restart warning, six services still pointed at the previous
URL.
This is the one genuinely silent case in the apply plan. Everywhere else an
unrouted key at least lands in the manual bucket and tells the user to restart
the stack themselves (that is what #2517 is about). Here the user is told the
change is handled, and it is not.
It bites exactly when it matters most:
LLM_API_URLis what you change whenyou point ODS at a different inference endpoint — an external Ollama, a remote
provider, a relocated llama-server. Chat keeps talking to the old one.
Fix
applied after the primary service and filtered through the same
_SETTINGS_APPLY_ALLOWED_SERVICESgate, so this table cannot be used toschedule something the dashboard is not permitted to recreate. (That gate is
what I got wrong in #2517 and is now asserted here.)
dashboard-apiis deliberately not listed: it readsLLM_API_URL, but itis the process running the apply and is not in the allowed set.
After:
Uninstalled consumers are staged, not scheduled, through the existing
schedule()path — a box without perplexica does not get a phantom service inits plan.
Test
Five assertions, two of which are guards rather than examples:
test_extra_consumers_really_read_the_keyparsesdocker-compose.base.ymland each service's
compose.yaml, and fails if a service listed in the tabledoes not actually reference the key. The table cannot drift from reality.
test_extra_consumers_respect_the_allowed_service_gatefails if a listedservice is not in
_SETTINGS_APPLY_ALLOWED_SERVICES.single-consumer key (
CTX_SIZE) asserted unchanged.AI Assistance
AI assisted with drafting the table and tests, and wording this description. I
found the case while inventorying apply routing for #2517, confirmed each
consumer by grepping the compose files, and ran the full plan before and after.
Release Lane
release/2.6.xmainStable hotfix reason:
Changed Surface
(One lookup table and four lines at its call site in
settings.py, plus tests.)Risk And Validation
git diff --checkrelease/2.6.xCommands/results:
Operational Change Check
_compute_env_apply_plan()runs when the dashboard saves settings. ChangingLLM_API_URLnow recreates five more containers than before — that is moredisruption per save, and it is the point: those containers were running with a
stale endpoint. Every other key is untouched, asserted by the unchanged
CTX_SIZEcase and the 76 other tests in the file. Uninstalled services arestaged rather than started. No write path or schema change.
Notes For Reviewers
I kept this to one key on purpose. The inventory turned up other
multi-consumer variables, but each needs a judgement I would rather you make
than have me guess:
LLM_API_URLis the one where the current behaviour is actively misleadingrather than merely conservative, so it is the one worth fixing on its own. Tell
me which of the others you want and I will extend the table — the guard test
means each addition has to be true of the compose files.
Why a table rather than making
_match_apply_servicereturn a set. Thatwas my first instinct, but the function's single-owner return is used to decide
continueversus the manual bucket, and widening it means touching thatcontrol flow and the summary text. A separate additive table leaves the
existing behaviour exactly as it was and is easy to revert. If you would prefer
the refactor, say so and I will send it instead.
Related to #2517, which fixes keys that were unrouted entirely. Independent
files? No — both touch
settings.py, so they will need rebasing on each other.Merge #2517 first and I will rebase this one, or tell me and I will combine
them.