Merge branch 'stack/agent-profiles-7-docs' into stack/agent-profiles-8-authoring

# Conflicts:
#	packages/client/ui-agent-preset/src/client/settings-store.ts
#	packages/client/ui-agent-preset/tests/settings-store.spec.ts
#	packages/host/apiproxy/src/api-proxy.ts
#	packages/host/apiproxy/tests/api-proxy-agent-preset.spec.ts
This commit is contained in:
Yichen Jiang
2026-08-07 11:49:30 +08:00
7 changed files with 162 additions and 38 deletions

View File

@@ -246,11 +246,16 @@ export class AgentPresets extends Service {
try {
await mountPreset(agentCtx, preset)
} catch (error) {
if (previous !== undefined && previous !== preset.id) {
if (previous !== undefined) {
// Restored unconditionally, same id included: the roster is a live
// directory, so "the same inputs that worked a moment ago" does not
// hold — the file may have changed between the original mount and
// this one, which is exactly how a same-id reselect fails. Skipping
// the restore there left the agent with no composition at all.
await this.mount(agentCtx, previous).catch(() => {
// The agent now has no composition, but the switch failure below is
// the actionable diagnostic and the restore had the same inputs that
// worked a moment ago; reporting its failure instead would hide why.
// the actionable diagnostic; reporting the restore's instead would
// hide why the switch was attempted and what the operator must fix.
})
}
throw error