Skip to content

feat(task): manual conversation checkpoint storage + Task trigger methods - #14

Merged
easonLiangWorldedtech merged 1 commit into
main-task-treefrom
pr-5-checkpoint
Aug 16, 2026
Merged

feat(task): manual conversation checkpoint storage + Task trigger methods#14
easonLiangWorldedtech merged 1 commit into
main-task-treefrom
pr-5-checkpoint

Conversation

@easonLiangWorldedtech

Copy link
Copy Markdown
Owner

feat(task): manual conversation checkpoint storage + Task trigger methods

Part of the Task Tree unified subtask management plan (issue #9, PR-5). Adds a conversation checkpoint — distinct from the existing git-based file checkpoints (RepoPerTaskCheckpointService) which snapshot the working tree. A conversation checkpoint snapshots the task's full message history so the user can restore the conversation to this point later.

New module: src/core/checkpoints/conversation-checkpoint.ts

Pure storage layer (no vscode/Task imports — fully unit-testable):

  • saveConversationCheckpoint({taskDir, taskId, messages, summary?, now?}) → writes <taskDir>/checkpoints/<id>.json. The id is the creation timestamp; same-millisecond collisions get a -1, -2, ... suffix so no data is lost. Messages are deep-cloned (caller array never mutated); summary omitted from JSON when absent.
  • listConversationCheckpoints(taskDir) → newest first (createdAt desc, then id desc on ties). Missing dir → empty list; corrupt files skipped rather than failing the listing.
  • loadConversationCheckpoint(taskDir, id) → single checkpoint or undefined when missing.

Task trigger methods (manual only — no auto triggers in scope)

  • Task.createConversationCheckpoint(summary?) — resolves the standard task dir via getTaskDirectoryPath(this.globalStoragePath, this.taskId) and snapshots structuredClone(this.clineMessages), returning the saved checkpoint.
  • Task.listConversationCheckpoints() — lists this task's checkpoints newest first.

Tests (~290 lines per plan)

  • src/core/checkpoints/__tests__/conversation-checkpoint.spec.ts (new, 8 cases): timestamp-named file + returned shape; summary omitted/included correctly; same-millisecond collision suffixing with both files coexisting; deep-clone isolation; empty-list on missing dir; newest-first ordering; corrupt-file tolerance; load-by-id + undefined when missing.
  • src/__tests__/conversation-checkpoint-task.spec.ts (new, 2 cases): integration through the real Task.prototype methods bound onto a minimal double — verifies the standard <storage>/tasks/<taskId>/checkpoints/ layout and newest-first listing. No as any; single documented as unknown as Task cast on the stub.

Verification

  • pnpm run check-types — 11/11 packages pass
  • New suites: conversation-checkpoint unit 8/8; Task integration 2/2
  • Regression: Task.spec.ts 96/96 unchanged (Task.ts touched)
  • Full turbo lint (--max-warnings=0) clean; zero eslint suppression count increases

@easonLiangWorldedtech
easonLiangWorldedtech merged commit 06561e0 into main-task-tree Aug 16, 2026
6 of 10 checks passed
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.

2 participants