Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): subagent completion no longer cancels a usage-limited parent's armed auto-resume #41888

Closedfour1er(GitHub profile, opens in a new tab)wants to merge 4 commits intomain fromrefs/pull/41888/headopened View on GitHub

Showing 2 changed files with 37 additions and 9 deletions (loading 1).

x
0 of 2 viewed, 2 left
37 additions and 9 deletionsapps/server/src/orchestration-v2/Orchestrator.tsModified
View file
@@ -1092,15 +1092,12 @@
- * The provider's latest run stopped on its usage limit and nothing ran after it.
- * With `now` (automatic starts), a run on another provider since does not lift
- * a reported reset still in the future; an unknown reset is lifted, as transient 429s are.
+ * The latest failed usage-limit run on one provider instance, if any.
-function usageLimitHoldsQueue(
+function usageLimitBlockedRunForInstance(
projection: Pick<OrchestrationV2ThreadProjection, "runs" | "turnItems" | "providerSessions">,
providerInstanceId: ModelSelection["instanceId"],
- now?: DateTime.Utc,
-): boolean {
+): OrchestrationV2Run | null {
let latestSession: OrchestrationV2ThreadProjection["providerSessions"][number] | undefined;
for (const session of projection.providerSessions) {
@@ -1111,11 +1108,24 @@
latestSession = session;
- const limited = usageLimitBlockedRun(
+ return usageLimitBlockedRun(
projection.runs.filter((run) => run.providerInstanceId === providerInstanceId),
projection.turnItems,
latestSession?.lastError ?? null,