Skip to content

Commit 474e77f

Browse files
committed
fixes
1 parent a114f71 commit 474e77f

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

agents/agents-features/agents-features-snapshot/src/commonMain/kotlin/ai/koog/agents/snapshot/feature/AgentCheckpointData.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ public fun tombstoneCheckpoint(time: Instant, version: Long): AgentCheckpointDat
9595
*/
9696
public fun AgentCheckpointData.toAgentContextData(
9797
rollbackStrategy: RollbackStrategy,
98-
agentId: String,
9998
additionalRollbackAction: suspend (AIAgentContext) -> Unit = {}
10099
): AgentContextData {
101100
@Suppress("DEPRECATION")

agents/agents-features/agents-features-snapshot/src/commonMain/kotlin/ai/koog/agents/snapshot/feature/Persistence.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ public class Persistence(
359359
val checkpoint: AgentCheckpointData? = getCheckpointById(agentContext.agentId, checkpointId)
360360
if (checkpoint != null) {
361361
agentContext.store(
362-
checkpoint.toAgentContextData(rollbackStrategy, agentContext.agentId) { context ->
362+
checkpoint.toAgentContextData(rollbackStrategy) { context ->
363363
messageHistoryDiff(
364364
currentMessages = context.llm.prompt.messages,
365365
checkpointMessages = checkpoint.messageHistory
@@ -375,7 +375,6 @@ public class Persistence(
375375
} catch (_: Exception) {
376376
null
377377
}
378-
379378
rollbackTool.executeUnsafe(toolArgs)
380379
}
381380
}
@@ -390,8 +389,8 @@ public class Persistence(
390389
* Returns the difference only.
391390
* ex: current messages: [1, 2, 3, 4, 5, 6, 7], checkpoint messages: [1, 2, 3, 4, 5] -> diff messages: 6, 7
392391
*
393-
* Only works for the scenario when current chat histor is AHEAD of the checkpoint (i.e. we are restoring BACKWARDS in time),
394-
* otherwise will return an empty list!
392+
* Only works for the scenario when the current chat history is AHEAD of the checkpoint (i.e. we are restoring BACKWARDS in time),
393+
* otherwise it will return an empty list!
395394
* */
396395
private fun messageHistoryDiff(currentMessages: List<Message>, checkpointMessages: List<Message>): List<Message> {
397396
if (checkpointMessages.size > currentMessages.size) {
@@ -424,7 +423,7 @@ public class Persistence(
424423
return null
425424
}
426425

427-
agentContext.store(checkpoint.toAgentContextData(rollbackStrategy, agentContext.agentId))
426+
agentContext.store(checkpoint.toAgentContextData(rollbackStrategy))
428427
return checkpoint
429428
}
430429
}

0 commit comments

Comments
 (0)