From c543c691fcaf7bc7615219dc08ba5669845701ca Mon Sep 17 00:00:00 2001 From: Brooklyn Nicholson Date: Tue, 21 Jul 2026 14:46:48 -0500 Subject: [PATCH] fix(ui-tui): record config theme pin even when env already matches (Bugbot r6) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Regression from the r3 shell-pin fix: applyConfiguredTuiTheme('light'|'dark') returned early when HERMES_TUI_THEME already matched, leaving configPinnedTheme false — so a later '/theme auto' refused to clear the pin and the session stayed forced to the old mode while config said auto. Set configPinnedTheme before the match short-circuit. Bugbot's other three r6 findings (GatewaySkin paired-palette fields, ConfigMtimeResponse.mcp_rev, picker maxWidth props) are diff-truncation false positives — all declared in gatewayTypes.ts / the picker prop interfaces; typecheck is green. --- ui-tui/src/app/createGatewayEventHandler.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ui-tui/src/app/createGatewayEventHandler.ts b/ui-tui/src/app/createGatewayEventHandler.ts index ab35bc8e5851..1be2ea41598e 100644 --- a/ui-tui/src/app/createGatewayEventHandler.ts +++ b/ui-tui/src/app/createGatewayEventHandler.ts @@ -130,11 +130,15 @@ export function applyConfiguredTuiTheme(raw: unknown): void { const current = process.env.HERMES_TUI_THEME ?? '' if (mode === 'light' || mode === 'dark') { + // Record config ownership BEFORE the match short-circuit — otherwise a + // pin that already matches (e.g. env and config agree at boot) leaves + // configPinnedTheme false, and a later 'auto' would refuse to clear it. + configPinnedTheme = true + if (current === mode) { return } - configPinnedTheme = true process.env.HERMES_TUI_THEME = mode } else { // 'auto' clears only a pin CONFIG set — never a HERMES_TUI_THEME the user