garage44.eu/jeroen/midas

logclone: git clone https://garage44.eu/jeroen/midas.git

cartopolis-agent · 2026-11-26T11:48:10Z

fix(web): a secret pasted into a session's wait is kept

The field for a secret a session waits on (`midas await --secret`) took
no paste: its keydown handler was `e.key === 'Enter' && give()`, which
returns false for every other key, and Mithril takes a handler's false
as "prevent the default". A paste (Ctrl+V) and an Android keyboard's
keys (Gboard pastes and types as the key "Unidentified") were stopped, so
the field stayed empty and Save grey on the person's phone, while the
chat box beside it took the same paste. Reproduced in headless Chromium
as a phone: before, a paste left the field empty; after, it holds the
text and Save is on.
web/src/components/sessions.tsx | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/web/src/components/sessions.tsx b/web/src/components/sessions.tsx
index cd6a909..6f1bf3c 100644
--- a/web/src/components/sessions.tsx
+++ b/web/src/components/sessions.tsx
@@ -1365,7 +1365,11 @@ function awaitsPanel(s: Hosted): m.Children {
                             value={awaitsUi.value}
                             disabled={!steers() || !!awaitsUi.sending}
                             oninput={(e: Event) => (awaitsUi.value = (e.target as HTMLInputElement).value)}
-                            onkeydown={(e: KeyboardEvent) => e.key === 'Enter' && give()}
+                            // A block, not `e.key === 'Enter' && give()`: a handler that returns false
+                            // stops the key, so every other key (a paste, an Android keyboard's) was lost.
+                            onkeydown={(e: KeyboardEvent) => {
+                                if (e.key === 'Enter') give()
+                            }}
                         />
                         <Button size="sm" variant="primary" disabled={!steers() || !awaitsUi.value.trim() || !!awaitsUi.sending} onclick={give}>
                             Save