Repository navigation
New-session preset pick is silently discarded, and the chip keeps showing it #7150
Replies: 3 comments
Second, more severe finding: a preset that cannot mount is reported
|
Third finding: editing a preset's module does not take effect until the process restartsWhile porting a preset-owned plugin module I hit this: the standing-mount generation did notice my edit to CauseA composition row's This narrows the gotcha documented at EvidenceI copied the very same preset directory (byte-identical, including the already-edited module) to a new preset id:
Same code, same config, same process β the only variable is the module URL. Confirmed by restarting nothing and changing nothing else. A restart makes the original behave identically to the copy. SuggestionEither make the generation stamp cover the modules the composition names, or import them through a cache-busting query β Worth noting for anyone debugging presets: this makes a module edit look like "the fix didn't work", because the composition edit does produce a visible new generation while the code behind it silently stays old. |
|
The mechanism you found is real and still present at The drop path, at
|
| your citation (0.1.5-rc.2) | same code at ddefc45 |
|---|---|
seat-store.ts:108-113 (select()) |
seat-store.ts:128-133 |
seat-store.ts:126-129 (stage() writes current) |
seat-store.ts:146-150 |
!session.blank || presetOf(session) === staged |
seat-store.ts:204 |
index.ts:123-127 ("the chip's pick predates it") |
gone; the equivalent doc is seat-store.ts:1-11 |
index.ts:143-152 (creator entry stages instead of selecting) |
index.ts:153-159 |
index.ts:69-73 (rosterReaders) |
removed β see the second defect below |
That is also why your patch does not apply as written: a stage is no longer a string | undefined field but an object { id, introduce } (seat-store.ts:46-51, constructed once at index.ts:69), because a cross-screen stage also carries the one-shot introduce cue. The equivalent edit is both this.staged.id = undefined and this.staged.introduce = false.
What that branch requires β the part I could not confirm
For seat-store.ts:204 to fire, the seat must be handed a session whose list row says blank: false. The seat only sees its bound session while the main view retains it (index.ts:75-82), and the chip itself only renders in the hero: hero && heroWorkspaceRow (packages/client/ui-conversation/src/client/skeleton/ConversationContent.tsx:159-160), where
const hero = sessionId === undefined
|| (shellPhase === 'blank' && (openState === 'open' || summaryBlank === true))(packages/client/ui-conversation/src/client/skeleton/ConversationMainPanel.tsx:39-40; identical at 0.1.5-rc.2 in ConversationRoot.tsx:272-273.) With a session id present, summaryBlank === true means the row says blank β which is the branch that does not drop the stage. So the drop needs summaryBlank !== true while shellPhase === 'blank', and conversationPhase (packages/client/ui-conversation/src/client/contract/snapshot.ts:26-34) returns 'active' as soon as !session.blank && !session.awaitingFirstTurn (or the session is running, or a target is active), falling back to 'engaging' rather than 'blank' once promptAttempted is set. promptAttempted and awaitingFirstTurn are declared at packages/api/session-controller/src/client/contract/snapshot.ts:88-90 and promptAttempted is set when a prompt is sent (packages/api/session-controller/src/client/sessions/session.ts:219, :243), so a session that has run a turn lands on 'active' β no hero, no chip.
That is a narrow window (a list row that says started while the conversation snapshot still looks blank), and I did not reproduce it. The datum that settles it is on your side and cheap: did the live pick produce an agentPresets/select call? If it produced none, this guard is the explanation. If it did produce one, the stage was not dropped here β the id it carried says which session actually took the pick, and that is what to look at next.
The label
Verified as far as the code goes, with one boundary worth stating: after a drop the snapshot keeps current = <the pick>, because nothing on that branch resets it, and it keeps it until the next load()/apply() recomputes the display from the session (seat-store.ts:100-112 on load, 196-200 on a stageless apply). Those run when the chip mounts (AgentPresetSeat.tsx:99-101) and on a write to the agent-presets settings namespace or a reconnect (index.ts:118-124). So "the chip goes on showing it" holds for the hero screen; what is unconditional is that the host is never asked.
On the fix
Worth pinning down before the guard goes: it is also the only thing keeping a retained stage from being spent on a session the pick was not made for. The stage is one object shared by every seat (index.ts:69), and the neighbouring Settings path handles the same hazard by capturing the exact session up front and re-checking it at apply time (syncBlankSession, seat-store.ts:168-177, covered by packages/client/ui-agent-preset/tests/apply.client.spec.ts:833-850). The suite also has an explicit case that a stage must not be re-applied by later list movement β packages/client/ui-agent-preset/tests/apply.client.spec.ts:655-683 ("Every later list movement would re-apply a stage that was not cleared, switching sessions the user never picked for"). Keeping the stage is the right direction; the part that needs binding is which session is allowed to spend it.
Related and worth ruling out separately, because it is plainly reachable and silent in the same way: a stage is spent by the first blank session that becomes current, and the module documents that "The stage is forgotten once applied. The next new session starts from the Host-effective default again" (seat-store.ts:9-10). So a pick that lands on one blank session while the conversation the user then has is a different one would show the same disagreement between the label and the composed session, with no error.
The test you added is not in this checkout: packages/client/ui-agent-preset/tests/apply.client.spec.ts has no case named "keeps the stage when the current session has already started". The closest existing ones are the cold-hero case at :594-630 (no session at pick time, so the stage survives) and :655-683 β and both of those pick when the current session is blank or absent, which is the asymmetry you are pointing at.
Second defect β narrower at ddefc45
rosterReaders no longer exists. The section controller now takes a rosterChanged callback (packages/client/ui-agent-preset/src/client/section-store.ts:149-160), invoked after a copy (section-store.ts:352) and after a delete (section-store.ts:402), and index.ts:89-93 fans it out to the settings controller, the unbound seat, and every bound seat. A preset copied through Settings therefore does reach the chip β asserted at packages/client/ui-agent-preset/tests/apply.client.spec.ts:564-592.
What is still unannounced is a preset authored outside this browser. The client's only refresh triggers are settings/document-updated for the agent-presets namespace and connection/reset (index.ts:118-124), and nothing else subscribes to the roster directory: the host roster emits only agent-preset/selected (packages/preset/agent-presets/src/index.ts:232) and tools/change (index.ts:696). Your "re-read the roster when the picker opens" still covers that remaining case.
Your follow-up comment (a preset that cannot mount, reported healthy)
Verified by reading the discovery path. compositionProblem() (packages/preset/agent-presets/src/discovery.ts:206-246) checks that the file parses as the loader's own YAML (219-225), that the entry list has the expected shape (227-228), and that each row's plugin resolves (232-245). The resolution check is unresolvableRows() (discovery.ts:172-193), whose only test is rowResolves(...) at line 188 β no row's config is ever applied or schema-checked at discovery time. So a row whose config no longer matches its plugin is reported healthy, exactly as you found, and the failure surfaces only when the row is actually applied: mountPreset rejects with agent-preset/invalid (packages/preset/agent-presets/src/mount.ts:417-422), as does an unreadable composition at packages/preset/agent-presets/src/index.ts:808-813.
Your third finding (a module edit invisible until restart)
Confirmed at the stamp site. compositionStamp() is a stat() of one path returning { mtimeMs, size } (packages/preset/agent-presets/src/index.ts:836-845), and the mount hands it exactly the composition file β compositionStamp(preset.path) at :805, with the staleness comparison at :785. Nothing the composition names is part of the stamp, and sameStamp compares only those two fields (:848-850). So replacing the bytes behind an unchanged module URL is invisible to it, exactly as you describe.
The precedent you cite is real: the client-plugin side puts the identity in the URL instead of the stamp β chunkUrl() appends ?rev=${rev} (packages/client/modules/src/index.ts:223-225), so a rebuilt bundle gets a new identity rather than relying on the loader to notice. Both shapes you suggested have an in-repo precedent; the cache-busting query is the smaller change, since widening the stamp means walking everything the composition references.
Not verified: I did not run a host. The live roster you pasted, the exact rendering order of the chip after a new session starts, and the contest mount failure come from your report and from reading the code, not from observation β and for the same reason the reachability question in the third section above is open, not settled.
Uh oh!
There was an error while loading. Please reload this page.
Summary
The new-session agent-preset chip silently discards the user's pick when a previously-opened conversation is still the current session β and then keeps displaying the discarded pick. The user sees the chip showing e.g.
η«θ΅ζ¨‘εΌ, starts a new conversation, and gets the deployment default instead. No error, no toast, no log entry.A second, related defect: a preset authored on disk is invisible to an already-open tab, because nothing on the wire announces a new preset file.
Both make a user-level preset look broken when it is not: throughout this report the preset itself was verified
healthyin the host roster the whole time.Environment
@deepseek-ai/dsh0.1.5-rc.2, profileweb, Windows 11standard/ptc/minimal/cordisplus user-level presets under$DSH_HOME/.agent-presetsagent-presets.defaultset to a shipped preset at the time of the reportSteps to reproduce
sessions.list.current.Actual: the new session runs the deployment default.
Expected: the new session runs the picked preset.
Root cause
packages/client/ui-agent-preset/src/client/seat-store.tsβAgentPresetSeatController.apply():select()stages the pick and then callsapply()immediately (seat-store.ts:108-113). When the current session is a started one, that immediateapply()clearsthis.staged, destroying a pick that was never meant for that session. The chip goes on rendering it becausestage()already wrotecurrent: id(seat-store.ts:126-129) and the early return never resets it.This contradicts the hero's own documented intent:
AgentPresetSeat.tsx:1-13β "the choice is only available before a conversation starts: once a turn has run, the session's history was produced under that preset's tools and the host refuses to swap them."index.ts:123-127β "Connecting a workspace either creates a blank session or reuses one, and either way the chip's pick predates it β so the stage is applied when the session arrives, not when it was made."The same authors already worked around this on the settings creator entry by calling
stage()rather thanselect()(index.ts:143-152, with the comment "select()'s immediate apply would meet the still-current running session and drop the stage as unservable"). The chip was left on the path that drops it.Failing test
Added to
packages/client/ui-agent-preset/tests/apply.client.spec.ts("keeps the stage when the current session has already started"). Onmasterit fails exactly as a user would experience it:Only
listwas ever called β noselect, no error.Suggested fix
Keep the stage for the session that has yet to start, and spend it only when a session already carries the staged preset:
All 141 tests in the package pass with this change.
Second defect β an authored preset is invisible until a reload
index.ts:137-140documents the gap:The
rosterReadersset that covers this (index.ts:69-73) is only fired from the settings section's controller, so a user who never opens Settings β Agent presets keeps a roster that predates the directory.presetOptions()(settings-store.ts:114-119) filtersbrokenrows out of the chip entirely, so a stale roster shows nothing at all rather than a broken row β the failure is invisible.Suggested fix: re-read the roster when the picker is opened, which is one cheap RPC and makes the surface self-refreshing:
Why this is worth fixing
The failure mode is silent and the UI actively lies: the chip shows the preset the user picked while the host composes something else. Because
agentPresets.selectis never called, there is no refusal toast and nothing in the log β the only way to discover the truth is to read the preset id out of the stored session header. For a feature whose entire purpose is choosing a session's composition, a wrong answer with no signal is worse than a loud refusal.All reactions