Skip to content
Source
Sign inSign up
pingdotgg/t3code

perf(server): history compaction drops ~90% of provider-turn updates #22548

Closedt3dotgg(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromfix/compact-provider-turn-updatesopened View on GitHub

Showing 2 changed files with 59 additions and 9 deletions.

x
0 of 2 viewed, 2 left
35 additions and 2 deletionsapps/server/src/orchestration-v2/FoundationPersistence.test.tsModified
View file
@@ -22,6 +22,7 @@
ProviderInstanceId,
ProviderSessionId,
ProviderThreadId,
+ ProviderTurnId,
RunAttemptId,
RunId,
ThreadId,
@@ -907,6 +908,30 @@
});
​
+ // 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,
+ ): OrchestrationV2DomainEvent => ({
+ id: EventId.make(`event:foundation-compact:${suffix}`),
+ type: "provider-turn.updated",
+ threadId,
+ occurredAt: now,
+ payload: {
+ id: ProviderTurnId.make("provider-turn:foundation-compact"),
+ providerThreadId: ProviderThreadId.make("provider-thread:foundation-compact"),
+ nodeId,
+ runAttemptId: null,
+ nativeTurnRef: null,
+ ordinal: 1,