Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): preserve usage-limit recovery across notification wakes #32454

Closedsaiananth1(GitHub profile, opens in a new tab)wants to merge 10 commits intomain fromrefs/pull/32454/headopened View on GitHub

Showing 9 changed files with 37 additions and 11 deletions (loading 8).

x
0 of 9 viewed, 9 left
37 additions and 11 deletionsapps/server/src/orchestration-v2/Orchestrator.tsModified
View file
@@ -1314,7 +1314,7 @@
"contextTransfers",
- turnItemTypes: ["user_message", "error"],
+ turnItemTypes: ["user_message", "error", "notification"],
Thread on line 1317

P2 Badge Avoid loading all notifications in command projections

On threads that accumulate provider or delegated notifications, this makes every readCommandProjection call select and decode every notification row, including the unbounded detail field in OrchestrationV2Notification. This helper is used by message dispatch and queued-run startup, so routine commands now become O(total notification history) and can repeatedly read many megabytes on long-running agent threads; load only compact run-start evidence, or restrict it to the relevant runs, instead of widening this global projection.

AGENTS.md reference: AGENTS.md:L15-L17

Useful? React with 👍 / 👎.

messageRoles: ["user"],
omitSettledLeafNodes: true,
// Commands here read only undelivered or active tasks; a dispatcher thread keeps
@@ -3803,7 +3803,7 @@
const projection = yield* loadProjectionForCommand(
command,
["runs", "runtimeRequests", "turnItems"],
- { turnItemTypes: ["error"] },
+ { turnItemTypes: ["user_message", "error", "notification"] },
const run = usageLimitBlockedRun(projection.runs, projection.turnItems, null);
const failure = latestRootProviderFailure(run, projection.turnItems);
@@ -5858,7 +5858,10 @@
source === undefined ||
(source.status !== "interrupted" &&
!(source.status === "failed" && limited?.class === "usage_limit")) ||
- latestExecutedRun(projection.runs)?.id !== source.id ||
+ (
+ usageLimitBlockedRun(projection.runs, projection.turnItems, null) ??
+ latestExecutedRun(projection.runs)
+ )?.id !== source.id ||