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
+1 -1
View File
@@ -432,7 +432,7 @@ export const api = {
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ config }),
}),
getConfigRaw: () => fetchJSON<{ yaml: string }>("/api/config/raw"),
getConfigRaw: () => fetchJSON<{ yaml: string; path?: string }>("/api/config/raw"),
saveConfigRaw: (yaml_text: string) =>
fetchJSON<{ ok: boolean }>("/api/config/raw", {
method: "PUT",
+11 -1
View File
@@ -177,9 +177,19 @@ export default function ConfigPage() {
.getDefaults()
.then(setDefaults)
.catch(() => {});
// getConfigRaw is profile-scoped (fetchJSON appends ?profile=), so its
// `path` reflects the switched profile's config.yaml. /api/status's
// config_path is machine-global (the dashboard's own profile) — wrong
// header under the global profile switcher, so it's only a fallback.
api
.getConfigRaw()
.then((resp) => {
if (resp.path) setConfigPath(resp.path);
})
.catch(() => {});
api
.getStatus()
.then((resp) => setConfigPath(resp.config_path))
.then((resp) => setConfigPath((prev) => prev ?? resp.config_path))
.catch(() => {});
}, []);