Skip to content

Commit d5d11d7

Browse files
committed
fix(server): preserve newer queue stops
1 parent 1765118 commit d5d11d7

3 files changed

Lines changed: 14 additions & 9 deletions

File tree

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

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1482,14 +1482,19 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
14821482
) {
14831483
const before = yield* readCommandProjection(threadId);
14841484
const ended = before.runs.find((run) => run.id === options.endedRunId);
1485-
const stopped =
1486-
ended?.status === "completed" &&
1487-
(yield* projectionStore.getThreadRecords(threadId, ["turnItems"], {
1488-
turnItemTypes: ["run_interrupt_request"],
1489-
turnItemRunIds: [ended.id],
1490-
})).turnItems.length > 0;
1485+
const endedOwnsQueue =
1486+
ended !== undefined &&
1487+
ended.status === "completed" &&
1488+
latestExecutedRun(before.runs)?.id === ended.id;
1489+
const stoppedEnded =
1490+
ended === undefined || !endedOwnsQueue
1491+
? false
1492+
: (yield* projectionStore.getThreadRecords(threadId, ["turnItems"], {
1493+
turnItemTypes: ["run_interrupt_request"],
1494+
turnItemRunIds: [ended.id],
1495+
})).turnItems.length > 0;
14911496
const held =
1492-
ended?.status === "completed" && !stopped
1497+
endedOwnsQueue && !stoppedEnded
14931498
? before.runs.filter((run) => run.status === "queued" && run.queueHeld === true)
14941499
: [];
14951500
if (held.length > 0) {

‎apps/web/src/components/settings/settingsSearch.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ export const SETTINGS_SEARCH_ITEMS = [
546546
{
547547
id: "batch-queued-messages",
548548
title: "Send queued messages together",
549-
to: "/settings/maintenance",
549+
to: "/settings/chat",
550550
scope: "environment-defaults",
551551
searchTerms: ["queue queued messages batch combine together one turn release drain follow up"],
552552
},

‎docs/user/composer.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ Press **Resume** in an empty composer on web and desktop, or **Resume queue** on
214214
continue. Sending a new message also resumes the queue, unless it steers a turn that is already
215215
running. You can edit or remove held messages without starting them.
216216

217-
With **Settings → Maintenance → Send queued messages together** on, up to 20 compatible queued messages start together as
217+
With **Settings → Chat → Send queued messages together** on, up to 20 compatible queued messages start together as
218218
one turn when the agent finishes, in order with their senders. The setting is off by default, and a
219219
completed turn releases held messages.
220220

0 commit comments

Comments
 (0)