Skip to content

refactor(conversations): track continuation episodes - #957

Closed
Neonforge98 wants to merge 1 commit into
codex/work-item-continuation-cli-accountfrom
codex/conversation-continuation-episodes
Closed

refactor(conversations): track continuation episodes#957
Neonforge98 wants to merge 1 commit into
codex/work-item-continuation-cli-accountfrom
codex/conversation-continuation-episodes

Conversation

@Neonforge98

@Neonforge98 Neonforge98 commented Aug 25, 2026

Copy link
Copy Markdown
Collaborator

Problem

Persistent Work Item continuations only kept one mutable pointer. A runtime roll erased why it happened, old and new desktop windows could overwrite each other's storage format, accepted turns could be acknowledged after a failed persistence write, and live overlays were keyed only by root session id instead of organization plus root.

Solution

  • Model each reusable runner as a bounded prepared/active/retired/failed episode lineage, including supersession and explicit roll reasons.
  • Persist the new envelope under an independent v2 key, read v2 first, migrate immutable v1 data on first mutation, and retain an empty v2 tombstone so stale v1 writes never reappear.
  • Make correctness writes fail closed with exact read-after-write verification; do not acknowledge an adapter-accepted bootstrap if the active episode cannot be established durably.
  • Scope live runner overlays by the canonical organization/root plane key.

Potential risks

  • The state is still backed by WebView localStorage in this PR; the next stack layer moves authoritative execution state into sessions.db. This PR prevents silent write failure but cannot recover storage deleted after a successful write or provide a cross-window transaction.
  • v2 intentionally shadows later v1 writes. Rollback to an older build sees the untouched v1 snapshot, while returning to this build resumes v2.
  • Rollback: revert commit 737bc8c; no server or database migration is included.

Verification

  • pnpm exec vitest run src/features/Org2Cloud/SessionConversation/conversationContinuation.test.ts src/features/Org2Cloud/SessionConversation/activeConversationRunnersAtom.test.ts src/features/Org2Cloud/SessionConversation/conversationExecutionStore.test.ts src/features/Org2Cloud/SessionConversation/conversationTurnRunner.test.ts src/features/Org2Cloud/SessionConversation/workItemConversationTurnBridge.test.ts src/features/Org2Cloud/SessionConversation/cloudConversationRuntime.test.ts (54 tests passed)
  • pnpm exec eslint on all 13 changed TypeScript files
  • pnpm exec tsc --noEmit
  • Commit hook: lint-staged, scoped TypeScript check, staged-file audit passed

Stack

Base: #951 (codex/work-item-continuation-cli-account)

This is the episode-lineage and correctness foundation for native checkpoint/rebase and encrypted device handoff follow-up PRs.

@Neonforge98
Neonforge98 force-pushed the codex/conversation-continuation-episodes branch from 646745e to 737bc8c Compare August 25, 2026 11:08
@Harry19081 Harry19081 added refactor Code restructuring without an intended behavior change cloud-collaboration Cloud sync, organizations, channels, or collaboration sessions Sessions, history, replay, sidebar, workspace, or worktrees labels Aug 25, 2026
@Neonforge98

Copy link
Copy Markdown
Collaborator Author

Closing this experimental continuation stack after architecture review. ORG2 will reuse the existing full Team Session continuation path instead of shipping a parallel checkpoint/materializer system. The branch is preserved for audit; nothing from this stack should be merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cloud-collaboration Cloud sync, organizations, channels, or collaboration refactor Code restructuring without an intended behavior change sessions Sessions, history, replay, sidebar, workspace, or worktrees

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants