fix: hide nonfatal pre-start send warnings

This commit is contained in:
ai-ag2026
2026-05-23 19:08:00 +02:00
parent de51d2710e
commit d2f5c90691
2 changed files with 14 additions and 0 deletions
+10
View File
@@ -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;
+4
View File
@@ -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"
)