Description
Session cancellation has multiple race-condition failure modes:
-
Lost cancel before start
If cancel() is called before start() initializes session state, the cancellation is dropped and the session still runs.
-
Stale cancel aborts new generation
When a session is cancelled and quickly restarted (same session ID), a delayed cancel callback from the old run can abort the new run.
-
Dangling permission/question waits after cancel
Cancel does not reject pending permission/question waits, so tool execution can remain blocked indefinitely even though the session appears cancelled.
Plugins
None
OpenCode version
1.3.3 (also observed on dev as of 2026-03-30)
Steps to reproduce
- Start a prompt that triggers tool use and session loop activity.
- Immediately cancel before the first response is fully initialized.
- Re-send a prompt quickly in the same session.
- Observe one or more of:
- cancel being ignored,
- new run being aborted by stale cancel from prior run,
- pending permission/question waits not being cleared.
Screenshot and/or share link
N/A
Operating System
macOS 15.4.1 (also seen in Linux CI)
Terminal
Ghostty
Description
Session cancellation has multiple race-condition failure modes:
Lost cancel before start
If
cancel()is called beforestart()initializes session state, the cancellation is dropped and the session still runs.Stale cancel aborts new generation
When a session is cancelled and quickly restarted (same session ID), a delayed cancel callback from the old run can abort the new run.
Dangling permission/question waits after cancel
Cancel does not reject pending permission/question waits, so tool execution can remain blocked indefinitely even though the session appears cancelled.
Plugins
None
OpenCode version
1.3.3 (also observed on dev as of 2026-03-30)
Steps to reproduce
Screenshot and/or share link
N/A
Operating System
macOS 15.4.1 (also seen in Linux CI)
Terminal
Ghostty