Fix session list pending message payload
This commit is contained in:
@@ -479,6 +479,7 @@ class Session:
|
||||
# Sessions without a fork must not leak None — see test_session_lineage_metadata_api.
|
||||
**({'parent_session_id': self.parent_session_id} if self.parent_session_id else {}),
|
||||
'active_stream_id': self.active_stream_id,
|
||||
'pending_user_message': self.pending_user_message,
|
||||
'is_cli_session': self.is_cli_session,
|
||||
'source_tag': self.source_tag,
|
||||
'session_source': self.session_source,
|
||||
|
||||
@@ -7519,6 +7519,7 @@ function t(key, ...args) {
|
||||
if (val === undefined) return key; // final fallback: return key itself
|
||||
if (typeof val === 'function') return val(...args);
|
||||
if (args.length) {
|
||||
// Locale strings can use numbered placeholders like {0} and {1}.
|
||||
return String(val).replace(/\{(\d+)\}/g, (match, idx) => (
|
||||
Object.prototype.hasOwnProperty.call(args, idx) ? String(args[idx]) : match
|
||||
));
|
||||
|
||||
@@ -47,9 +47,11 @@ def _make_session(session_id, stream_id=None, message_count=1):
|
||||
def test_all_sessions_marks_indexed_and_in_memory_streaming_sessions():
|
||||
"""Session records from both index and in-memory cache should expose is_streaming."""
|
||||
s_disk = _make_session("disk_session", stream_id="stream-1")
|
||||
s_disk.pending_user_message = "pending disk turn"
|
||||
s_disk.save()
|
||||
|
||||
s_memory = _make_session("memory_session", stream_id="stream-2")
|
||||
s_memory.pending_user_message = "pending memory turn"
|
||||
with models.LOCK:
|
||||
models.SESSIONS[s_memory.session_id] = s_memory
|
||||
|
||||
@@ -62,6 +64,8 @@ def test_all_sessions_marks_indexed_and_in_memory_streaming_sessions():
|
||||
assert by_sid["disk_session"]["is_streaming"] is True
|
||||
assert by_sid["memory_session"]["is_streaming"] is True
|
||||
assert by_sid["memory_session"]["active_stream_id"] == "stream-2"
|
||||
assert by_sid["disk_session"]["pending_user_message"] == "pending disk turn"
|
||||
assert by_sid["memory_session"]["pending_user_message"] == "pending memory turn"
|
||||
|
||||
|
||||
def test_all_sessions_marks_streaming_false_when_stream_is_not_active():
|
||||
|
||||
Reference in New Issue
Block a user