From c0e79f081e3dcba231446dd04093ccb12e0c50d6 Mon Sep 17 00:00:00 2001 From: RCD <90105158+Finesssee@users.noreply.github.com> Date: Mon, 12 Oct 2026 03:07:40 +0700 Subject: [PATCH 1/9] Keep the usage thresholds visible while threshold warnings are off --- .../settings/tabs/GeneralTab.test.tsx | 8 +++- .../src/surfaces/settings/tabs/GeneralTab.tsx | 48 +++++++++---------- 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/apps/desktop-tauri/src/surfaces/settings/tabs/GeneralTab.test.tsx b/apps/desktop-tauri/src/surfaces/settings/tabs/GeneralTab.test.tsx index 784e3d6b61..d558fbdd18 100644 --- a/apps/desktop-tauri/src/surfaces/settings/tabs/GeneralTab.test.tsx +++ b/apps/desktop-tauri/src/surfaces/settings/tabs/GeneralTab.test.tsx @@ -615,7 +615,7 @@ describe("GeneralTab notifications pane", () => { ).not.toBeChecked(); }); - it("locks credential and pace alerts and hides thresholds while usage warnings are off", () => { + it("locks credential and pace alerts but keeps the thresholds while usage warnings are off (#816)", () => { render( { expect(credential).toBeDisabled(); expect(credential).toBeChecked(); expect(screen.getByRole("checkbox", { name: "SessionQuotaNotifications" })).toBeEnabled(); - expect(screen.queryByText("WarningAtPercentUsed")).toBeNull(); + // The thresholds also colour the usage bars and the float bar, so they stay editable. + expect(screen.getByText("WarningAtPercentUsed")).toBeInTheDocument(); + expect(screen.getByText("CriticalAtPercentUsed")).toBeInTheDocument(); + expect(screen.getByDisplayValue("70")).toBeEnabled(); + expect(screen.getByDisplayValue("90")).toBeEnabled(); expect(screen.queryByText("ThresholdOverridesTitle")).toBeNull(); expect(screen.getByRole("checkbox", { name: "SoundEnabled" })).toBeInTheDocument(); }); diff --git a/apps/desktop-tauri/src/surfaces/settings/tabs/GeneralTab.tsx b/apps/desktop-tauri/src/surfaces/settings/tabs/GeneralTab.tsx index ebc3909161..bad79f1c31 100644 --- a/apps/desktop-tauri/src/surfaces/settings/tabs/GeneralTab.tsx +++ b/apps/desktop-tauri/src/surfaces/settings/tabs/GeneralTab.tsx @@ -502,30 +502,30 @@ function NotificationsPane({ - {settings.showNotifications && ( - {t("ThresholdsCaption")}

}> - - set({ highUsageThreshold: v })} - /> - - - set({ criticalUsageThreshold: v })} - /> - -
- )} + {/* The thresholds stay visible while threshold warnings are off: they also set + the usage-bar and float-bar colours (#816). The Mac hides them. */} + {t("ThresholdsCaption")}

}> + + set({ highUsageThreshold: v })} + /> + + + set({ criticalUsageThreshold: v })} + /> + +
From 1e37ad091b0d824ecf19350132096ab924a4d38b Mon Sep 17 00:00:00 2001 From: RCD <90105158+Finesssee@users.noreply.github.com> Date: Mon, 12 Oct 2026 03:07:40 +0700 Subject: [PATCH 2/9] Hide OpenCodex and Sources while Track costs is off --- .../settings/tabs/UsageSpendTab.test.tsx | 22 +++++++ .../surfaces/settings/tabs/UsageSpendTab.tsx | 66 ++++++++++--------- 2 files changed, 58 insertions(+), 30 deletions(-) diff --git a/apps/desktop-tauri/src/surfaces/settings/tabs/UsageSpendTab.test.tsx b/apps/desktop-tauri/src/surfaces/settings/tabs/UsageSpendTab.test.tsx index d74d1f197a..6a1c4f2865 100644 --- a/apps/desktop-tauri/src/surfaces/settings/tabs/UsageSpendTab.test.tsx +++ b/apps/desktop-tauri/src/surfaces/settings/tabs/UsageSpendTab.test.tsx @@ -205,6 +205,28 @@ describe("UsageSpendTab", () => { expect(set).toHaveBeenCalledWith({ costUsageEnabled: true }); }); + it("hides the OpenCodex switches and the Sources filter while Track costs is off (#825)", async () => { + tauriMocks.getUsageSpendSummary.mockImplementation(async (options?: { period?: string }) => + summary(options?.period ?? "rolling:30", false), + ); + renderTab({ costUsageEnabled: false, openCodexUsageLogsEnabled: true }); + expect(await screen.findByText("Cost tracking is off")).toBeTruthy(); + expect(screen.getByRole("checkbox", { name: "Track costs" })).not.toBeChecked(); + expect(screen.queryByText("UsageSpendOpenCodexImport")).toBeNull(); + expect(screen.queryByText("UsageSpendHideNativeCodex")).toBeNull(); + expect(screen.queryByRole("group", { name: "Sources" })).toBeNull(); + expect(screen.queryByRole("checkbox", { name: "Codex" })).toBeNull(); + }); + + it("shows the OpenCodex switches and the Sources filter while Track costs is on", async () => { + renderTab({ costUsageEnabled: true, openCodexUsageLogsEnabled: true }); + await screen.findByText("USD"); + expect(screen.getByText("UsageSpendOpenCodexImport")).toBeInTheDocument(); + expect(screen.getByText("UsageSpendHideNativeCodex")).toBeInTheDocument(); + expect(screen.getByRole("group", { name: "Sources" })).toBeInTheDocument(); + expect(screen.getByRole("checkbox", { name: "Codex" })).toBeChecked(); + }); + it("leaves the History window and Cost summary pickers to Settings > Menu", async () => { renderTab(); await waitFor(() => expect(tauriMocks.getUsageSpendSummary).toHaveBeenCalledTimes(1)); diff --git a/apps/desktop-tauri/src/surfaces/settings/tabs/UsageSpendTab.tsx b/apps/desktop-tauri/src/surfaces/settings/tabs/UsageSpendTab.tsx index 4e66247083..ccba55d4b6 100644 --- a/apps/desktop-tauri/src/surfaces/settings/tabs/UsageSpendTab.tsx +++ b/apps/desktop-tauri/src/surfaces/settings/tabs/UsageSpendTab.tsx @@ -227,39 +227,45 @@ export default function UsageSpendTab({ settings, set, saving }: TabProps) { onChange={(value) => set({ costUsageEnabled: value })} /> - - set({ openCodexUsageLogsEnabled: value })} - /> - - {includeOpenCodex && ( - - set({ hideNativeCodexCostWhenOpenCodexPresent: value })} - /> - - )} - {sources.length > 0 && ( -
- {t("UsageSpendSources")} - {sources.map((source) => ( + {/* Mac PreferencesSpendDashboardPane.swift:498-512: OpenCodex and the Sources + filter only show while Track costs is on (#825). */} + {trackCosts && ( + <> + - set({ spendDashboardHiddenSourceIds: toggleHiddenSource(hidden, source.id, show) }) - } + onChange={(value) => set({ openCodexUsageLogsEnabled: value })} /> - ))} -
+ + {includeOpenCodex && ( + + set({ hideNativeCodexCostWhenOpenCodexPresent: value })} + /> + + )} + {sources.length > 0 && ( +
+ {t("UsageSpendSources")} + {sources.map((source) => ( + + set({ spendDashboardHiddenSourceIds: toggleHiddenSource(hidden, source.id, show) }) + } + /> + ))} +
+ )} + )}