welcome screen poll fix
frdel committed
Oct 30, 2025 at 10:44 UTC
23f53c4318168dd22c426479659a1180ebac4b19
1 file changed
+14
-10
python/api/poll.py
+14
-10
@@ -18,10 +18,14 @@ class Poll(ApiHandler):
18
timezone = input.get("timezone", get_dotenv_value("DEFAULT_USER_TIMEZONE", "UTC"))
19
Localization.get().set_timezone(timezone)
20
21
- # context instance - get or create
22
- context = self.get_context(ctxid)
21
+ # context instance - get or create only if ctxid is provided
22
+ if ctxid:
23
+ context = self.get_context(ctxid)
24
+ else:
25
+ context = None
26
24
- logs = context.log.output(start=from_no)
27
+ # Get logs only if we have a context
28
+ logs = context.log.output(start=from_no) if context else []
29
30
# Get notifications from global notification manager
31
notification_manager = AgentContext.get_notification_manager()
@@ -102,16 +106,16 @@ class Poll(ApiHandler):
106
107
# data from this server
108
return {
105
- "context": context.id,
109
+ "context": context.id if context else "",
110
"contexts": ctxs,
111
"tasks": tasks,
112
"logs": logs,
109
- "log_guid": context.log.guid,
110
- "log_version": len(context.log.updates),
111
- "log_progress": context.log.progress,
112
- "log_progress_active": context.log.progress_active,
113
- "paused": context.paused,
113
+ "log_guid": context.log.guid if context else "",
114
+ "log_version": len(context.log.updates) if context else 0,
115
+ "log_progress": context.log.progress if context else 0,
116
+ "log_progress_active": context.log.progress_active if context else False,
117
+ "paused": context.paused if context else False,
118
"notifications": notifications,
119
"notifications_guid": notification_manager.guid,
120
"notifications_version": len(notification_manager.updates),
117
- }
121
+ }
\ No newline at end of file