From d2f5c9069120a9ac56585eaf44e9621ec84e93a6 Mon Sep 17 00:00:00 2001 From: ai-ag2026 <261867348+ai-ag2026@users.noreply.github.com> Date: Sat, 23 May 2026 19:08:00 +0200 Subject: [PATCH] fix: hide nonfatal pre-start send warnings --- static/messages.js | 10 ++++++++++ tests/test_inflight_send_start_race.py | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/static/messages.js b/static/messages.js index 49670a37..dea77fc7 100644 --- a/static/messages.js +++ b/static/messages.js @@ -216,6 +216,16 @@ function _clearStaleBusyStateBeforeSend({compressionRunning=false}={}){ return true; } +function _runOptionalPreStartUiStep(label, fn){ + try{ + return typeof fn==='function'?fn():undefined; + }catch(e){ + const message=e&&e.message?e.message:String(e||'unknown error'); + try{console.warn('[webui] optional pre-start UI step failed', label, message);}catch(_){ } + return undefined; + } +} + function _sessionTitleLooksDefaultOrProvisional(titleText, provisionalText){ const title=String(titleText||'').replace(/\s+/g,' ').trim(); if(!title||title==='Untitled'||title==='New Chat')return true; diff --git a/tests/test_inflight_send_start_race.py b/tests/test_inflight_send_start_race.py index 731d6d2d..4b0c7ba5 100644 --- a/tests/test_inflight_send_start_race.py +++ b/tests/test_inflight_send_start_race.py @@ -78,6 +78,10 @@ def test_pre_start_optimistic_ui_helpers_cannot_block_chat_start(): assert "try" in helper_body and "catch" in helper_body, ( "optional pre-start UI helper wrapper must catch errors before /api/chat/start" ) + assert "setStatus(`UI warning before send:" not in helper_body, ( + "non-fatal pre-start UI helper failures should stay in the console; visible status flashes " + "look like real send errors even though /api/chat/start continues" + ) assert "_runOptionalPreStartUiStep" in pre_start, ( "send() should wrap optimistic sidebar/title/polling helpers before /api/chat/start" )