personal memory agent
0
fork

Configure Feed

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

Fix generator timeouts and skip screen on audio-only segments

Screen generator now requires screen data (skips audio-only segments
instead of running a mismatched prompt that hangs). Generators get an
LLM request timeout derived from their token budget (120-480s) so
hanging API calls fail fast and trigger provider fallback instead of
blocking for the full 600s cortex kill. Cortex timeout events are now
broadcast to callosum for immediate detection, and dream's wait margin
is bumped to 610s to cover cortex cleanup.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

+23 -6
+1 -1
muse/screen.md
··· 8 8 "priority": 10, 9 9 "output": "md", 10 10 "instructions": { 11 - "sources": {"audio": true, "screen": true, "agents": false}, 11 + "sources": {"audio": true, "screen": "required", "agents": false}, 12 12 "facets": true 13 13 } 14 14
+8
think/agents.py
··· 800 800 max_output_tokens = config.get("max_output_tokens") or 8192 * 6 801 801 is_json_output = output_format == "json" 802 802 803 + # Derive LLM request timeout from token budget: scale with output size, 804 + # floor at 120s, cap at 480s (well under cortex's 600s subprocess kill). 805 + timeout_s = config.get("timeout_s") or min( 806 + 480, max(120, (max_output_tokens + thinking_budget) // 100) 807 + ) 808 + 803 809 # Build contents: transcript + instruction + prompt 804 810 contents = [] 805 811 if transcript: ··· 823 829 thinking_budget=thinking_budget, 824 830 system_instruction=system_instruction, 825 831 json_output=is_json_output, 832 + timeout_s=timeout_s, 826 833 ) 827 834 except Exception as exc: 828 835 if not _is_retryable_error(exc) or config.get("fallback_from"): ··· 867 874 thinking_budget=thinking_budget, 868 875 system_instruction=system_instruction, 869 876 json_output=is_json_output, 877 + timeout_s=timeout_s, 870 878 provider=backup, 871 879 model=backup_model, 872 880 )
+9
think/cortex.py
··· 336 336 f.write(json.dumps(error_event) + "\n") 337 337 except Exception as e: 338 338 self.logger.error(f"Failed to write timeout event: {e}") 339 + 340 + # Broadcast to callosum so wait_for_agents detects immediately 341 + try: 342 + event_copy = error_event.copy() 343 + event_type = event_copy.pop("event", "error") 344 + self.callosum.emit("cortex", event_type, **event_copy) 345 + except Exception: 346 + pass 347 + 339 348 agent.stop() 340 349 341 350 def _monitor_stdout(self, agent: AgentProcess) -> None:
+5 -5
think/dream.py
··· 216 216 agent_ids = [agent_id for agent_id, _, _, _ in spawned] 217 217 logging.info(f"Waiting for {len(agent_ids)} agents...") 218 218 219 - completed, timed_out = wait_for_agents(agent_ids, timeout=600) 219 + completed, timed_out = wait_for_agents(agent_ids, timeout=610) 220 220 221 221 success = 0 222 222 failed = 0 ··· 692 692 agent_id=agent_id, 693 693 ) 694 694 695 - completed, timed_out = wait_for_agents([agent_id], timeout=600) 695 + completed, timed_out = wait_for_agents([agent_id], timeout=610) 696 696 697 697 if timed_out: 698 698 logging.error(f"Generator {name} timed out (ID: {agent_id})") ··· 837 837 838 838 logging.info(f"Waiting for {len(spawned_ids)} agent(s)...") 839 839 completed, timed_out = wait_for_agents( 840 - [agent_id for agent_id, _ in spawned_ids], timeout=600 840 + [agent_id for agent_id, _ in spawned_ids], timeout=610 841 841 ) 842 842 843 843 if timed_out: ··· 1021 1021 agent_ids = [aid for aid, _, _ in spawned] 1022 1022 logging.info(f"Waiting for {len(agent_ids)} agents...") 1023 1023 1024 - completed, timed_out = wait_for_agents(agent_ids, timeout=600) 1024 + completed, timed_out = wait_for_agents(agent_ids, timeout=610) 1025 1025 1026 1026 if timed_out: 1027 1027 logging.warning(f"{len(timed_out)} agents timed out") ··· 1308 1308 if spawned: 1309 1309 _update_status(current_agents=[name for _, name, _ in spawned]) 1310 1310 agent_ids = [aid for aid, _, _ in spawned] 1311 - completed, timed_out = wait_for_agents(agent_ids, timeout=600) 1311 + completed, timed_out = wait_for_agents(agent_ids, timeout=610) 1312 1312 1313 1313 if timed_out: 1314 1314 logging.warning(f"Flush: {len(timed_out)} agents timed out")