The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(desktop): keep Dark mode across Bot Mode new chat
FalconOrtizf634b08a2c92
diff --git a/apps/desktop/src/themes/context.tsx b/apps/desktop/src/themes/context.tsxindex 32ea4444427..70c8c8e39c1 100644--- a/apps/desktop/src/themes/context.tsx+++ b/apps/desktop/src/themes/context.tsx@@ -75,8 +75,32 @@ const normalizeMode = (value: string | null): ThemeMode =>// it *is* the legacy global slot, so it reads/writes the global directly. Named// profiles get their own entry and fall back to that global until assigned, so// unassigned profiles and pre-per-profile installs stay on the global value.+// Named assigns also mirror into the global slot so a Bot Mode gateway hop onto+// a never-themed bot inherits the look the user just picked (#101216).+const promoteUnanimousLegacy = (record: string, legacy: string): void => {+ if (storedString(legacy) != null) {+ return+ }++ const values = Object.values(storedStringRecord(record)).filter(Boolean)++ if (values.length === 0) {+ return+ }++ const unique = [...new Set(values)]++ if (unique.length === 1) {+ persistString(legacy, unique[0])+ }+}+const profilePref = <T extends string>(record: string, legacy: string, normalize: (v: string | null) => T) => {- const stored = (profile: string): string | null => storedStringRecord(record)[profile] ?? storedString(legacy)+ const stored = (profile: string): string | null => {+ promoteUnanimousLegacy(record, legacy)++ return storedStringRecord(record)[profile] ?? storedString(legacy)+ }return {/** The pick as written, un-normalized. */@@ -87,6 +111,7 @@ const profilePref = <T extends string>(record: string, legacy: string, normalizepersistString(legacy, value)} else {persistStringRecord(record, { ...storedStringRecord(record), [profile]: value })+ persistString(legacy, value)}}}diff --git a/apps/desktop/src/themes/profile-theme.test.ts b/apps/desktop/src/themes/profile-theme.test.tsindex 34387b710cb..ac6e32f0e05 100644--- a/apps/desktop/src/themes/profile-theme.test.ts+++ b/apps/desktop/src/themes/profile-theme.test.ts@@ -46,3 +46,31 @@ describe.each(cases)('per-profile $name', ({ pref, fallback, a, b, junk }) => {expect(pref.resolve('work')).toBe(fallback)})})+// #101216: named-profile assign must seed the global fallback so a Bot Mode+// gateway hop onto a never-themed bot does not resolve `system`.+describe('named-profile appearance seeds the global fallback (#101216)', () => {+ beforeEach(() => window.localStorage.clear())++ it('lets a never-themed bot profile inherit Dark set on the launch profile', () => {+ modePref.assign('forge', 'dark')+ expect(modePref.resolve('atlas')).toBe('dark')+ })++ it('keeps an explicit per-profile override over the global fallback', () => {+ modePref.assign('forge', 'dark')+ modePref.assign('atlas', 'light')+ expect(modePref.resolve('forge')).toBe('dark')+ expect(modePref.resolve('atlas')).toBe('light')+ })++ it('lets a never-themed profile inherit the last named-profile assign', () => {+ modePref.assign('forge', 'dark')+ modePref.assign('atlas', 'light')+ expect(modePref.resolve('never-themed')).toBe('light')+ })++ it('promotes a unanimous pre-existing per-profile mode into the empty global slot', () => {+ window.localStorage.setItem('hermes-desktop-profile-modes-v1', JSON.stringify({ forge: 'dark' }))+ expect(modePref.resolve('atlas')).toBe('dark')+ })+})