fix(dashboard): Config page header shows the switched profile's config.yaml path (#44374)

The Config page read config_path from /api/status, which is machine-global
and always reports the profile the dashboard process was started under.
After switching profiles with the global switcher, the header kept showing
the old profile's path (e.g. /root/.hermes/profiles/worker_1/config.yaml)
even though reads/writes correctly targeted the new profile.

Fix: /api/config/raw now returns the resolved path alongside the YAML
(resolved inside _profile_scope, so it follows ?profile=). ConfigPage
prefers that scoped path and only falls back to /api/status for old
servers. ProfileKeyedRoutes already remounts the page on switch, so the
header refreshes immediately.
This commit is contained in:
Teknium
2026-06-11 09:46:15 -07:00
committed by GitHub
parent 9121834b31
commit c7bfc938d5
4 changed files with 31 additions and 4 deletions
+9 -2
View File
@@ -9374,11 +9374,18 @@ class RawConfigUpdate(BaseModel):
@app.get("/api/config/raw")
async def get_config_raw(profile: Optional[str] = None):
"""Raw config.yaml text plus its resolved path.
``path`` is resolved inside ``_profile_scope`` so the Config page header
shows the file the switched profile actually reads/writes /api/status's
``config_path`` is machine-global and always reports the dashboard
process's own profile, which is wrong under the global profile switcher.
"""
with _profile_scope(profile):
path = get_config_path()
if not path.exists():
return {"yaml": ""}
return {"yaml": path.read_text(encoding="utf-8")}
return {"yaml": "", "path": str(path)}
return {"yaml": path.read_text(encoding="utf-8"), "path": str(path)}
@app.put("/api/config/raw")