GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(server): keep Grok reasoning levels model-scoped on model switch · pingdotgg/t3code@11f2f17

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • apps/server/src/provider/acp
    • GrokAcpSupport.test.ts
    • GrokAcpSupport.ts
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎apps/server/src/provider/acp/GrokAcpSupport.test.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/provider/acp/GrokAcpSupport.test.ts
+36Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,42 @@ describe("applyGrokAcpModelSelection", () => {
198198
}),
199199
);
200200

201+
it.effect("does not carry the previous model's effort onto a different model", () =>
202+
Effect.gen(function* () {
203+
const { runtime, modelCalls } = makeRecordingRuntime();
204+
const result = yield* applyGrokAcpModelSelection({
205+
runtime,
206+
currentModelId: "grok-mock-4.6",
207+
requestedModelId: "grok-mock-4.5",
208+
// `xhigh` exists on 4.6 but not on 4.5; sending it applies a level that
209+
// model never advertised, so the switch must leave the effort unset.
210+
currentReasoningEffort: "xhigh",
211+
requestedReasoningEffort: undefined,
212+
mapError: (cause) => cause.message,
213+
});
214+
expect(modelCalls).toEqual([{ modelId: "grok-mock-4.5" }]);
215+
expect(result).toEqual({ modelId: "grok-mock-4.5", reasoningEffort: undefined });
216+
}),
217+
);
218+
219+
it.effect("still sends an explicit effort that matches the previous model's effort", () =>
220+
Effect.gen(function* () {
221+
const { runtime, modelCalls } = makeRecordingRuntime();
222+
const result = yield* applyGrokAcpModelSelection({
223+
runtime,
224+
currentModelId: "grok-mock-4.6",
225+
requestedModelId: "grok-mock-4.5",
226+
currentReasoningEffort: "medium",
227+
requestedReasoningEffort: "medium",
228+
mapError: (cause) => cause.message,
229+
});
230+
expect(modelCalls).toEqual([
231+
{ modelId: "grok-mock-4.5", meta: { reasoningEffort: "medium" } },
232+
]);
233+
expect(result).toEqual({ modelId: "grok-mock-4.5", reasoningEffort: "medium" });
234+
}),
235+
);
236+
201237
it.effect("skips set_model when neither the model nor the effort changes", () =>
202238
Effect.gen(function* () {
203239
const { runtime, modelCalls } = makeRecordingRuntime();
Collapse file

‎apps/server/src/provider/acp/GrokAcpSupport.ts‎

Copy file name to clipboardExpand all lines: apps/server/src/provider/acp/GrokAcpSupport.ts
+8-3Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,14 @@ export function applyGrokAcpModelSelection<E>(input: {
221221
reasoningEffort: input.currentReasoningEffort,
222222
});
223223
}
224-
const reasoningEffort = shouldSwitchReasoningEffort
225-
? input.requestedReasoningEffort
226-
: input.currentReasoningEffort;
224+
// An explicit request always wins. Without one, the effort carries over only
225+
// when the model does not change: levels are per model, so carrying (say)
226+
// `xhigh` from Grok 4.6 onto Grok 4.5 applies a level that model never
227+
// advertised and leaves its session config with nothing selected. Sending no
228+
// effort lets Grok apply the target model's own default instead.
229+
const reasoningEffort =
230+
input.requestedReasoningEffort ??
231+
(shouldSwitchModel ? undefined : input.currentReasoningEffort);
227232
return input.runtime
228233
.setSessionModel(
229234
modelId,

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.