Skip to content

Commit c4d4371

Browse files
committed
Move checkpoint storage to global storage and update checkpoint retention logic
- Do not store checkpoints directly in /tmp. Instead, store them in VS Code’s private extension storage [Accuracy boost] - In `apps/editor/src/features/checkpoints/actions/get-checkpoints.ts`, remove the `unpinned_kept` variable and the `else if (unpinned_kept >= 99)` block from the `remove_old_checkpoints` function so that only the time limit applies. └── apps └── editor └── src ├── commands │ ├── apply-response-command │ │ └── apply-response-command.ts │ ├── generate-commit-message-commands │ │ └── actions │ │ └── run-generate-action.ts │ └── history-command │ ├── actions │ │ ├── clear-all-checkpoints.ts │ │ ├── create-temporary-checkpoint.ts │ │ ├── delete-checkpoint-with-undo.ts │ │ ├── restore-checkpoint.ts │ │ ├── sync-workspace-from-dir.ts │ │ ├── toggle-checkpoint-pin.ts │ │ └── update-checkpoint-description.ts │ ├── history-command.ts │ ├── index.ts │ └── utils │ └── sync-directory.ts ├── constants │ └── state-keys.ts ├── extension.ts ├── features │ └── checkpoints │ ├── actions │ │ ├── accept-checkpoint.ts │ │ ├── create-checkpoint.ts │ │ ├── delete-checkpoint.ts │ │ ├── get-checkpoints.ts │ │ └── index.ts │ ├── types │ │ ├── checkpoint.ts │ │ └── index.ts │ └── utils │ ├── copy-optimised-recursively.ts │ ├── get-checkpoint-path.ts │ ├── get-incremented-description.ts │ ├── git-utils.ts │ └── index.ts ├── migrations │ └── index.ts └── utils └── agentic-cli-invocation └── invoke-agentic-cli.ts
1 parent bba7c03 commit c4d4371

14 files changed

Lines changed: 64 additions & 106 deletions

