Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): limited threads auto-resume when allowance returns early #24511

Closedonly21mil(GitHub profile, opens in a new tab)wants to merge 27 commits intomain fromrefs/pull/24511/headopened View on GitHub

Showing 13 changed files with 71 additions and 12 deletions (loading 12).

x
0 of 13 viewed, 13 left
71 additions and 12 deletionsapps/server/src/orchestration-v2/Orchestrator.tsModified
View file
@@ -35,6 +35,7 @@
type ModelSelection,
OrchestrationV2Command,
type OrchestrationV2InternalCommand,
+ type OrchestrationV2LimitRecovery,
type OrchestrationV2LimitRecoveryUpdate,
type OrchestrationV2Notification,
type OrchestrationV2ServerCommand,
@@ -1254,6 +1255,32 @@
return events;
+function limitRecoveryWaitsForReset(
+ previous: OrchestrationV2LimitRecovery | null | undefined,
+ runId: RunId,
+): boolean {
+ return previous?.runId === runId && previous.waitForReset === true;
+​
+type LimitRecoverySnooze = Pick<OrchestrationV2AppThread, "snoozedUntil" | "limitRecovery">;
+​
+function limitRecoveryOwnsSnooze(thread: LimitRecoverySnooze): boolean {
+ return (
+ thread.limitRecovery?.snooze === true &&
+ thread.snoozedUntil != null &&
+ DateTime.toEpochMillis(thread.snoozedUntil) === Date.parse(thread.limitRecovery.resetAt)
+ );
+​