Repository navigation
fix(server): steering no longer cancels a pending question or approval #35703
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
40104be
163789a
f9952c1
a5649ba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -114,6 +114,7 @@ import { | |
| isActiveRun, | ||
| isNativeMaintenanceCommand, | ||
| resolveMessageDispatchIntent, | ||
| waitsOnPendingRequest, | ||
| } from "./CommandPolicy.ts"; | ||
| import { CommandReceiptStoreV2, type CommandReceiptV2 } from "./CommandReceiptStore.ts"; | ||
| import { | ||
|
|
@@ -6737,6 +6738,7 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio | |
| (message) => message.id === target.userMessageId, | ||
| ); | ||
| if ( | ||
| (resolvedMode.type === "restart_active" || !waitsOnPendingRequest(projection)) && | ||
| isLiveRun(target) && | ||
| goalCommandStopsActiveRun(goalCommand, goal?.status ?? null) && | ||
| (targetMessage === undefined || !isNativeMaintenanceCommand(targetMessage)) && | ||
|
|
@@ -10869,6 +10871,7 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio | |
| payload: { ...queuedRun, queuePosition: 1 }, | ||
| }); | ||
| const stops = | ||
| !waitsOnPendingRequest(projection) && | ||
| target !== undefined && | ||
| isLiveRun(target) && | ||
| goalCommandStopsActiveRun(goalCommand, goal?.status ?? null) && | ||
|
|
@@ -10885,6 +10888,28 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio | |
| now, | ||
| }); | ||
| } | ||
| if (waitsOnPendingRequest(projection)) { | ||
| // It goes first in the queue instead and runs after the answer. | ||
| yield* emitEvent({ | ||
| type: "run.updated", | ||
| threadId: command.threadId, | ||
| runId: queuedRun.id, | ||
| nodeId: queuedRootNode.id, | ||
| providerInstanceId: queuedRun.providerInstanceId, | ||
| occurredAt: now, | ||
| payload: { ...queuedRun, queuePosition: 1 }, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Keep deferred steers in their original order when a request is pending. When a blocking request is pending, For deferred steers A then B, the first dispatch sets A to position 1. The second dispatch sets B to position 1 and moves A to position 2. Preserve the relative order of the deferred steers in the pending branch. Do not promote each steer to position 1 independently.
|
||
| }); | ||
| return yield* stopRunForQueuedCommand({ | ||
| command, | ||
| events, | ||
| effects, | ||
| projection, | ||
| queuedRunId: queuedRun.id, | ||
| targetRunId: undefined, | ||
| reason: "Queued behind a pending request", | ||
| now, | ||
| }); | ||
| } | ||
| if ( | ||
| (target?.status === "preparing" || | ||
| target?.status === "starting" || | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Protect automatically selected restarts from pending requests.
If active steering and queued messages are unsupported, but interrupt/restart steering is supported,
resolveDeliveryIntentreturnsrestart_activefor"auto"at Lines 202-204. Line 112 then returns before this guard runs.Orchestrator.ts, Lines 6966-6994, dispatches that message withforceRestart: true, despite the pending live request.Apply the pending-request protection to automatically selected restarts too. Keep the bypass for an explicitly requested restart.