‎apps/editor/src/commands/history-command/actions/clear-all-checkpoints.ts‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ export const clear_all_checkpoints = async (
2222
continue
2323
}
2424
try {
25-
const checkpoint_path = get_checkpoint_path(checkpoint.timestamp)
25+
const checkpoint_path = get_checkpoint_path(
26+
checkpoint.timestamp,
27+
extension_context
28+
)
2629
await vscode.workspace.fs.delete(vscode.Uri.file(checkpoint_path), {
2730
recursive: true
2831
})
@@ -39,7 +42,10 @@ export const clear_all_checkpoints = async (
3942
)
4043
if (temp_checkpoint) {
4144
try {
42-
const checkpoint_path = get_checkpoint_path(temp_checkpoint.timestamp)
45+
const checkpoint_path = get_checkpoint_path(
46+
temp_checkpoint.timestamp,
47+
extension_context
48+
)
4349
await vscode.workspace.fs.delete(vscode.Uri.file(checkpoint_path), {
4450
recursive: true
4551
})

‎apps/editor/src/commands/history-command/actions/create-temporary-checkpoint.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ import {
1414
import { Logger } from '@shared/utils/logger'
1515

1616
export const create_temporary_checkpoint = async (
17-
workspace_provider: WorkspaceProvider
17+
workspace_provider: WorkspaceProvider,
18+
extension_context: vscode.ExtensionContext
1819
): Promise<Checkpoint | undefined> => {
1920
const workspace_folders = vscode.workspace.workspaceFolders!
2021

@@ -28,7 +29,7 @@ export const create_temporary_checkpoint = async (
2829

2930
await vscode.workspace.saveAll()
3031
const timestamp = Date.now()
31-
const checkpoint_dir_path = get_checkpoint_path(timestamp)
32+
const checkpoint_dir_path = get_checkpoint_path(timestamp, extension_context)
3233
const checkpoint_dir_uri = vscode.Uri.file(checkpoint_dir_path)
3334
await vscode.workspace.fs.createDirectory(checkpoint_dir_uri)
3435

‎apps/editor/src/commands/history-command/actions/delete-checkpoint-with-undo.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ export const delete_checkpoint_with_undo = async (params: {
4343

4444
const finalize = async () => {
4545
try {
46-
const checkpoint_path = get_checkpoint_path(params.checkpoint.timestamp)
46+
const checkpoint_path = get_checkpoint_path(
47+
params.checkpoint.timestamp,
48+
params.extension_context
49+
)
4750
await vscode.workspace.fs.delete(vscode.Uri.file(checkpoint_path), {
4851
recursive: true
4952
})

‎apps/editor/src/commands/history-command/actions/restore-checkpoint.ts‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ export const restore_checkpoint = async (params: {
119119
if (old_temp_checkpoint) {
120120
try {
121121
const checkpoint_path = get_checkpoint_path(
122-
old_temp_checkpoint.timestamp
122+
old_temp_checkpoint.timestamp,
123+
params.extension_context
123124
)
124125
await vscode.workspace.fs.delete(
125126
vscode.Uri.file(checkpoint_path),
@@ -137,7 +138,8 @@ export const restore_checkpoint = async (params: {
137138
}
138139

139140
temp_checkpoint = await create_temporary_checkpoint(
140-
params.workspace_provider
141+
params.workspace_provider,
142+
params.extension_context
141143
)
142144
await params.extension_context.workspaceState.update(
143145
TEMPORARY_CHECKPOINT_STATE_KEY,
@@ -163,7 +165,8 @@ export const restore_checkpoint = async (params: {
163165
Date.now()
164166
)
165167
const checkpoint_dir_path = get_checkpoint_path(
166-
params.checkpoint.timestamp
168+
params.checkpoint.timestamp,
169+
params.extension_context
167170
)
168171
const checkpoint_dir_uri = vscode.Uri.file(checkpoint_dir_path)
169172

‎apps/editor/src/commands/history-command/history-command.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,8 @@ export const history_command = (params: {
225225
if (Date.now() - temp_checkpoint.timestamp < three_hours_in_ms) {
226226
try {
227227
const checkpoint_path = get_checkpoint_path(
228-
temp_checkpoint.timestamp
228+
temp_checkpoint.timestamp,
229+
params.extension_context
229230
)
230231
await vscode.workspace.fs.stat(vscode.Uri.file(checkpoint_path))
231232
temp_checkpoint_is_valid = true

‎apps/editor/src/constants/values.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
export const CHECKPOINT_DEFAULT_LIFESPAN = 24
1+
export const CHECKPOINT_DEFAULT_LIFESPAN = 72
22
export const MAX_FILE_TOKENS_FOR_COMMIT_MESSAGE = 20000
33
export const MAX_PROMPT_CHARS_IN_COMMIT_MESSAGE = 1000
44
export const GIT_LOG_SINCE_DURATION = '6 months ago'

‎apps/editor/src/extension.ts‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import {
1010
migrate_prompt_templates_suffixes,
1111
migrate_commit_message_details_filename,
1212
migrate_prompt_templates_to_templates,
13-
migrate_clear_all_checkpoints,
1413
migrate_model_providers_to_providers,
1514
migrate_settings_keys_to_chatbots_and_models
1615
} from './migrations'
@@ -75,8 +74,6 @@ export const activate = async (extension_context: vscode.ExtensionContext) => {
7574
await migrate_commit_message_details_filename(extension_context)
7675
// 16 August 2026
7776
await migrate_prompt_templates_to_templates(extension_context)
78-
// 10 September 2026
79-
await migrate_clear_all_checkpoints(extension_context)
8077
// 20 September 2026
8178
await migrate_model_providers_to_providers(extension_context)
8279
// 26 October 2026

‎apps/editor/src/features/checkpoints/actions/accept-checkpoint.ts‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,14 @@ export const accept_checkpoint = async (params: {
2222
const checkpoint_to_update = checkpoints[checkpoint_index]
2323
const old_timestamp = checkpoint_to_update.timestamp
2424
const new_timestamp = Date.now()
25-
const old_path = get_checkpoint_path(old_timestamp)
26-
const new_path = get_checkpoint_path(new_timestamp)
25+
const old_path = get_checkpoint_path(
26+
old_timestamp,
27+
params.extension_context
28+
)
29+
const new_path = get_checkpoint_path(
30+
new_timestamp,
31+
params.extension_context
32+
)
2733
try {
2834
await vscode.workspace.fs.rename(
2935
vscode.Uri.file(old_path),

‎apps/editor/src/features/checkpoints/actions/create-checkpoint.ts‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,8 @@ export const create_checkpoint = async (params: {
5656
if (old_temp_checkpoint) {
5757
try {
5858
const checkpoint_path = get_checkpoint_path(
59-
old_temp_checkpoint.timestamp
59+
old_temp_checkpoint.timestamp,
60+
params.extension_context
6061
)
6162
await vscode.workspace.fs.delete(vscode.Uri.file(checkpoint_path), {
6263
recursive: true
@@ -95,7 +96,10 @@ export const create_checkpoint = async (params: {
9596
Date.now()
9697
)
9798
await vscode.workspace.saveAll()
98-
const checkpoint_dir_path = get_checkpoint_path(timestamp)
99+
const checkpoint_dir_path = get_checkpoint_path(
100+
timestamp,
101+
params.extension_context
102+
)
99103
const checkpoint_dir_uri = vscode.Uri.file(checkpoint_dir_path)
100104
await vscode.workspace.fs.createDirectory(checkpoint_dir_uri)
101105

@@ -178,7 +182,10 @@ export const create_checkpoint = async (params: {
178182

179183
let checkpoints = await get_checkpoints(params.extension_context)
180184

181-
checkpoints = await remove_old_checkpoints(checkpoints)
185+
checkpoints = await remove_old_checkpoints(
186+
checkpoints,
187+
params.extension_context
188+
)
182189

183190
const final_description = get_incremented_description(
184191
trigger,

‎apps/editor/src/features/checkpoints/actions/delete-checkpoint.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ export const delete_checkpoint = async (params: {
2525

2626
try {
2727
const checkpoint_path = get_checkpoint_path(
28-
params.checkpoint_to_delete.timestamp
28+
params.checkpoint_to_delete.timestamp,
29+
params.extension_context
2930
)
3031
await vscode.workspace.fs.delete(vscode.Uri.file(checkpoint_path), {
3132
recursive: true

0 commit comments

Comments
 (0)