Repository navigation
Replies: 1 comment
|
Your mechanism holds on the current tree — I re-read all four of the places you cite at
Where I would push back on one sentence: "there is no re-attach path" is half true. The write side is already public and already used by other flows: async attachSession(sessionId) // packages/workspace/workspace/src/entity.tsIt re-reads the stored header, re-canonicalizes
One It censuses stored headers against the published workspaces using the registry's own
plus one tool, Verification, in case it is useful to you: 71 assertions over the census, the repair loop, the renderers and the tool path; a 20-arm mutation harness where each arm breaks one decision and the suite must fail — 19 caught, and the 20th is a deliberate semantic no-op that the harness requires to survive, which is what shows the other 19 fail for the reason claimed. The suite was run against both Two limits that matter for your four triggers:
Your cause #1 (the directory was renamed or moved on disk) is also worth calling out as out of scope on purpose: |
Uh oh!
There was an error while loading. Please reload this page.
Summary
Sessions that were created inside a specific Workspace intermittently show up under "Ungrouped" in the sidebar instead of their Workspace. Once it happens, the eviction can become permanent, even though the durable workspace record still lists the session.
Environment
0.1.7-alpha.2(source analysis at commit00102833)How "Ungrouped" is decided
ungroupedMemberIdsinpackages/client/ui-workspace/src/client/rows/WorkspaceBrowser.tsxis simply "every session not contained in anyworkspace.sessionIds". So "session moved to Ungrouped" ⇔ "some workspace'ssessionIdsno longer contains the session".Mechanism (source analysis)
Workspace.sessionIdsis a live-filtered projection, not the durable account:sessionPath(id)reads asessionPathsindex that is built only duringWorkspaceRegistrystartup (Service.init→replaceHeaderIndex(listStoredHeaders())+indexLiveSessions()inpackages/workspace/workspace/src/index.ts). There is nosession/created/ resume / persistence-change listener that keeps it current —packages/workspaceregisters nosession/createdlistener at all.Consequences:
Silent eviction on index mismatch. Any session whose canonical cwd doesn't match the workspace path at index time disappears from the membership projection with no user action involved. Concrete triggers:
workspace.pathis immutable and "never rewritten afterwards, even when the directory disappears" (packages/workspace/workspace/src/types.ts), so the divergence is permanent;fs.realpath/statfailure on the cwd during Host startup —indexHeaderrecordsinvalidSessionPathson any throw (unmounted external volume, iCloud/permission hiccup);Eviction becomes durable and destructive.
WorkspaceEntity.mutate()prunesrecord.sessionIdsthrough the same filter on every accepted workspace mutation (a rename, another session's attach, a reorder…). So a transient indexing miss is permanently written into the workspace record by the next unrelated edit.The Host feed is internally inconsistent. In
packages/api/workspace-controller/src/feed.ts,workspaceView()(used for the baseline and for new workspaces) projects the filtered live getter, whilechangedWorkspaceView()(upserts for existing workspaces) projects the rawrecord.sessionIdswith no filter. Depending on which path published the last frame, the client flips a filtered-out session between "in workspace" and "Ungrouped" — visible flip-flopping.Attach failure at creation parks the session as Ungrouped forever.
session.createpublishes the session first and attaches second (packages/api/session-controller/src/commands.ts); on attach failure the client deliberately keeps the published session visible as Ungrouped ("Publication precedes attachment",packages/api/session-controller/src/client/sessions/manager.ts). A transient cwd-resolution failure at that moment leaves the session born-Ungrouped, and nothing re-attaches it later.The only diagnostic that exists today is a startup
logger.warnper filtered candidate (reportFilteredCandidates), which is easy to miss.Reproduction hints
realpath/statfailure on the cwd during Host startup (unmounted external volume, iCloud/permission hiccup) → same result after restart.Suggested fixes
session/createdand persistence-listing changes) instead of startup-only.workspaceViewandchangedWorkspaceViewconsistent (both filtered, or both raw with client-side reconciliation).Happy to provide my storage state (
~/.dsh/storages/workspace.json) or Host logs if useful.All reactions