Skip to content

Commit 9a5b29e

Browse files
fix(server): steers keep the newest next-turn selection
A steer that switched a turn-scoped selection back to the running run's choice left the earlier steer's choice saved, and a steer that missed the turn started its follow-up on the old run's selection. Every user steer now saves its selection, and the follow-up starts on the saved selection. Delegated completions stay pinned to their run. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
1 parent 66a9107 commit 9a5b29e

3 files changed

Lines changed: 252 additions & 155 deletions

File tree

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

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,12 @@ export const executorLayer: Layer.Layer<
244244
text: message.text,
245245
...(message.context ? { context: message.context } : {}),
246246
attachments: message.attachments,
247-
modelSelection: run.modelSelection,
247+
// A user's follow-up starts on the thread's saved selection,
248+
// which already holds the steer's choice. A delegated
249+
// completion stays pinned to the run it reports to.
250+
...(message.delegatedCompletion === undefined
251+
? {}
252+
: { modelSelection: run.modelSelection }),
248253
dispatchMode: {
249254
type:
250255
message.delegatedCompletion === undefined

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3631,8 +3631,11 @@ const makeOrchestrator = Effect.fn("orchestrationV2.Orchestrator.layer")(functio
36313631
);
36323632

36333633
if (steeringPolicy === "active_steering") {
3634+
// The steer's selection becomes the saved next-turn choice, even when it
3635+
// matches the running run again. A delegated completion carries the
3636+
// run's selection, not a user choice, so it never replaces the saved one.
36343637
if (
3635-
selectionChanged &&
3638+
input.delegatedCompletion === undefined &&
36363639
!modelSelectionsEqual(input.projection.thread.modelSelection, input.modelSelection)
36373640
) {
36383641
yield* emitEvent({

0 commit comments

Comments
 (0)