[PR #2563] fix(session): preserve context after user interrupts #10354

Closed
opened 2026-02-16 18:14:59 -05:00 by yindo · 0 comments
Owner

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

State: closed
Merged: No


https://github.com/sst/opencode/issues/2554

Prior behavior dropped all assistant messages with any error flag, so Ctrl+C (AbortError) removed crucial context like read files and patches. This caused the model to ‘forget’ work after an interruption.

Change: when building provider messages, filter out assistant messages only if error exists and it is not MessageAbortedError. Aborted messages now remain in context; genuine failures (auth/output length/unknown) are still excluded. Also ensure summaries with errors are not treated as lastSummary anchors.

Includes: adjust lastSummary lookups to ignore errored summaries.

Edge cases considered: multiple interrupts, partial tool calls are marked error on parts but message retained; stopWhen short-circuits on permission rejects; compatibility with MessageV2.AbortedError schema.

It seems to help, but I don’t know if it breaks something else.

**Original Pull Request:** https://github.com/anomalyco/opencode/pull/2563 **State:** closed **Merged:** No --- https://github.com/sst/opencode/issues/2554 Prior behavior dropped all assistant messages with any error flag, so Ctrl+C (AbortError) removed crucial context like read files and patches. This caused the model to ‘forget’ work after an interruption. Change: when building provider messages, filter out assistant messages only if error exists and it is not MessageAbortedError. Aborted messages now remain in context; genuine failures (auth/output length/unknown) are still excluded. Also ensure summaries with errors are not treated as lastSummary anchors. Includes: adjust lastSummary lookups to ignore errored summaries. Edge cases considered: multiple interrupts, partial tool calls are marked error on parts but message retained; stopWhen short-circuits on permission rejects; compatibility with MessageV2.AbortedError schema. It seems to help, but I don’t know if it breaks something else.
yindo added the pull-request label 2026-02-16 18:14:59 -05:00
yindo closed this issue 2026-02-16 18:14:59 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#10354