Skip to content

Commit 006a29e

Browse files
fix(mobile): hide effort when no option was saved
1 parent c9142c0 commit 006a29e

2 files changed

Lines changed: 36 additions & 2 deletions

File tree

‎apps/mobile/src/features/threads/threadAgentsPresentation.test.ts‎

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,32 @@ describe("resolveSubagentTraits", () => {
120120
).toEqual({ effort: "Low", speedIcon: null });
121121
});
122122

123+
it("does not infer an unsaved variant effort", () => {
124+
expect(
125+
resolveSubagentTraits({
126+
subagent: codexAgent([]),
127+
provider: {
128+
driver: ProviderDriverKind.make("opencode"),
129+
models: [
130+
{
131+
...codexModel,
132+
capabilities: {
133+
optionDescriptors: [
134+
{
135+
id: "variant",
136+
label: "Effort",
137+
type: "select",
138+
options: [{ id: "high", label: "High" }],
139+
},
140+
],
141+
},
142+
},
143+
],
144+
},
145+
}),
146+
).toEqual({ effort: null, speedIcon: null });
147+
});
148+
123149
it.each([
124150
["no saved selection", { ...codexAgent([]), modelSelection: undefined }, codex],
125151
["no saved options", codexAgent([]), codex],

‎apps/mobile/src/features/threads/threadAgentsPresentation.ts‎

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ import {
44
} from "@t3tools/client-runtime/state/subagent-display";
55
import { getSelectionSpeedIcon } from "@t3tools/client-runtime/model-traits";
66
import { isActiveSubagentStatus } from "@t3tools/client-runtime/state/subagentRuntime";
7-
import { formatModelSelectionEffort } from "@t3tools/client-runtime/state/thread-execution";
7+
import {
8+
formatModelSelectionEffort,
9+
REASONING_EFFORT_OPTION_IDS,
10+
} from "@t3tools/client-runtime/state/thread-execution";
811
import type {
912
OrchestrationV2Subagent,
1013
OrchestrationV2ThreadShell,
@@ -113,7 +116,12 @@ export function resolveSubagentTraits(input: {
113116
}
114117
const resolved = { ...selection, model };
115118
return {
116-
effort: formatModelSelectionEffort(resolved, provider.models),
119+
effort: resolved.options?.some(
120+
(option) =>
121+
REASONING_EFFORT_OPTION_IDS.includes(option.id) && typeof option.value === "string",
122+
)
123+
? formatModelSelectionEffort(resolved, provider.models)
124+
: null,
117125
speedIcon: getSelectionSpeedIcon(
118126
provider.driver,
119127
provider.models.find((candidate) => candidate.slug === model)?.capabilities

0 commit comments

Comments
 (0)