[PR #8025] fix: handle prompt abort to prevent JSON parse crash #12596

Open
opened 2026-02-16 18:17:29 -05:00 by yindo · 0 comments
Owner

Original Pull Request: https://github.com/anomalyco/opencode/pull/8025

State: open
Merged: No


Fixes #7946

When cancel() rejects the prompt callback, the stream closes without writing anything. SDK then crashes parsing empty body.

This catches the rejection and writes null instead.

Couldn't reproduce locally but the fix seems correct based on the code flow.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/8025 **State:** open **Merged:** No --- Fixes #7946 When cancel() rejects the prompt callback, the stream closes without writing anything. SDK then crashes parsing empty body. This catches the rejection and writes null instead. Couldn't reproduce locally but the fix seems correct based on the code flow.
yindo added the pull-request label 2026-02-16 18:17:29 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#12596