Make checkpoints configurable in settings.json (#1251)

This commit is contained in:
Louis Jimenez
2025-06-20 00:39:15 -04:00
committed by GitHub
parent ea63a8401e
commit 6c67618624
11 changed files with 50 additions and 21 deletions

View File

@@ -135,7 +135,7 @@ describe('useSlashCommandProcessor', () => {
getSandbox: vi.fn(() => 'test-sandbox'),
getModel: vi.fn(() => 'test-model'),
getProjectRoot: vi.fn(() => '/test/dir'),
getCheckpointEnabled: vi.fn(() => true),
getCheckpointingEnabled: vi.fn(() => true),
getBugCommand: vi.fn(() => undefined),
} as unknown as Config;
mockCorgiMode = vi.fn();

View File

@@ -647,7 +647,7 @@ Add any other context about the problem here.
description:
'resume from conversation checkpoint. Usage: /resume [tag]',
completion: async () => {
const geminiDir = config?.getGeminiDir();
const geminiDir = config?.getProjectTempDir();
if (!geminiDir) {
return [];
}
@@ -805,14 +805,14 @@ Add any other context about the problem here.
},
];
if (config?.getCheckpointEnabled()) {
if (config?.getCheckpointingEnabled()) {
commands.push({
name: 'restore',
description:
'restore a tool call. This will reset the conversation and file history to the state it was in when the tool call was suggested',
action: async (_mainCommand, subCommand, _args) => {
const checkpointDir = config?.getGeminiDir()
? path.join(config.getGeminiDir(), 'checkpoints')
const checkpointDir = config?.getProjectTempDir()
? path.join(config.getProjectTempDir(), 'checkpoints')
: undefined;
if (!checkpointDir) {

View File

@@ -280,7 +280,7 @@ describe('useGeminiStream', () => {
() => ({ getToolSchemaList: vi.fn(() => []) }) as any,
),
getProjectRoot: vi.fn(() => '/test/dir'),
getCheckpointEnabled: vi.fn(() => false),
getCheckpointingEnabled: vi.fn(() => false),
getGeminiClient: mockGetGeminiClient,
addHistory: vi.fn(),
} as unknown as Config;

View File

@@ -638,7 +638,7 @@ export const useGeminiStream = (
useEffect(() => {
const saveRestorableToolCalls = async () => {
if (!config.getCheckpointEnabled()) {
if (!config.getCheckpointingEnabled()) {
return;
}
const restorableToolCalls = toolCalls.filter(
@@ -649,8 +649,8 @@ export const useGeminiStream = (
);
if (restorableToolCalls.length > 0) {
const checkpointDir = config.getGeminiDir()
? path.join(config.getGeminiDir(), 'checkpoints')
const checkpointDir = config.getProjectTempDir()
? path.join(config.getProjectTempDir(), 'checkpoints')
: undefined;
if (!checkpointDir) {