From e0d698cfb351780ee62e16abfe52a0d6a87cd707 Mon Sep 17 00:00:00 2001 From: Brooklyn Nicholson Date: Wed, 22 Apr 2026 15:51:11 -0500 Subject: [PATCH] fix(tui): yolo toggle only reports on/off for strict '0'/'1' values Copilot on #14145 flagged that the shift+tab yolo handler treated any non-null RPC result as valid, so a response shape like {value: undefined} or {value: 'weird'} would incorrectly echo 'yolo off'. Now only '1' and '0' map to on/off; anything else (including missing value) surfaces as 'failed to toggle yolo', matching the null/catch branches. --- ui-tui/src/app/useInputHandlers.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ui-tui/src/app/useInputHandlers.ts b/ui-tui/src/app/useInputHandlers.ts index 715d775eee..1d9e834f97 100644 --- a/ui-tui/src/app/useInputHandlers.ts +++ b/ui-tui/src/app/useInputHandlers.ts @@ -386,7 +386,11 @@ export function useInputHandlers(ctx: InputHandlerContext): InputHandlerResult { return void gateway .rpc('config.set', { key: 'yolo', session_id: live.sid }) - .then(r => actions.sys(r ? `yolo ${r.value === '1' ? 'on' : 'off'}` : 'failed to toggle yolo')) + .then(r => + actions.sys( + r?.value === '1' ? 'yolo on' : r?.value === '0' ? 'yolo off' : 'failed to toggle yolo' + ) + ) .catch(() => actions.sys('failed to toggle yolo')) }