GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(provider): handle SSE reader cancel rejections by AlexanderWillner · Pull Request #44944 · anomalyco/opencode

Conversation

@AlexanderWillner

@AlexanderWillner AlexanderWillner commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Issue for this PR

Closes #44943

Type of change

  • Bug fix

What does this PR do?

When the SSE chunk-timeout fires, the fetch-body reader is cancelled after the request signal is aborted. Under Bun 1.4 reader.cancel() then rejects and the voided promise surfaces as an unhandled rejection, which fails the running test even though its assertions passed. This handles the cancellation explicitly in both wrapSSE implementations (packages/opencode/src/provider/provider.ts, packages/core/src/aisdk.ts).

Also relaxes one PTY test's exit-poll deadline from 5s to 20s: under a fully parallel suite run the PTY exit event was observed at ~5.3s, so the poll deadline was exceeded despite correct behaviour. Assertion unchanged.

(Supersedes #44912, which was auto-closed before I could fix the template.)

How did you verify your code works?

Full suite from packages/opencode under Bun 1.4.0 and Bun 1.3.14: 3339 tests, 0 fail with these changes (before: one deterministic failure under 1.4.0, one load-dependent PTY failure). tsgo typecheck clean. darwin-arm64 binaries built with both runtimes, smoke tests pass.

Checklist

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

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
AlexanderWillner added 2 commits August 25, 2026 09:19
@AlexanderWillner
fix(provider): catch SSE reader cancel rejection
456eac5
When the chunk-timeout fires, the fetch-body reader is cancelled after
the request signal is aborted. Under Bun 1.4 reader.cancel() then
rejects, and the voided promise surfaces as an unhandled rejection
that fails tests (and can crash strict runtimes). Handle the
rejection explicitly.
@AlexanderWillner
test(pty): raise exit-poll deadline to 20s
70bf2f9
The 5s deadline is load-sensitive: under a fully parallel test run
the PTY exit event was observed too late and the test failed even
though the behaviour under test is correct.
@AlexanderWillner AlexanderWillner mentioned this pull request Aug 25, 2026
chore: bump embedded Bun to 1.4.2 #44946
Closed
3 tasks done
@thdxr
thdxr enabled auto-merge (squash) September 1, 2026 22:52
@rekram1-node
rekram1-node disabled auto-merge September 2, 2026 04:28
@rekram1-node
rekram1-node merged commit 69c172e into anomalyco:dev Sep 2, 2026
15 of 16 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@unemployabot unemployabot Bot mentioned this pull request Sep 3, 2026
Termux v1.18.27 wallentx/opencode-termux#68
Merged
@github-actions github-actions Bot mentioned this pull request Sep 3, 2026
SSE error with #44944 — broken #47047
Closed
filipeforattini added a commit to reddb-io/redcode that referenced this pull request Sep 5, 2026
@filipeforattini
fix(provider): handle SSE reader cancel rejections (anomalyco#44944)
88963dd
Ported from anomalyco/opencode 69c172e.

Port note: provider.ts conflicted because we had already made the same fix — our line
keeps the `void` in front of the swallowed cancel — so ours stands and upstream's change to
the shared aisdk stream helper and its pty test come across.

Upstream: 69c172e
filipeforattini added a commit to reddb-io/redcode that referenced this pull request Sep 5, 2026
@filipeforattini
fix(provider): handle SSE reader cancel rejections (anomalyco#44944)
bb864aa
Ported from anomalyco/opencode 69c172e.

Port note: provider.ts conflicted because we had already made the same fix — our line
keeps the `void` in front of the swallowed cancel — so ours stands and upstream's change to
the shared aisdk stream helper and its pty test come across.

Upstream: 69c172e
@github-actions github-actions Bot mentioned this pull request Sep 7, 2026
Informe upstream (semanal) jaminsmoke/Jarvis#52
Open
alltomatos added a commit to alltomatos/opencode that referenced this pull request Sep 15, 2026
@alltomatos @claude
fix(provider): swallow SSE reader cancel rejection and preserve Bedro…
4f143ef
…ck ARN/DeepSeek ids

Two small upstream fixes to the opencode/provider/provider.ts "custom"
loaders and shared wrapSSE helper, both completing partial ports that
this fork's core-package copies already received but this file's
duplicated logic missed:

1. wrapSSE(): the timeout path called `void reader.cancel(err)`,
   leaving an unhandled promise rejection when the underlying stream
   had already errored. core/aisdk.ts's copy of this function was
   already fixed (commit ac3b15b); this completes the port for the
   near-duplicate copy here. Ported from upstream ac1758c -> no,
   from upstream 69c172e ("fix(provider): handle SSE reader cancel
   rejections (anomalyco#44944)").

2. amazon-bedrock custom loader's getModel(): double-prefixed full
   Bedrock ARNs (`arn:...`, which Bedrock rejects with a prefix) and
   over-matched "deepseek" (prefixing non-R1 DeepSeek models that
   don't support cross-region inference). The core Bedrock plugin
   (packages/core/src/plugin/provider/amazon-bedrock.ts) already got
   this fix (commit d66cefe); this completes the port for the
   legacy "custom" loader's own copy of the same logic. Ported from
   upstream ac1758c ("fix: preserve Bedrock DeepSeek model ids
   (anomalyco#34441)").

Verified via manual `tsgo --noEmit` on packages/core and
packages/opencode (clean) and oxlint on the changed file (0 errors,
pre-existing warnings only, none on changed lines). Full monorepo
`bun turbo typecheck` cannot run in this sandbox because three
unrelated packages (console-support, console-app, stats-app) depend
on `@solidjs/start` pinned to a pkg.pr.new preview build blocked by
this environment's network policy — a known, previously-documented
sandbox limitation (see fork-expert skill's upstream-sync.md), not a
regression from this change. The equivalent "typecheck" GitHub Actions
check passed clean on PR #234, which hit the same sandbox limitation
for its own real-code changes.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SHQKcGH7ayRe8UHJ9CAPQJ
@alltomatos alltomatos mentioned this pull request Sep 15, 2026
fix(provider): complete Bedrock ARN/DeepSeek and SSE reader-cancel upstream ports alltomatos/opencode#241
Closed
3 tasks done
logic10492 added a commit to coding-chimera/chimera that referenced this pull request Sep 17, 2026
@logic10492
fix(provider): handle SSE reader cancel rejections
d7dc308
Port upstream opencode 69c172e8a7 (anomalyco/opencode#44944): the SSE read
timeout path races reader.cancel(err) against stream teardown, producing
unhandled promise rejections. Swallow cancel errors; the timeout itself is
still surfaced via reject(err). Upstream's second callsite
(packages/core/src/aisdk.ts) does not exist in this fork, so only the
wrapSSE hunk in provider.ts applies.

Upstream-Sha: 69c172e8a7c0086887b1f93ed5a162f14b6aa0c5
rossigee pushed a commit to rossigee/opencode that referenced this pull request Sep 18, 2026
@AlexanderWillner @rossigee
fix(provider): handle SSE reader cancel rejections (anomalyco#44944)
20bdf5e
@johnnymo87 johnnymo87 mentioned this pull request Sep 21, 2026
[NO-JIRA] Build releases with bun 1.4.0 to stop the 1.5 GB/day /tmp libopentui.so leak johnnymo87/opencode-patched#54
Merged
rldona pushed a commit to plazoleta-dev/FlupCode that referenced this pull request Sep 24, 2026
@AlexanderWillner
fix(provider): handle SSE reader cancel rejections (anomalyco#44944)
243b2b1
@saoudrizwan saoudrizwan mentioned this pull request Sep 29, 2026
chore: upgrade Bun to 1.4.2 cline/cline#14631
Merged
5 tasks done
Ichinose-Kazuki pushed a commit to Ichinose-Kazuki/opencode that referenced this pull request Oct 7, 2026
@AlexanderWillner
fix(provider): handle SSE reader cancel rejections (anomalyco#44944)
f9a2190
logic10492 added a commit to coding-chimera/chimera that referenced this pull request Oct 13, 2026
@logic10492
fix(provider): handle SSE reader cancel rejections
e5ea908
Port upstream opencode 69c172e8a7 (anomalyco/opencode#44944): the SSE read
timeout path races reader.cancel(err) against stream teardown, producing
unhandled promise rejections. Swallow cancel errors; the timeout itself is
still surfaced via reject(err). Upstream's second callsite
(packages/core/src/aisdk.ts) does not exist in this fork, so only the
wrapSSE hunk in provider.ts applies.

Upstream-Sha: 69c172e8a7c0086887b1f93ed5a162f14b6aa0c5
@devin-ai-integration devin-ai-integration Bot mentioned this pull request Oct 14, 2026
upstream: provider/security fixes not yet ported AltimateAI/altimate-code#1478
Open
29 of 90 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

provider: unhandled rejection when SSE chunk-timeout cancels the fetch reader (suite red under Bun 1.4)

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@AlexanderWillner @rekram1-node
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.