Skip to content

fix(opencode): handle AbortError in session processor to prevent side…#29251

Open
patihomirov wants to merge 1 commit into
anomalyco:devfrom
patihomirov:fix/session-processor-abort-error
Open

fix(opencode): handle AbortError in session processor to prevent side…#29251
patihomirov wants to merge 1 commit into
anomalyco:devfrom
patihomirov:fix/session-processor-abort-error

Conversation

@patihomirov
Copy link
Copy Markdown

@patihomirov patihomirov commented May 25, 2026

Issue for this PR

Closes #26667

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

When an LLM stream is interrupted (network timeout, API disconnection), the unhandled AbortError propagates up the Effect.js fiber stack and crashes the entire sidecar process.

In packages/opencode/src/session/processor.ts, Effect.catchCauseIf only catches non-interrupt causes. When AbortError occurs during stream interruption, it bypasses Effect.catch(halt) and crashes the sidecar instead of being handled gracefully.

The fix adds Effect.catchCause before Effect.catch(halt) to properly catch and handle AbortError via the existing halt() handler. This ensures the error is logged, stored in assistantMessage.error, and the session transitions to idle state - instead of crashing the sidecar.

How did you verify your code works?

Built a patched desktop version and ran a long LLM task that triggered a stream interruption. Previously this would crash the sidecar with AbortError: Aborted logged in journalctl. With the patch, the sidecar stays alive and the error is handled gracefully (logged via halt(), session transitions to idle).

Screenshots / recordings

N/A - not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions
Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:issue needs:compliance This means the issue will auto-close after 2 hours. labels May 25, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG]:session.processor crashes sidecar on unhandled AbortError

1 participant