Repository navigation
[BUG] Changing cordis.patch.yml while sessions are running kills every running session mid-turn #8857
terri-yaki
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
If the profile patch file changes while sessions are running, all of them are disposed at the same moment, in the middle of a turn. In the UI the sessions just disappear, which looks like they were deleted. They aren't — the logs are still on disk — but only the session you reopen comes back.
I hit this on DSH desktop (0.2.0-rc.2), profile
desktop, Windows 11.What I did
I was working on a small plugin whose installer writes a managed block into the profile's
cordis.patch.yml— the same file the Plugin Manager writes. I had two sessions open in one workspace, both mid-turn, and ran the installer.What happened
About two seconds later both sessions ended at almost the same instant, 34 ms apart, while still working.
The first thing that broke was an in-flight tool call:
{"type":"tool/ptc-dispatch","seq":333,"data":{ "name":"job_output", "arguments":{"job_id":"pwsh-124","wait":true,"timeout_ms":480000}, "isError":true, "content":[{"type":"text","text":"Error: cannot get required service \"jobs\" in inactive context"}]}}Then both sessions recorded the same turn end — first the unrelated one, then the session that ran the installer:
{"type":"turn/end","seq":336,"data":{"turn":1, // session B (the unrelated one) "reason":{"kind":"aborted","reason":{"kind":"disposed"}}}}{"type":"turn/end","seq":827,"data":{"turn":1, // session A (ran the installer) "reason":{"kind":"aborted","reason":{"kind":"disposed"}}}}One of them was the session that ran the installer; the other was an unrelated session in the same profile, waiting on a background job. The second session was not doing anything to its configuration.
The same thing happened again later, this time to the session that ran an uninstall of the same plugin. Its tool call came back with a job id that no longer existed, and then the turn aborted the same way:
{"type":"tool/call","seq":849,"data":{"name":"pwsh", "arguments":"{\"command\": \"node scripts/install.mjs --uninstall …\"}"}} {"type":"tool/result","seq":850,"data":{ "message":{"role":"tool","content":[{"type":"text","text":"Error: unknown job pwsh-141"}], "isError":true}}} {"type":"turn/end","seq":852,"data":{"turn":2, "reason":{"kind":"aborted","reason":{"kind":"disposed"}}}}Timeline (local time):
What I expected
Reloading the plugin row that changed, or (if a reload has to interrupt sessions) waiting until they're idle and saying so. I did not expect a config write to end turns in other sessions.
Where it seems to come from
@deepseek-ai/dsh-hmrwatches both patch layers and reconciles them on change:reconcileProfilePatchesthen updates the root Include with the full new patch list:Updating the root include rebuilds the tree, so live session and agent scopes get disposed. The agent loop cancels the running turn with cause
disposed(dsh-agent-loop/lib/index.js:1688,:1906), which is what shows up asturn/end {"kind":"aborted","reason":{"kind":"disposed"}}(:737,:1012). The tool errors above are the same event seen from inside an in-flight call: the services it needed were already gone.The ~2 second delay matches the chokidar
awaitWriteFinishwindow that config watches use by default (dsh-hmr/lib/index.js:52).The dsh-hmr README says this behaviour is intended ("Profile and home patch changes also trigger recomposition"), so I'm reporting the effect on running sessions rather than the reload itself.
Steps to reproduce
desktop).%USERPROFILE%\.dsh\profiles\desktop\cordis.patch.yml(adding or removing one plugin row is enough; Plugin Manager's enable/disable does the same thing).Worth knowing before you try it: this kills the running sessions, so don't do it in a session you need.
Notes
dsh-session-persistence-jsonl/README.mdsays nothing deletes session files, and both logs are intact (%USERPROFILE%\.dsh\sessions\<workspace>\<session-id>\session.v4.jsonl.zstd), with their entries still present instorages\workspace.json.{"kind":"disposed"}is indistinguishable from a user cancel in the transcript, and the tool errors read like broken infrastructure (cannot get required service "jobs" in inactive context) rather than "the host reloaded". That's the part that made this look like data loss to me.Environment
All reactions