fix: TransferEncodingError on task extraction failure
- brain.py: unwrap JSON array responses from Claude (occasional array instead of object caused AttributeError → broken chunked stream) - main.py: wrap extract_task_fields() in try/except so any extraction failure gracefully falls back to regex — generator always completes - tools.py: _resolve_project() uses alphanumeric-stripped matching so "Generaladm" resolves to General/Admin via identifier prefix match. Word-overlap fallback added. Default changed from Agent Ecosystem to General/Admin (correct catch-all bucket) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -69,6 +69,11 @@ async def extract_task_fields(message: str) -> tuple[dict, dict]:
|
||||
if content.startswith("json"):
|
||||
content = content[4:]
|
||||
fields = json.loads(content.strip())
|
||||
# Claude occasionally wraps the object in an array — unwrap it
|
||||
if isinstance(fields, list):
|
||||
fields = fields[0] if fields else {}
|
||||
if not isinstance(fields, dict):
|
||||
fields = {}
|
||||
return fields, usage
|
||||
except Exception as e:
|
||||
logger.warning(f"extract_task_fields failed: {e}")
|
||||
|
||||
Reference in New Issue
Block a user