personal memory agent
0
fork

Configure Feed

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

Fix frame categorization crash when LLM returns array-wrapped JSON

The describe LLM (~10% of runs) returns [{...}] instead of {...},
causing 'list' object has no attribute 'get' in downstream frame
selection. Unwrap single-element arrays and validate dict type at
the parse site, feeding malformed responses into existing retry logic.

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

+8 -1
+8 -1
observe/describe.py
··· 509 509 if not has_error: 510 510 try: 511 511 analysis = json.loads(req.response) 512 + # Unwrap single-element list (LLM sometimes wraps in []) 513 + if isinstance(analysis, list) and len(analysis) == 1: 514 + analysis = analysis[0] 515 + if not isinstance(analysis, dict): 516 + raise ValueError( 517 + f"Expected dict, got {type(analysis).__name__}" 518 + ) 512 519 req.json_analysis = analysis 513 - except json.JSONDecodeError as e: 520 + except (json.JSONDecodeError, ValueError) as e: 514 521 has_error = True 515 522 error_msg = f"Invalid JSON response: {e}" 516 523