Skip to content

fix(gateway): dashboard config save applies JSON and reloads live settings - #58

Draft
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-management-72e7
Draft

fix(gateway): dashboard config save applies JSON and reloads live settings#58
cursor[bot] wants to merge 1 commit into
mainfrom
cursor/critical-bug-management-72e7

Conversation

@cursor

@cursor cursor Bot commented Jul 24, 2026

Copy link
Copy Markdown

Bug and impact

The gateway dashboard Config page sends JSON (model, max_tokens, temperature, etc.) via PUT /api/config, but the handler wrote the body directly to config.toml and validated it as TOML. Saves either failed with 400 Invalid TOML or, if raw TOML was posted manually, never updated in-memory provider/router settings until SIGHUP/restart.

User impact: Operators believe settings were saved (UI shows "Saved") while the agent continues using stale model/temperature — significant configuration breakage.

Root cause

  1. Contract mismatch between web/js/app.js (JSON) and handle_config_put (raw TOML).
  2. Missing try_config_reload() after successful disk write.

Fix

  • Detect JSON bodies and patch existing config.toml in-place for dashboard fields (config_patch_dashboard_json).
  • Preserve raw TOML upload behavior for power users.
  • Call try_config_reload() after a successful save so live providers/gateway pick up changes immediately.

Validation

  • build/test_config_patch — unit tests for JSON patching and validation.
  • build/test_gateway_http — integration test test_api_config_put_json verifies PUT + GET returns updated model/max_tokens.
Open in Web View Automation 

PUT /api/config accepted raw TOML while the web UI sends JSON, so saves
either failed validation or never updated in-memory provider settings.
Patch known dashboard fields into config.toml and call try_config_reload
after a successful write.

Co-authored-by: esadrianno <esadrianno@gmail.com>
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.

1 participant