You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix: unhandled promise rejection on session cancel bleeds stderr into TUI #19855
When pressing Escape to cancel an in-progress LLM generation in the TUI, an unhandled promise rejection stack trace writes to stderr and corrupts the terminal display.
Root Cause
The abort HTTP endpoint at session.ts:384 calls SessionPrompt.cancel() without await or .catch(). cancel() internally calls cb.reject(new Error("Session cancelled")) to reject pending promises. Since the endpoint returns c.json(true) before cancel() completes, the rejection is unhandled and Bun writes the stack trace to stderr.
Two additional fire-and-forget calls in prompt/index.tsx also lack .catch():
sdk.client.session.abort() (line 262)
sdk.client.session.command() (line 654)
Reproduction
Start a session in the TUI
Send a message that triggers LLM generation
Press Escape twice during generation
Observe stack trace text bleeding over the TUI rendering
814a515a8a — fix: improve plugin system robustness (#18280) (Mar 24) adds a .catch() handler to the prompt_async route that catches rejected promises and publishes them to the bus via Bus.publish(Session.Event.Error, ...) instead of letting them become unhandled rejections that bleed into stderr. This commit includes a test verifying the handler exists.
c5442d418d — refactor(session): effectify SessionPrompt service (#19483) (Mar 30) introduces a Runner state machine where cancel is handled via Fiber.interrupt with typed Runner.Cancelled errors. This eliminates the class of unhandled rejections that occurred when cancel raced with prompt processing — the interruption propagates cleanly through Effect's fiber model instead of producing uncaught promise rejections.
Activity
ESRE-dev commentedon Apr 1, 2026
This should be resolved by two upstream changes:
814a515a8a—fix: improve plugin system robustness (#18280)(Mar 24) adds a.catch()handler to theprompt_asyncroute that catches rejected promises and publishes them to the bus viaBus.publish(Session.Event.Error, ...)instead of letting them become unhandled rejections that bleed into stderr. This commit includes a test verifying the handler exists.c5442d418d—refactor(session): effectify SessionPrompt service (#19483)(Mar 30) introduces aRunnerstate machine where cancel is handled viaFiber.interruptwith typedRunner.Cancellederrors. This eliminates the class of unhandled rejections that occurred when cancel raced with prompt processing — the interruption propagates cleanly through Effect's fiber model instead of producing uncaught promise rejections.cc #20095 (related issue, now closed)
github-actions commentedon Jul 3, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.