Skip to content

fix(workspace): complete session-id remap (relationships + pins) at reload/switch sites (#248) - #274

Merged
Juliusolsson05 merged 1 commit into
mainfrom
fix/session-id-coherence
Jun 14, 2026
Merged

Juliusolsson05 merged 1 commit into
mainfrom
fix/session-id-coherence

Conversation

@Juliusolsson05

Copy link
Copy Markdown
Owner

From the codebase-wide id-coherence audit you asked for. Closes the remaining incomplete-remap gaps of the same class as #266/#267/#271/#272/#273.

Bug

replaceSession (reload / provider-switch / resume / rewind) and reloadAgentSessions ("reload all") mint fresh session ids but only remapped the tile tree, detached/dispatch focus, and tiled lanes — not:

  • SessionMeta relationship pointers (linkedParentId / orchestrationParentId / orchestrationRootId). A linked/orchestration child of a reloaded agent kept pointing at the now-dead parent id → renders top-level, and parent-scoped orchestration MCP reads break.
  • pinnedSessionIds — a pinned agent that got a fresh id silently dropped out of the Pinned section.

Only rehydrate handled relationship pointers (via remapSessionMetaRelationships).

Fix

  • New neutral module src/renderer/src/workspace/idRemap.ts (avoids a persistence↔actions import cycle), housing the moved remapSessionMetaRelationships plus remapSessionsRelationships (remap pointers across a whole sessions record — so a session whose id changed has every other session's pointer to it updated) and remapPinnedSessionIds.
  • Applied both at replaceSession and reloadAgentSessions. rehydrate now imports the shared helper (re-exported there for its historical import path).

Scope / deferrals (deliberate, with rationale)

Kept to the clearly-correct, in-store, unmitigated fixes. Explicitly deferred to their own follow-ups:

  • switchProvider malformed synthetic ClaudeEntry (missing uuid/parentUuid/timestamp) — real, but needs the transcript-translation/resume contract investigated first; not a safe ride-along in a state-coherence PR.
  • spotlight/reader "follow on remap" — cross-slice plumbing, and already cleared by useSpotlight/ReaderModeSanity (UX polish, not correctness).
  • undoClose relationship preservation — deeper issue: restored sessions get their meta from spawn(), which doesn't carry relationship fields at all.
  • UiShell transient modal ids (bury/view-prompts/rewind/etc.) — cross-store, low value.

The audit also gave a clean bill to the IPC subscription layer and confirmed no other updateRuntime-class "method called but not exposed" bugs.

Verification

  • 0 type errors in any touched file (baseline unchanged at 4 pre-existing).
  • Full npm run build green.
  • ⚠️ Live confirm after rebuild+restart: reload a parent that has a linked/orchestration child → child stays nested under it; reload a pinned agent → it stays pinned.

No new test files (repo convention).

From the codebase-wide id-coherence audit. replaceSession (reload /
provider-switch / resume / rewind) and reloadAgentSessions ('reload all')
mint fresh session ids but only remapped the tile tree, detached/dispatch
focus, and tiled lanes — NOT the SessionMeta relationship pointers
(linkedParentId / orchestrationParentId / orchestrationRootId) or the pinned
list. So a linked/orchestration CHILD of a reloaded agent kept pointing at
the dead parent id (rendering top-level, breaking parent-scoped orchestration
reads), and a pinned agent silently dropped out of the Pinned section on
reload. Only rehydrate handled relationships.

- Move remapSessionMetaRelationships to a neutral src/.../workspace/idRemap.ts
  (avoids a persistence<->actions import cycle) and add remapSessionsRelationships
  (remap pointers across a whole sessions record) + remapPinnedSessionIds.
- Apply both at replaceSession and reloadAgentSessions. rehydrate now imports
  the shared helper (re-exported for its historical import path).

Deferred to their own follow-ups (documented in the PR): switchProvider's
malformed synthetic ClaudeEntry (needs the transcript-translation contract
investigated, not a safe ride-along), spotlight/reader 'follow on remap'
(cross-slice; already sanity-hook-cleared), undoClose relationship preservation
(deeper: restored sessions get meta from spawn(), which drops relationships
entirely), and UiShell transient modal ids.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant