anomalyco / anomalyco/opencode

[BUG] Question.ask response can target the wrong directory after a same-turn session move

Open
#48,165 0 comments 0 reactions 1 assignee View on GitHub

@nexxeln is already working on this.

Since Sep 9, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Summary

In OpenCode 1.18.30, a plugin can move a session from one directory to another during tool execution. The remaining assistant turn still runs in the origin server instance. If that turn calls the native question tool, Question.ask registers the pending request in the origin instance. The TUI immediately observes the new session.directory and sends question.reply or question.reject to the destination instance.

The destination instance reports reply for unknown request, and the original tool call waits until it is aborted.

Reproduction

  1. Start a session in /tmp/opencode-origin.
  2. In one assistant turn, run a plugin tool that moves the session to /tmp/opencode-destination.
  3. In that same assistant turn, call the native question tool.
  4. Answer the prompt in the TUI.

Expected behavior

Question and permission responses target the instance and directory that emitted each request.

Actual behavior

The TUI selects the response route from the latest session directory instead of the event origin. The destination instance does not own the pending request.

Suggested fix

Carry the event-origin directory with question and permission request events. Route replies and rejections through that directory instead of the latest session directory.

Scope

This report concerns same-turn cross-directory moves. Later turns run in the destination directory and do not reproduce the issue.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.