Skip to content

Commit f020125

Browse files
committed
delegate: wire unexpected-error checkpoint save to append-delta API (fix #5)
newContents here is the model's turn (already pushed to `contents` before this try block), not the whole array. Also carries fix #4's repeat-tracking state.
1 parent bbe9cb6 commit f020125

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

connectors/gemini/delegate.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1161,7 +1161,15 @@ export async function runInvestigation({ task, max_steps = 20, resume_run_id })
11611161
// already done (this step's model turn was already pushed to
11621162
// `contents` above) and return the same resumable-failure shape as a
11631163
// geminiChat failure.
1164-
await saveCheckpoint(runId, { contents, transcript, stepsDone: step - 1, task: effectiveTask });
1164+
await saveCheckpoint(runId, {
1165+
newContents: contents.slice(contentsCheckpointedUpTo),
1166+
transcript,
1167+
stepsDone: step - 1,
1168+
task: effectiveTask,
1169+
repeatCounts: Object.fromEntries(repeatCounts),
1170+
consecutiveAllRepeatSteps,
1171+
});
1172+
contentsCheckpointedUpTo = contents.length;
11651173
const errMessage = err?.message ?? String(err);
11661174
return {
11671175
answer: `(Unexpected error while processing step ${step}'s function calls: ${errMessage} -- ${transcript.length} tool call(s) already completed this run are saved. Call delegate_gemini again with resume_run_id: "${runId}" to continue from here instead of starting over. Checkpoint expires in 1 hour.)`,

0 commit comments

Comments
 (0)