Skip to content

Recover partial TaskHistoryStore.atomicUpdatePair lifecycle writes #1540

Description

@coderabbitai

Summary

Make partial lifecycle writes from TaskHistoryStore.atomicUpdatePair() recoverable without requiring an extension restart.

Problem

atomicUpdatePair() uses ordered, non-transactional persistence. It writes the child record before the parent record. If the parent write fails after the child write succeeds, the child can persist as completed while the parent remains delegated and still references the child.

Startup reconciliation repairs this split after the next launch. The current delegation handoff fails in the active session and has no durable rollback or retry path.

Required changes

  • Define recovery semantics for a failure after the first write in TaskHistoryStore.atomicUpdatePair().
  • Implement a durable rollback, retry, journal, or equivalent recovery mechanism so paired lifecycle records converge before the failure is reported to the caller.
  • Preserve the existing lifecycle transition rules and concurrent-update protections.
  • Update reopenParentFromDelegation() only as required to use the revised persistence contract.

Affected areas

  • src/core/task-persistence/TaskHistoryStore
  • src/core/webview/ClineProvider.ts (reopenParentFromDelegation)
  • Task-persistence and delegation lifecycle tests

Acceptance criteria

  • If the second write fails after the first succeeds, the parent and child records converge without an extension restart.
  • The implementation does not silently detach or lose parent-child delegation metadata.
  • Tests simulate a second-write failure and verify the final durable state is consistent.
  • Existing startup reconciliation remains safe for interrupted processes and legacy split states.

Backlinks

Activity

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions