Skip to content

Commit 4dac034

Browse files
committed
merge: resolve new upstream steering conflicts
2 parents 11045ff + a98466b commit 4dac034

24 files changed

Lines changed: 831 additions & 119 deletions

‎.macroscope/check-run-agents/ui-consistency.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ The reference for how this codebase wants UI built is the composer banner system
4444

4545
- `ComposerBanner.tsx` exports one object of small slot components (`Root`, `Row`, `Icon`, `Content`, `Actions`, `Dismiss`, `Children`, and so on). Each slot owns its own Tailwind classes, exposes a `data-slot` attribute, takes `className` and spreads the rest of its props, and uses `cn` so callers can adjust without overriding. Variants and density are props on `Root`, not ad hoc class strings at call sites. Where a slot needs a real control it renders `Button` from `ui/` rather than a styled `<button>`.
4646
- `ComposerBannerStack.tsx` composes those slots into the ordered stack and owns only stack behavior (priority, expand and collapse, dismiss transitions).
47-
- Consumers such as `ComposerPlanFollowUpBanner.tsx` are a few lines of `<ComposerBanner.Row><ComposerBanner.Icon/><ComposerBanner.Content>…` and style only their own content.
47+
- Consumers compose the slots and style only their own content.
4848

4949
Hold new and changed UI to that shape:
5050

‎apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.test.ts‎

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6361,6 +6361,120 @@ describe("ClaudeAdapterV2 background wake turns", () => {
63616361
),
63626362
);
63636363

6364+
// regression: #34549 a model change sent with a steer was shown but never applied to the turn.
6365+
it.effect("applies a model change sent with a steer to the running turn", () =>
6366+
Effect.scoped(
6367+
Effect.gen(function* () {
6368+
const harness = yield* makeWakeHarness;
6369+
const idAllocator = yield* IdAllocator.IdAllocatorV2;
6370+
const opus = {
6371+
instanceId: ClaudeAdapterV2.CLAUDE_DEFAULT_INSTANCE_ID,
6372+
model: "claude-opus-5-5",
6373+
} satisfies ModelSelection;
6374+
const input = makeClaudeTestTurnInput({
6375+
threadId: harness.threadId,
6376+
providerThread: harness.providerThread,
6377+
now: yield* DateTime.now,
6378+
attemptId: RunAttemptId.make("attempt-steer-model-change"),
6379+
text: "Run the slow build.",
6380+
attachments: [],
6381+
modelSelection: opus,
6382+
});
6383+
yield* harness.runtime.startTurn(input);
6384+
yield* harness.runtime.steerTurn({
6385+
threadId: harness.threadId,
6386+
runId: input.runId,
6387+
providerThread: harness.providerThread,
6388+
providerTurnId: idAllocator.derive.providerTurn({
6389+
driver: ClaudeAdapterV2.CLAUDE_PROVIDER,
6390+
nativeTurnId: `turn:${input.attemptId}`,
6391+
}),
6392+
modelSelection: { ...opus, model: "claude-sonnet-4-6" },
6393+
message: {
6394+
createdBy: "user",
6395+
creationSource: "web",
6396+
messageId: MessageId.make("steer-model-change"),
6397+
text: "Which model are you?",
6398+
attachments: [],
6399+
},
6400+
});
6401+
assert.deepEqual(harness.liveSelectionChanges, [
6402+
{ model: "claude-sonnet-4-6" },
6403+
{ effortLevel: "high", fastMode: null, ultracode: null },
6404+
]);
6405+
assert.lengthOf(harness.offeredMessages, 2);
6406+
}).pipe(
6407+
Effect.provide(
6408+
Layer.mergeAll(
6409+
IdAllocator.layer,
6410+
McpProviderSessions.layer,
6411+
NodeServices.layer,
6412+
NodeCrypto.layer,
6413+
),
6414+
),
6415+
),
6416+
),
6417+
);
6418+
6419+
it.effect("fails a model-changing steer when the turn ends during the selection change", () =>
6420+
Effect.scoped(
6421+
Effect.gen(function* () {
6422+
let duringFlags: Effect.Effect<void> = Effect.void;
6423+
const harness = yield* makeWakeHarnessWithOptions({
6424+
applyFlagSettings: () => Effect.suspend(() => duringFlags),
6425+
});
6426+
const idAllocator = yield* IdAllocator.IdAllocatorV2;
6427+
const opus = {
6428+
instanceId: ClaudeAdapterV2.CLAUDE_DEFAULT_INSTANCE_ID,
6429+
model: "claude-opus-5-5",
6430+
} satisfies ModelSelection;
6431+
const input = makeClaudeTestTurnInput({
6432+
threadId: harness.threadId,
6433+
providerThread: harness.providerThread,
6434+
now: yield* DateTime.now,
6435+
attemptId: RunAttemptId.make("attempt-steer-model-change-race"),
6436+
text: "Run the slow build.",
6437+
attachments: [],
6438+
modelSelection: opus,
6439+
});
6440+
yield* harness.runtime.startTurn(input);
6441+
duringFlags = harness
6442+
.offerAndWait(turnOneResult)
6443+
.pipe(Effect.andThen(Queue.take(harness.terminalReceipts)), Effect.asVoid);
6444+
const steer = yield* harness.runtime
6445+
.steerTurn({
6446+
threadId: harness.threadId,
6447+
runId: input.runId,
6448+
providerThread: harness.providerThread,
6449+
providerTurnId: idAllocator.derive.providerTurn({
6450+
driver: ClaudeAdapterV2.CLAUDE_PROVIDER,
6451+
nativeTurnId: `turn:${input.attemptId}`,
6452+
}),
6453+
modelSelection: { ...opus, model: "claude-sonnet-4-6" },
6454+
message: {
6455+
createdBy: "user",
6456+
creationSource: "web",
6457+
messageId: MessageId.make("steer-model-change-race"),
6458+
text: "Which model are you?",
6459+
attachments: [],
6460+
},
6461+
})
6462+
.pipe(Effect.result);
6463+
assert.equal(steer._tag, "Failure");
6464+
assert.lengthOf(harness.offeredMessages, 1);
6465+
}).pipe(
6466+
Effect.provide(
6467+
Layer.mergeAll(
6468+
IdAllocator.layer,
6469+
McpProviderSessions.layer,
6470+
NodeServices.layer,
6471+
NodeCrypto.layer,
6472+
),
6473+
),
6474+
),
6475+
),
6476+
);
6477+
63646478
it.effect("re-sends the model on the turn after a live selection change fails", () =>
63656479
Effect.scoped(
63666480
Effect.gen(function* () {

‎apps/server/src/orchestration-v2/Adapters/ClaudeAdapterV2.ts‎

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12018,11 +12018,26 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
1201812018
}),
1201912019
persistAttachmentBudget(existing.nativeThreadId),
1202012020
);
12021+
// A selection sent with the steer applies to the running turn when the live process can switch to it.
12022+
const steerSelection =
12023+
turnInput.modelSelection === undefined
12024+
? undefined
12025+
: compileClaudeModelSelection(turnInput.modelSelection, modelCatalog);
12026+
const liveSteerSelection =
12027+
steerSelection !== undefined &&
12028+
existing.selection.queryIdentity !== steerSelection.queryIdentity &&
12029+
canApplyClaudeSelectionLive(existing.selection, steerSelection) &&
12030+
(existing.selection.apiModelId === steerSelection.apiModelId ||
12031+
existing.openedPermissionMode === currentTurn.queryPolicy.permissionMode)
12032+
? steerSelection
12033+
: undefined;
1202112034
const userMessage = yield* makeClaudeUserMessageWithAttachments({
1202212035
text: applyClaudePromptEffortPrefix(
1202312036
turnInput.message.text,
12024-
compileClaudeModelSelection(currentTurn.input.modelSelection, modelCatalog)
12025-
.promptEffort,
12037+
(
12038+
liveSteerSelection ??
12039+
compileClaudeModelSelection(currentTurn.input.modelSelection, modelCatalog)
12040+
).promptEffort,
1202612041
),
1202712042
attachments: turnInput.message.attachments,
1202812043
priority: "now",
@@ -12036,9 +12051,12 @@ export const makeClaudeAdapterV2 = Effect.fn("makeClaudeAdapterV2")(function* (
1203612051
Effect.provideService(Path.Path, path),
1203712052
);
1203812053
yield* backgroundForegroundSubagents(existing, backgroundDeadline);
12039-
// The turn can end while the moves are answered. A steer offered
12040-
// then would start a new turn the orchestrator never asked for, so
12041-
// the steer fails and the orchestrator starts the follow-up turn.
12054+
if (liveSteerSelection !== undefined) {
12055+
yield* applySelectionLive(existing, liveSteerSelection);
12056+
}
12057+
// The turn can end while the moves or the selection change are answered.
12058+
// A steer offered then would start a new turn the orchestrator never
12059+
// asked for, so the steer fails and the orchestrator starts the follow-up turn.
1204212060
if (
1204312061
(yield* Ref.get(activeTurn))?.providerTurnId !== turnInput.providerTurnId ||
1204412062
(yield* Ref.get(queryContext)) !== existing ||

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,9 @@ export const layerExecutor: Layer.Layer<
259259
providerThreadId: effect.request.providerThreadId,
260260
providerTurnId: effect.request.providerTurnId,
261261
messageId: effect.request.messageId,
262+
...(effect.request.modelSelection === undefined
263+
? {}
264+
: { modelSelection: effect.request.modelSelection }),
262265
})
263266
.pipe(
264267
Effect.tap(() =>

0 commit comments

Comments
 (0)