Replies: 2 comments
|
同款情况,补充一个数据点:
两个可改进点:① 升级时迁移/自动映射被改名的预设默认值;② RPC 失败时前端至少给个 toast,而不是静默无反应。 |
|
Confirmed against the source — this is a real, reproducible bug with a clean mechanism, and you've nailed both halves of it. Server-side (the actual failure). const wanted = id ?? this.defaultId
const presets = await this.list()
const found = presets.find(preset => preset.id === wanted)
if (found === undefined) {
const available = presets.map(preset => preset.id)
throw new RemoteError('agent-preset/not-found', `preset "${wanted}" not found (available: ...)`, {...})
}
Client-side (the silent swallow). Fantasymax's datapoint is the aggravating half: Fix shape (two sides, both worth doing):
This is a compact, well-contained bug — the server half is genuinely fixable in |
Uh oh!
There was an error while loading. Please reload this page.
Summary
When a shipped agent preset is renamed (e.g.
code→ptcin 3ca9c7d), a user who previously selected the old preset as their default keepsagent-presets.default: codein~/.dsh/settings.yaml. From then on, every new-session creation that relies on the default fails withagent-preset/not-found, and in the Web UI the failure is only visible as repeatedconsole.warnoutput.Reproduction
codepreset, selectcodeas the default agent preset (writesagent-presets.default: codeto$DSH_HOME/settings.yaml).codewas renamed toptc(available roster:standard, ptc, minimal, cordis, ...).Actual:
SessionCreateError: session create failed: agent-preset/not-found: agent-presets: preset "code" not found (available: standard, ptc, minimal, cordis, liangshen)— repeated, because the workspace navigation watcher (packages/client/ui-workspace/src/client/navigation.ts) resets towaitingafter each failure and retries. The user sees a silently broken "new session" button; only devtools shows the cause.Expected: a stale default preset is migrated, cleared, or surfaced — never a hard failure loop.
Root cause
settings?.get().default ?? config.default(packages/preset/agent-presets/src/index.ts,defaultId). The user-layer value is trusted verbatim;resolvethen reports the missing id.agent-presets/src/index.ts, themutatecall unsetting["default"]after delete), but a rename in the shipped roster is not a deletion through any code path — nothing clears or migrates the stale value.ClientSessions.create({ workspaceId })) has no fallback when the default fails to resolve.Suggested directions (pick one or combine)
config.default(or the first roster entry) when the user-layer default is absent from the roster, and log/emit a visible notice instead of failing.code→ptc).Option 1 or 2 fixes the general case; option 3 only patches this specific rename.
Workaround
Edit
$DSH_HOME/settings.yamland changeagent-presets.defaultto an existing preset id (or remove the key), or re-select the default preset in the settings UI.All reactions