personal memory agent
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

convey/entities: add 2-minute stall timeout to cortex listener (wave 2)

Use the websocket listener options overload for the entities cortex stream and track both assist cards and description callbacks under the shared stall timer.

+23 -1
+23 -1
apps/entities/workspace.html
··· 1484 1484 let currentDetailEntity = null; 1485 1485 const pendingEntities = new Map(); // use_id → { name, element } 1486 1486 const pendingAgentCallbacks = new Map(); // use_id → callback function 1487 + const ENTITIES_CORTEX_STALL_MS = 2 * 60 * 1000; 1488 + let cortexSub = null; 1487 1489 const _errorTimers = {}; 1488 1490 1489 1491 // Standard entity types - fetched from server ··· 3258 3260 pendingEntities.delete(tempId); 3259 3261 pendingEntities.set(data.use_id, pending); 3260 3262 pending.element.dataset.agentId = data.use_id; 3263 + cortexSub?.pending?.track(data.use_id); 3261 3264 } 3262 3265 } else { 3263 3266 throw new Error(data.error || 'Failed to start assistant'); ··· 3276 3279 return; 3277 3280 } 3278 3281 3279 - window.appEvents.listen('cortex', (msg) => { 3282 + cortexSub = window.appEvents.listen('cortex', { 3283 + schema: ['event', 'use_id'], 3284 + correlationKey: 'use_id', 3285 + timeout: ENTITIES_CORTEX_STALL_MS, 3286 + onDrop: (e) => window.logError(e, { context: 'entities: cortex listener drop' }), 3287 + onTimeout: (useId) => handleEntitiesTimeout(useId) 3288 + }, (msg) => { 3280 3289 const agentId = msg.use_id; 3281 3290 if (!agentId) return; 3282 3291 ··· 3315 3324 return; 3316 3325 } 3317 3326 pendingAgentCallbacks.set(agentId, callback); 3327 + cortexSub?.pending?.track(agentId); 3328 + } 3329 + 3330 + function handleEntitiesTimeout(useId) { 3331 + if (pendingEntities.has(useId)) { 3332 + failPendingEntity(useId, 'Entity assist timed out — reload to retry'); 3333 + } 3334 + 3335 + if (pendingAgentCallbacks.has(useId)) { 3336 + const callback = pendingAgentCallbacks.get(useId); 3337 + pendingAgentCallbacks.delete(useId); 3338 + callback({ success: false, error: 'Generation timed out — reload to retry' }); 3339 + } 3318 3340 } 3319 3341 3320 3342 function updatePendingEntity(agentId, entity) {