Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): settling a parent cancels its delegated child's armed usage-limit resume #30175

Openjuliusmarmingewants to merge 9 commits intomain fromrefs/pull/30175/headopened View on GitHub

Showing 3 changed files with 176 additions and 8 deletions.

x
0 of 3 viewed, 3 left
28 additions and 7 deletionsapps/server/src/orchestration-v2/Orchestrator.tsModified
View file
@@ -5877,6 +5877,20 @@
const failure = latestRootProviderFailure(run, projection.turnItems);
const recovery = projection.thread.limitRecovery;
const now = yield* DateTime.now;
+ const parentId =
+ projection.thread.lineage.relationshipToParent === "subagent"
+ ? projection.thread.lineage.parentThreadId
+ : null;
+ // A subagent of a settled parent is abandoned work; resuming it would reopen the parent.
+ const parentSettled =
+ parentId !== null &&
+ (yield* projectionStore
+ .getThreadShell(parentId)
+ .pipe(
+ Effect.mapError(
+ (cause) => new OrchestratorProjectionError({ threadId: parentId, cause }),
+ ),
+ ))?.settledOverride === "settled";
run?.id !== command.usageLimitContinuationOfRunId ||
failure?.class !== "usage_limit" ||
@@ -5889,11 +5903,16 @@
projection.thread.archivedAt !== null ||
projection.thread.deletedAt !== null ||
projection.thread.settledOverride === "settled" ||
+ parentSettled ||
projection.thread.providerInstanceId !== run.providerInstanceId ||
projection.runtimeRequests.some((request) => request.status === "pending") ||
(projection.thread.snoozedUntil != null &&