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
test: cover a deferred save crossing ClineProvider.abandonSubtask (cross-layer regression) #2150
PR #1496 fixes #1021: a fire-and-forget Task#saveClineMessages() could run updateTaskHistory() after ClineProvider#abandonSubtask()'s atomicUpdatePair() cleared the child's parentTaskId/rootTaskId, silently reattaching the severed link. The fix adds an abandoned guard in Task#saveClineMessages() and unit coverage in src/core/task/__tests__/Task.spec.ts.
CodeRabbit's review asked for a cross-layer integration regression test: seed live parent/root ids, defer the message save across a real ClineProvider.abandonSubtask() call, and assert the persisted child history stays detached while the parent becomes active.
Why it is a follow-up
The two layers are currently covered separately:
src/core/task/__tests__/Task.spec.ts — the abandoned-save guard, including a save that is already in flight when requestAbort(true) runs.
src/__tests__/abandonSubtask.spec.ts — the provider-side transitions that clear the persisted links (atomicUpdatePair, parent back to active).
Exercising them together needs a real Task instance with deferred persistence inside the provider spec: the task constructor requires a full provider stub, and taskMetadata/updateTaskHistory/message persistence have to be controlled so the save can be paused across abandonSubtask(). That is a test-harness change rather than a behavior change, so it is split out to keep #1496 reviewable.
Acceptance criteria
A provider-level test seeds a child history item with parentTaskId/rootTaskId and a delegated parent.
A real Task save is deferred (message persistence pending) while abandonSubtask() runs.
After the deferred save resolves, updateTaskHistory() was not applied for the child (no reattach) and the parent is active with awaitingChildId/delegatedToId cleared.
The test fails if the this.abandoned guard is removed from Task#saveClineMessages().
Activity