fix: guard session rail against non-array session payloads

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
MervinPraisonandClaude Opus 5.5 committed 2026-11-04 12:20:19 +00:00
1 parent 42c0a48640
commit ef5ed0ae62
2 files changed
+3 -2

No files matched your search

@@ -1047,7 +1047,8 @@ async function loadSessions() {
resp = await fetch('/sessions');
}
const data = await resp.json();
allSessions = data.sessions || data || [];
const fetched = data.sessions || data || [];
allSessions = Array.isArray(fetched) ? fetched : [];
renderSessionList();
} catch (e) {
console.warn('[Chat] Failed to load sessions:', e);
+1 -1
View File
@@ -21,7 +21,7 @@ class TestChatSessionRailSearch:
def test_load_sessions_caches_and_delegates_render(self):
src = CHAT.read_text()
assert "allSessions = data.sessions || data || [];" in src
assert "allSessions = Array.isArray(fetched) ? fetched : [];" in src
body = src.split("async function loadSessions()", 1)[1].split("\n}\n", 1)[0]
assert "renderSessionList();" in body