fix: default the settings workspace to the active registry workspace

This commit is contained in:
2026-08-13 22:02:02 +02:00
parent 6a61c42b88
commit 10edca5a09
+13 -1
View File
@@ -99,7 +99,19 @@ export function buildApp(config: AppConfig, deps?: BuildAppDeps): FastifyInstanc
};
const getSettings = async (principal: PrincipalContext): Promise<Settings> => {
if (deps?.getSettings) return await deps.getSettings(principal);
return effectiveSettings(config, loadSettings(config));
const stored = loadSettings(config);
const effective = effectiveSettings(config, stored);
// In the registry system the legacy `harness/workspaces/*.yaml` default is obsolete: when no
// installation workspace is pinned, default to the first active registry workspace.
if (!stored.workspace) {
try {
const revisions = await workspaceRegistry.list();
if (revisions.length > 0) effective.workspace = revisions[0].id;
} catch {
// Registry not bootstrapped yet; keep the legacy fallback.
}
}
return effective;
};
const piManagement = deps?.piManagement ?? createPiManagement(config, { listModels });