Skip to content

fix(tui): preserve worker rejection handling#33448

Open
rekram1-node wants to merge 1 commit into
devfrom
worker-rejection-logging
Open

fix(tui): preserve worker rejection handling#33448
rekram1-node wants to merge 1 commit into
devfrom
worker-rejection-logging

Conversation

@rekram1-node

@rekram1-node rekram1-node commented Jun 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • restore the TUI backend worker unhandledRejection listener removed during the Effect logging migration
  • log rejected worker callbacks through the Effect observability layer instead of allowing Bun to terminate the worker
  • dispose the dedicated logging runtime during worker shutdown

Context

After the listener was removed in c06ad7c88, an unhandled rejection in an async worker callback can terminate the backend worker. Subsequent TUI requests then surface only Worker has been terminated, hiding the original rejection.

A reported original rejection is:

Error: Cannot call write after a stream was destroyed
    at _write (internal:streams/writable:240:29)
    at write (/$bunfs/root/chunk-jv1w06hr.js:32:14071)
    at doWrite (/$bunfs/root/chunk-jv1w06hr.js:4:1687)
    at processTicksAndRejections (native:7:39)

This indicates a separate stream teardown race. This PR restores rejection containment and observability; it does not claim to fix that underlying stream lifecycle bug.

Closes #33269
Closes #32694

Verification

  • bun typecheck from packages/opencode
  • git diff --check

@rekram1-node rekram1-node changed the title fix(tui): preserve worker rejection handling fix(tui): handle worker RPC failures Jun 22, 2026
@rekram1-node rekram1-node force-pushed the worker-rejection-logging branch from 24a1e56 to 213d405 Compare June 22, 2026 20:58
@rekram1-node rekram1-node changed the title fix(tui): handle worker RPC failures fix(tui): preserve worker rejection handling Jun 22, 2026
@thdxr thdxr force-pushed the worker-rejection-logging branch 3 times, most recently from 3aef0aa to f984c31 Compare June 22, 2026 22:49
@thdxr thdxr force-pushed the worker-rejection-logging branch from f984c31 to 4be4dbe Compare June 22, 2026 22:50
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: Worker has been terminated TUI prompt can fail with Worker has been terminated after backend worker RPC error on MacOS

2 participants