fix(dross): restore defensive try/catch around draft parsing (match companion.js)

This commit is contained in:
root
2026-06-09 23:56:35 +10:00
parent 1df0a905a2
commit 4535b03207

View File

@@ -77,6 +77,7 @@ router.post('/turn', requireOwner, validate({ body: turnSchema }), asyncWrap(asy
} else if (e.type === 'tool') {
send('tool', { type: 'tool', tool: e.tool, status: e.status });
} else if (e.type === 'tool_result') {
try {
let parsed = null;
const tryParse = (s) => { try { return JSON.parse(s); } catch { return null; } };
if (typeof e.result === 'string') {
@@ -93,6 +94,7 @@ router.post('/turn', requireOwner, validate({ body: turnSchema }), asyncWrap(asy
draftIds.push(parsed.pending_change_id);
send('draft', { type: 'draft', pending_change_id: parsed.pending_change_id, summary: parsed.summary || 'a change' });
}
} catch { /* parsing failed — no draft to surface */ }
} else if (e.type === 'error') {
send('error', { type: 'error', message: e.message });
}