Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): compact superseded provider-turn updates #28109

ClosedJustYannicc(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/28109/headopened View on GitHub

Showing 2 changed files with 70 additions and 2 deletions.

x
0 of 2 viewed, 2 left
50 additions and 1 deletionapps/server/src/orchestration-v2/FoundationPersistence.test.tsModified
View file
@@ -21,6 +21,7 @@
ProviderInstanceId,
ProviderSessionId,
ProviderThreadId,
+ ProviderTurnId,
RunAttemptId,
RunId,
ThreadId,
@@ -924,6 +925,31 @@
});
​
+ // Updates without usage inherit it from an earlier update, so the
+ // newest update carrying usage must outlive compaction.
+ const providerTurnEvent = (
+ suffix: string,
+ usedTokens: number | null,
+ providerTurnId = "provider-turn:foundation-compact",
+ ): OrchestrationV2DomainEvent => ({
+ id: EventId.make(`event:foundation-compact:${suffix}`),
+ type: "provider-turn.updated",
+ threadId,
+ occurredAt: now,
+ payload: {
+ id: ProviderTurnId.make(providerTurnId),
+ providerThreadId: ProviderThreadId.make("provider-thread:foundation-compact"),
+ nodeId,
+ runAttemptId: null,
+ nativeTurnRef: null,