fix(ui-tui): record config theme pin even when env already matches (Bugbot r6)

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.
This commit is contained in:
Brooklyn Nicholson 2026-07-21 14:46:48 -05:00
parent 9be9a91d13
commit c543c691fc

View file

@ -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