Skip to content

Commit 3eca0df

Browse files
fix(server): deferred-steer check and queued cancel no longer read a thread's whole history
The deferred-steer reactor read every run of the thread on each running provider-turn update, and queued-run.cancel read every node and ordered every user message, both under the thread's dispatch lock. The steer check now reads only queued and running runs, and the cancel reads only the queued run's own message and skips settled leaf nodes. Fixes #36095 Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent 091c086 commit 3eca0df

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

‎apps/server/src/orchestration-v2/Orchestrator.ts‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11169,7 +11169,13 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
1116911169
const projection = yield* loadProjectionForCommand(
1117011170
command,
1117111171
["runs", "messages", "nodes", "attempts", "subagents", "turnItems"],
11172-
{ turnItemTypes: [], messageRoles: ["user"] },
11172+
// Cancelling reads the queued run's own message and root node, never a settled leaf.
11173+
{
11174+
turnItemTypes: [],
11175+
messageRoles: ["user"],
11176+
messageRunIds: [command.runId],
11177+
omitSettledLeafNodes: true,
11178+
},
1117311179
);
1117411180
const queuedRun = projection.runs.find((candidate) => candidate.id === command.runId);
1117511181
if (queuedRun === undefined || queuedRun.status !== "queued") {
@@ -15281,7 +15287,9 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
1528115287
if (stored.event.type !== "provider-turn.updated") return;
1528215288
const threadId = stored.event.threadId;
1528315289
const turn = stored.event.payload;
15284-
const projection = yield* projectionStore.getThreadRecords(threadId, ["runs"]);
15290+
const projection = yield* projectionStore.getThreadRecords(threadId, ["runs"], {
15291+
runStatuses: ["queued", "running"],
15292+
});
1528515293
const run = projection.runs.find(
1528615294
(candidate) =>
1528715295
candidate.activeAttemptId === turn.runAttemptId && candidate.status === "running",

0 commit comments

Comments
 (0)