Skip to content

Use Claude Code, Codex, VSCode, Pi, and OpenCode (and 6 other harnesses) for free (1.3B+ free tokens) from your terminal, app, IDE, or phone, and now from the browser with native browser sessions (multi-harness + multi-model) like OpenClaw (voice supported + ToS friendly)

Python

Make Apply the single Admin configuration action (#1595)

Ali Khokhar88956914501f
diff --git a/ARCHITECTURE.md b/ARCHITECTURE.md
index c0ceca4b..904cbe98 100644
--- a/ARCHITECTURE.md
+++ b/ARCHITECTURE.md
@@ -411,9 +411,9 @@ Admin requests are partial updates: omitted keys stay unchanged, `null` removes
an optional assignment, and required/defaulted values reject `null` or blank
input. False and zero remain real values. Masked or blank secret submissions
mean unchanged; an explicit remove action is available only for optional
-secrets. Preview and Apply validate the same prospective Settings snapshot, and
-Apply atomically writes only configured values plus preserved unknown managed
-assignments. Process-owned fields are visible but locked.
+secrets. Apply validates the prospective Settings snapshot before atomically
+writing only configured values plus preserved unknown managed assignments.
+Process-owned fields are visible but locked.
[config/admin/status.py](src/free_claude_code/config/admin/status.py) owns
provider configuration readiness and exposes ordered Admin field keys for each
diff --git a/README.md b/README.md
index b633a164..f29a37a0 100644
--- a/README.md
+++ b/README.md
@@ -90,7 +90,7 @@ terminal open.
2. Open the Admin UI URL from the server log.
3. Paste the key into `NVIDIA_NIM_API_KEY`.
4. Leave `MODEL` on the default `nvidia_nim/nvidia/nemotron-3-super-120b-a12b`, or search the model dropdown and select another model.
-5. Click **Validate**, then **Apply**.
+5. Click **Apply**.
To protect the local proxy with a bearer token, enable **Proxy Authentication**
in Admin.
@@ -178,7 +178,7 @@ fcc-aider
**Providers → Connected accounts** instead.
3. Search the `MODEL` dropdown and select a model. If the provider cannot list
models, enter `<provider-id>/<exact-provider-model-id>` manually.
-4. Click **Validate**, then **Apply**.
+4. Click **Apply**.
Optional: add an ordered **Fallback Models** list under **Model Config**. It
applies to every connected client. A failed request may reach and consume usage
@@ -479,7 +479,7 @@ Restart Claude Code or the IDE after saving the file.
## Optional Integrations
-Configure integrations from **Admin UI → Messaging**, then click **Validate** and **Apply**.
+Configure integrations from **Admin UI → Messaging**, then click **Apply**.
<details>
<summary><strong>Discord bot</strong></summary>
diff --git a/assets/admin-page.png b/assets/admin-page.png
index 5c53b995..a3566a4c 100644
Binary files a/assets/admin-page.png and b/assets/admin-page.png differ
diff --git a/e2e/test_admin_apply.py b/e2e/test_admin_apply.py
new file mode 100644
index 00000000..5eb30d39
--- /dev/null
+++ b/e2e/test_admin_apply.py
@@ -0,0 +1,41 @@
+"""Rendered one-step Admin configuration workflow regressions."""
+
+from playwright.sync_api import Page, expect
+
+
+def test_apply_is_the_only_config_action_and_retains_invalid_edits(
+ page: Page,
+ admin_base_url: str,
+) -> None:
+ config_mutations: list[tuple[str, str]] = []
+
+ def record_config_mutation(method: str, url: str) -> None:
+ if "/admin/api/config/" in url:
+ config_mutations.append((method, url.rsplit("/", maxsplit=1)[-1]))
+
+ page.on(
+ "request",
+ lambda request: record_config_mutation(request.method, request.url),
+ )
+ page.emulate_media(reduced_motion="reduce")
+ page.goto(f"{admin_base_url}/admin")
+ expect(page.locator("#messageArea")).to_have_text("")
+
+ expect(page.get_by_role("button", name="Validate", exact=True)).to_have_count(0)
+ apply_button = page.get_by_role("button", name="Apply", exact=True)
+ expect(apply_button).to_be_disabled()
+
+ runtime_section = page.locator("#section-runtime")
+ runtime_section.get_by_role("button", name="Show advanced", exact=True).click()
+ timeout_input = runtime_section.locator("#field-PROVIDER_PROGRESS_TIMEOUT")
+ timeout_input.fill("0")
+ expect(page.locator("#dirtyState")).to_have_text("1 unsaved change")
+ expect(apply_button).to_be_enabled()
+
+ apply_button.click()
+
+ expect(page.locator("#messageArea")).to_contain_text("PROVIDER_PROGRESS_TIMEOUT")
+ expect(timeout_input).to_have_value("0")
+ expect(page.locator("#dirtyState")).to_have_text("1 unsaved change")
+ expect(apply_button).to_be_enabled()
+ assert config_mutations == [("POST", "apply")]
diff --git a/pyproject.toml b/pyproject.toml
index e88847fc..b12141f7 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
[project]
name = "free-claude-code"
-version = "5.15.5"
+version = "5.15.6"
description = "Local proxy connecting coding agents to OpenAI-compatible AI providers"
readme = "README.md"
requires-python = ">=3.14.0"
diff --git a/src/free_claude_code/api/admin_routes.py b/src/free_claude_code/api/admin_routes.py
index a7e9ecbc..0da2d0ed 100644
--- a/src/free_claude_code/api/admin_routes.py
+++ b/src/free_claude_code/api/admin_routes.py
@@ -16,7 +16,6 @@ from free_claude_code.application.connected_accounts import (
)
from free_claude_code.application.model_metadata import ProviderModelRefreshResult
from free_claude_code.config.admin.manifest import FIELD_BY_KEY
-from free_claude_code.config.admin.persistence import validate_updates
from free_claude_code.config.admin.values import load_config_response, load_value_state
from free_claude_code.config.model_refs import configured_chat_model_refs
from free_claude_code.config.provider_catalog import (
@@ -111,12 +110,6 @@ async def get_admin_config(request: Request):
return load_config_response()
[email protected]("/admin/api/config/validate")
-async def validate_admin_config(payload: AdminConfigPayload, request: Request):
- require_loopback_admin(request)
- return validate_updates(_filtered_values(payload.values))
-
-
@router.post("/admin/api/config/apply")
async def apply_admin_config(
payload: AdminConfigPayload,
diff --git a/src/free_claude_code/api/admin_static/admin.js b/src/free_claude_code/api/admin_static/admin.js
index 5846096a..3c9a89ea 100644
--- a/src/free_claude_code/api/admin_static/admin.js
+++ b/src/free_claude_code/api/admin_static/admin.js
@@ -93,7 +93,6 @@ async function load() {
byId("configPath").textContent = config.paths.managed;
await refreshConnectedAccounts();
await hydrateModelOptions();
- await validate(false);
await refreshLocalStatus();
updateDirtyState();
showMessage("");
@@ -1022,32 +1021,13 @@ function updateDirtyState() {
byId("applyButton").disabled = count === 0;
}
-async function validate(showResult = true) {
- const result = await api("/admin/api/config/validate", {
- method: "POST",
- body: JSON.stringify({ values: changedValues() }),
- });
- if (showResult) {
- showValidationResult(result);
- }
- return result;
-}
-
-function showValidationResult(result) {
- if (result.valid) {
- showMessage("Config shape is valid", "ok");
- } else {
- showMessage(result.errors.join("; "), "error");
- }
-}
-
async function apply() {
const result = await api("/admin/api/config/apply", {
method: "POST",
body: JSON.stringify({ values: changedValues() }),
});
if (!result.applied) {
- showValidationResult(result);
+ showMessage(result.errors.join("; "), "error");
return;
}
const restart = result.restart || {};
@@ -1195,7 +1175,6 @@ function showMessage(message, kind = "") {
area.className = `message-area ${kind}`.trim();
}
-byId("validateButton").addEventListener("click", () => validate(true));
byId("applyButton").addEventListener("click", apply);
document.addEventListener("pointerdown", (event) => {
state.modelComboboxes.forEach((combobox) => {
diff --git a/src/free_claude_code/api/admin_static/index.html b/src/free_claude_code/api/admin_static/index.html
index 2e4cca2a..16f90644 100644
--- a/src/free_claude_code/api/admin_static/index.html
+++ b/src/free_claude_code/api/admin_static/index.html
@@ -81,7 +81,6 @@
</div>
<div id="messageArea" class="message-area"></div>
<div class="action-buttons">
- <button id="validateButton" class="secondary-button" type="button">Validate</button>
<button id="applyButton" class="primary-button" type="button" disabled>Apply</button>
</div>
</footer>
diff --git a/src/free_claude_code/config/admin/persistence.py b/src/free_claude_code/config/admin/persistence.py
index 851fa7cd..f71e5f9a 100644
--- a/src/free_claude_code/config/admin/persistence.py
+++ b/src/free_claude_code/config/admin/persistence.py
@@ -105,12 +105,6 @@ def target_values_with_updates(
return values
-def validate_updates(updates: Mapping[str, ConfigInputValue]) -> JsonObject:
- """Validate partial Admin updates and return a masked sparse preview."""
-
- return prepare_admin_update(updates).validation_response()
-
-
def changed_pending_fields(
updates: Mapping[str, ConfigInputValue],
*,
diff --git a/tests/api/test_admin.py b/tests/api/test_admin.py
index 5d6d392d..71175245 100644
--- a/tests/api/test_admin.py
+++ b/tests/api/test_admin.py
@@ -129,11 +129,11 @@ def test_admin_http_errors_are_never_cached(
assert response.headers["cache-control"] == "no-store"
-def test_admin_validation_errors_are_never_cached(monkeypatch, tmp_path):
+def test_admin_apply_payload_validation_errors_are_never_cached(monkeypatch, tmp_path):
_set_home(monkeypatch, tmp_path)
response = _local_client(create_test_app()).post(
- "/admin/api/config/validate",
+ "/admin/api/config/apply",
content="{",
headers={"Content-Type": "application/json"},
)
@@ -802,41 +802,43 @@ def test_admin_apply_masked_or_blank_secret_is_unchanged(
assert "OPENROUTER_API_KEY=original-secret" in env_file.read_text(encoding="utf-8")
-def test_admin_validate_rejects_bad_model_shape(monkeypatch, tmp_path):
+def test_admin_apply_rejects_bad_model_shape(monkeypatch, tmp_path):
_set_home(monkeypatch, tmp_path)
_clear_process_config(monkeypatch)
app = create_test_app()
response = _local_client(app).post(
- "/admin/api/config/validate",
+ "/admin/api/config/apply",
json={"values": {"MODEL": "missing-provider-prefix"}},
)
assert response.status_code == 200
body = response.json()
+ assert body["applied"] is False
assert body["valid"] is False
assert any("provider type" in error for error in body["errors"])
-def test_admin_validate_rejects_duplicate_model_fallbacks(monkeypatch, tmp_path):
+def test_admin_apply_rejects_duplicate_model_fallbacks(monkeypatch, tmp_path):
_set_home(monkeypatch, tmp_path)
_clear_process_config(monkeypatch)
app = create_test_app()
duplicate = "groq/vendor/model,groq/vendor/model"
response = _local_client(app).post(
- "/admin/api/config/validate",
+ "/admin/api/config/apply",
json={"values": {"MODEL_FALLBACKS": duplicate}},
)
assert response.status_code == 200
body = response.json()
+ assert body["applied"] is False
assert body["valid"] is False
assert any("duplicate" in error.lower() for error in body["errors"])
@pytest.mark.parametrize("proxy_key", _catalog_proxy_env_keys())
-def test_admin_validate_rejects_invalid_catalog_provider_proxy(
+def test_admin_apply_rejects_invalid_catalog_provider_proxy(
monkeypatch,
tmp_path,
proxy_key,
@@ -846,12 +848,13 @@ def test_admin_validate_rejects_invalid_catalog_provider_proxy(
invalid_proxy = "not-a-proxy://user:[email protected]:8080"
response = _local_client(create_test_app()).post(
- "/admin/api/config/validate",
+ "/admin/api/config/apply",
json={"values": {proxy_key: invalid_proxy}},
)
assert response.status_code == 200
body = response.json()
+ assert body["applied"] is False
assert body["valid"] is False
assert body["errors"] == [
(
@@ -873,16 +876,17 @@ def test_admin_validate_rejects_invalid_catalog_provider_proxy(
" http://127.0.0.1:8080 ",
),
)
-def test_admin_validate_accepts_httpx_provider_proxy(monkeypatch, tmp_path, proxy):
+def test_admin_apply_accepts_httpx_provider_proxy(monkeypatch, tmp_path, proxy):
_set_home(monkeypatch, tmp_path)
_clear_process_config(monkeypatch)
response = _local_client(create_test_app()).post(
- "/admin/api/config/validate",
+ "/admin/api/config/apply",
json={"values": {"OPENAI_PROXY": proxy}},
)
assert response.status_code == 200
+ assert response.json()["applied"] is True
assert response.json()["valid"] is True
@@ -896,17 +900,18 @@ def test_admin_validate_accepts_httpx_provider_proxy(monkeypatch, tmp_path, prox
"http://proxy.example:notaport",
),
)
-def test_admin_validate_rejects_unusable_provider_proxy(monkeypatch, tmp_path, proxy):
+def test_admin_apply_rejects_unusable_provider_proxy(monkeypatch, tmp_path, proxy):
_set_home(monkeypatch, tmp_path)
_clear_process_config(monkeypatch)
response = _local_client(create_test_app()).post(
- "/admin/api/config/validate",
+ "/admin/api/config/apply",
json={"values": {"OPENAI_PROXY": proxy}},
)
assert response.status_code == 200
body = response.json()
+ assert body["applied"] is False
assert body["valid"] is False
assert len(body["errors"]) == 1
assert body["errors"][0].startswith("OPENAI_PROXY: must be a proxy URL")
@@ -983,7 +988,7 @@ def test_admin_apply_validates_retained_proxy_and_allows_removal(
@pytest.mark.parametrize("submitted", (MASKED_SECRET, "", " "))
-def test_admin_validate_preserves_valid_stored_proxy_secret(
+def test_admin_apply_preserves_valid_stored_proxy_secret(
monkeypatch,
tmp_path,
submitted,
@@ -998,12 +1003,13 @@ def test_admin_validate_preserves_valid_stored_proxy_secret(
)
response = _local_client(create_test_app()).post(
- "/admin/api/config/validate",
+ "/admin/api/config/apply",
json={"values": {"OPENAI_PROXY": submitted}},
)
assert response.status_code == 200
body = response.json()
+ assert body["applied"] is True
assert body["valid"] is True
assert "OPENAI_PROXY=********" in body["env_preview"]
assert "password" not in response.text
diff --git a/uv.lock b/uv.lock
index d6fe5031..b5902b64 100644
--- a/uv.lock
+++ b/uv.lock
@@ -607,7 +607,7 @@ wheels = [
[[package]]
name = "free-claude-code"
-version = "5.15.5"
+version = "5.15.6"
source = { editable = "." }
dependencies = [
{ name = "aiohttp" },