You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
One dangling workspace id in workspace.json takes the whole plugin tree down
#13381
One dangling workspace id in workspace.json takes the whole plugin tree down
Category: General
Environment
DSH 0.2.2-rc.3, desktop app, Windows 10
Reproduced twice on the same machine; the second time nothing had been upgraded in between.
What happened
On startup the workspace list rendered empty, session history was invisible, and every workspace action failed with:
typert gateway: workspace/create: active Service "workspaceController" is unavailable
Eight plugins stayed pending in the plugin manager (workspace-controller, session-controller, ui-deliverables, …). The app was unusable but showed no obvious error to the user.
Root cause
~/.dsh/storages/workspace.json had an entry in global.workspaceIds whose entity was missing from tables.workspaces:
On startup validateStoredState throws (no pendingMutation marker present):
workspace domain is inconsistent: registry order references missing workspace '90f0fb05-a170-4a93-907c-41bec2e50956'
The workspace domain therefore never comes up, everything that injects workspaceController stays pending, and the UI renders blank. A dangling session id in archivedSessionIds / pinnedSessionIds appears to have the same effect.
Why this looks like it shouldn't be reachable through the API
WorkspaceRegistry.deleteKnown (dsh-workspace/src/index.ts:607-651) is ordered:
setState() — remove from order, set pendingMutation: { delete }
table.delete()
setState() — clear the marker
and recoverPendingMutation() (:658) replays deletions that still carry the marker. So the normal delete path should never leave "in order, not in table". In my case something wrote the JSON file directly, bypassing the Service — but the result is a state the app cannot boot from, and there is no way for the user to recover from inside the UI.
Suggested fixes
Degrade instead of throwing. Treat "registry order references a missing entity" as a recoverable inconsistency: log a warning, drop the orphan id, continue booting. This is the difference between "one lost workspace" and "the app does not start".
Widen recoverPendingMutation. Make it cover every delete path rather than only ones that still carry the marker, so an interrupted or out-of-band write gets repaired on next boot.
Make the failure legible. The thrown message carries no file path or field name. Emitting workspace.json: global.workspaceIds[3] references missing workspace <id> would let users fix it without reading the source.
Workaround
A tiny checker that validates both directions (order → table, table → order), plus archivedSessionIds/pinnedSessionIds against the session files on disk, backs up the file, and rewrites it if needed. Happy to paste it here if anyone else hits this.
Side note, not a bug: turning on has_issues for triage-friendly reports might be worth it — Discussions is fine for design talks, but a crash-on-startup report gets lost among them.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
One dangling workspace id in
workspace.jsontakes the whole plugin tree downCategory: General
Environment
0.2.2-rc.3, desktop app, Windows 10What happened
On startup the workspace list rendered empty, session history was invisible, and every workspace action failed with:
Eight plugins stayed
pendingin the plugin manager (workspace-controller,session-controller,ui-deliverables, …). The app was unusable but showed no obvious error to the user.Root cause
~/.dsh/storages/workspace.jsonhad an entry inglobal.workspaceIdswhose entity was missing fromtables.workspaces:{ "global": { "workspaceIds": ["a", "b", "c", "90f0fb05-a170-4a93-907c-41bec2e50956"], "defaultWorkspaceId": "..." }, "tables": { "workspaces": { "a": {…}, "b": {…}, "c": {…} } } }On startup
validateStoredStatethrows (nopendingMutationmarker present):The workspace domain therefore never comes up, everything that injects
workspaceControllerstays pending, and the UI renders blank. A dangling session id inarchivedSessionIds/pinnedSessionIdsappears to have the same effect.Why this looks like it shouldn't be reachable through the API
WorkspaceRegistry.deleteKnown(dsh-workspace/src/index.ts:607-651) is ordered:setState()— remove from order, setpendingMutation: { delete }table.delete()setState()— clear the markerand
recoverPendingMutation()(:658) replays deletions that still carry the marker. So the normal delete path should never leave "in order, not in table". In my case something wrote the JSON file directly, bypassing the Service — but the result is a state the app cannot boot from, and there is no way for the user to recover from inside the UI.Suggested fixes
recoverPendingMutation. Make it cover every delete path rather than only ones that still carry the marker, so an interrupted or out-of-band write gets repaired on next boot.workspace.json: global.workspaceIds[3] references missing workspace <id>would let users fix it without reading the source.Workaround
A tiny checker that validates both directions (order → table, table → order), plus
archivedSessionIds/pinnedSessionIdsagainst the session files on disk, backs up the file, and rewrites it if needed. Happy to paste it here if anyone else hits this.Side note, not a bug: turning on
has_issuesfor triage-friendly reports might be worth it — Discussions is fine for design talks, but a crash-on-startup report gets lost among them.All reactions