Repository navigation
fix(web): save the dashboard's Quality tab settings (#1671) - #1676
Merged
Merged
Conversation
The provider dropdown and the boost toggle on the Quality tab were never read, the toggle rendered checked although boosting is off by default, and the Current Provider box was hardcoded. Add an admin-only POST /api/config/quality that writes MCP_QUALITY_AI_PROVIDER and MCP_QUALITY_BOOST_ENABLED to .env and restarts the server, and wire the tab to it: it now loads both values from /api/config/env and has a Save & Restart button. Values are checked against the choices ENV_CATEGORIES already lists. A provider whose key is missing is refused before anything is written, since QualityConfig.validate() would stop the restarted server from starting. The saved values also go into os.environ: load_dotenv copied the old .env values there, and the restarted process inherits them.
Keep the tab's controls and Save disabled until /config/env has answered, so a slow or failed load can no longer write the HTML defaults over the configured values; a failed load says so and reopening the tab retries. Read the boost flag with the spellings safe_get_bool_env() accepts, and check provider keys with startup's precedence: a variable present in the process environment wins over .env even when it is empty. Sanitize the setting names in the audit log line.
doobidoo
enabled auto-merge (squash)
October 25, 2026 18:41
…oo#1671) _write_credential_to_env() appended a missing key straight after the last line, so a .env that ends without a newline got the new assignment glued to its final setting. Terminate that line first. The credentials save goes through the same helper and benefits too.
auto-merge was automatically disabled
October 25, 2026 19:07
Head branch was pushed to by a user without write access
doobidoo
enabled auto-merge (squash)
October 25, 2026 19:51
doobidoo
previously approved these changes
Oct 25, 2026
Owner
|
@dodoshell please follow up with resolving the code reviews. |
…obidoo#1671) GET /api/config/env took `os.getenv(key) or env_vars.get(key)`, so a variable set to an empty string in the process environment fell through to .env. At startup load_dotenv(override=False) keeps the empty value, so the Quality tab could show boost on while the server ran with it off, and saving a provider change would then switch boost on. Use the same precedence as the provider key check.
auto-merge was automatically disabled
October 25, 2026 22:28
Head branch was pushed to by a user without write access
dodoshell
dismissed stale reviews from greptile-apps[bot] and doobidoo
via
October 25, 2026 22:28
3b346a6
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.
What this changes
The Quality tab in the dashboard settings now saves. Picking a provider or flipping the boost toggle and pressing Save & Restart writes
MCP_QUALITY_AI_PROVIDER/MCP_QUALITY_BOOST_ENABLEDto.envand restarts the server, and the tab shows the real values when it opens.Why
Fixes #1671. Nothing read
#quality-provideror#quality-boost-enabled, so the tab was display-only; the boost checkbox wascheckedin the HTML although the server default is off, and#current-provider-infowas a hardcoded string.What's in here:
POST /api/config/qualityinweb/api/configuration.py, behindrequire_admin_accesslike the credentials endpoint. It only accepts the two keys above, checks them against the choicesENV_CATEGORIES["quality"]already declares (so it can't drift from the Environment tab), strips control characters before writing, logs anAUDIT:line and schedules_restart_server_delayed.GROQ_API_KEY, gemini →GEMINI_API_KEY) is refused with a 400 before anything is written. Without that, the restart never comes back:QualityConfig.validate()aborts startup with "Groq provider selected but GROQ_API_KEY not set". I hit exactly that while testing.os.environ.load_dotenv(override=False)had already copied the old.envvalues into the process environment, and the restart (Popenon Windows,execvelsewhere) inherits it, so the freshly written.envlost to the old value. That's how I first saw "saved, restarted, stillauto".app.js: the tab loads both values from/api/config/envwhen it opens, with the controls and Save disabled until that answers (boost read with the same spellings assafe_get_bool_env(), unset = off), fills the Current Provider box from the selected option, and posts on Save & Restart, then shows the existing restart overlay. The new strings are in all seveni18n/*.jsonfiles.How it was verified
The tests mount the real
configurationrouter with the realrequire_admin_access(only the scope is supplied) against a temp.env; only_restart_server_delayedis replaced. They cover: non-admin → 403, unknown key / bad choice / bad boolean / empty body → 400 with.envuntouched, a valid save rewriting only its own lines, a boost-only save leaving an openai-compatible provider line alone, groq refused without its key and accepted once it's there, an emptyGROQ_API_KEYin the process environment winning over the one in.env(as at startup), theos.environhand-off, and a newline in a value not adding a line to.env. I also removed each guard in the endpoint one at a time and checked that a test goes red for each.In the browser (sqlite-vec instance on a scratch
.env, Edge headless): the tab loadsauto/ boost off; choosing Groq without a key shows the 400 message and leaves.envalone; saving Local SLM with boost on writes both keys, shows the restart overlay, and after the server is back the tab opens with Local SLM and the box ticked. WithMCP_QUALITY_AI_PROVIDER=openai-compatiblein.env, the dropdown comes up empty and disabled, the box showsopenai-compatible, and Save posts onlyMCP_QUALITY_BOOST_ENABLED; the provider line stays as it was.auto, boost off)GROQ_API_KEYopenai-compatiblein.envpre_pr_check.sh(run on Windows): everything passes except the test suite step, which has the same ~18 failures onmainwith this change stashed (unix SIGKILL test, chronological API tests, a few quality API tests, and two that flip between runs). None of them touchconfiguration.pyor the dashboard.Changelog fragment
changelog.d/1671.fixed.mdNotes for the reviewer
ENV_CATEGORIESchoices); that's Dashboard: quality provider settings lack openai-compatible and its base URL/model/key #1668. If.envalready uses it, the dropdown is disabled and Save only sends the boost toggle, so the provider is left alone.this.apiCall(url, { method: 'POST', body }), butapiCalltakes(endpoint, method, data), so Test and Save there fail with "'[object Object]' is not a valid HTTP method". I copied that pattern at first and the browser test caught it. I left the Credentials tab alone to keep this PR on Dashboard: Quality tab settings are never saved (provider, boost toggle, current provider) #1671; happy to send a separate fix.Agent Disclosure
I used Claude Code to help with this change, and I went through the diff, the tests and the description myself before opening this.


Confidence Score: 5/5
The PR appears safe to merge, with no new actionable issues and the numbered previous finding fixed.Summary
The Quality tab now loads and saves its provider and boost settings through an admin-only endpoint, then restarts the server.
Diagram
sequenceDiagram participant Tab as Quality tab participant API as Configuration API participant Env as .env and process environment participant Server Tab->>API: Load current settings API-->>Tab: Provider and boost values Tab->>API: Save settings API->>API: Check admin access and values API->>Env: Save accepted settings API-->>Tab: Restart scheduled API->>Server: RestartReviews (6) · Last reviewed commit: "fix(web): let an empty process value win..." · Reviewed by Greptile