SSE events not emitted when using opencode attach --dir #8175

Open
opened 2026-02-16 18:09:20 -05:00 by yindo · 1 comment
Owner

Originally created by @tcrapts on GitHub (Jan 31, 2026).

Originally assigned to: @thdxr on GitHub.

Description

When using opencode attach with the --dir flag to connect to a remote server, the server does not emit session.status SSE events when messages are sent/received. Without the --dir flag, events are emitted correctly.

Plugins

No response

OpenCode version

1.1.48

Steps to reproduce

  1. Start OpenCode server: opencode serve --port 4096
  2. In another terminal, listen to SSE events: curl -N "http://localhost:4096/event"
  3. Attach WITH --dir: opencode attach http://localhost:4096 --session <session_id> --dir /path/to/project
  4. Send a message in the attached terminal
  5. Expected: SSE stream shows session.status events (busy → idle)
  6. Actual: only heartbeat events are received, no session.status events

Workaround:
Attach WITHOUT the --dir flag - events are emitted correctly:
opencode attach http://localhost:4096 --session <session_id>

Screenshot and/or share link

No response

Operating System

Ubuntu (WSL2)

Terminal

zsh

Originally created by @tcrapts on GitHub (Jan 31, 2026). Originally assigned to: @thdxr on GitHub. ### Description When using opencode attach with the --dir flag to connect to a remote server, the server does not emit session.status SSE events when messages are sent/received. Without the --dir flag, events are emitted correctly. ### Plugins _No response_ ### OpenCode version 1.1.48 ### Steps to reproduce 1. Start OpenCode server: `opencode serve --port 4096` 2. In another terminal, listen to SSE events: `curl -N "http://localhost:4096/event"` 3. Attach WITH --dir: `opencode attach http://localhost:4096 --session <session_id> --dir /path/to/project` 4. Send a message in the attached terminal 5. Expected: SSE stream shows session.status events (busy → idle) 6. Actual: only heartbeat events are received, no session.status events Workaround: Attach WITHOUT the --dir flag - events are emitted correctly: `opencode attach http://localhost:4096 --session <session_id>` ### Screenshot and/or share link _No response_ ### Operating System Ubuntu (WSL2) ### Terminal zsh
yindo added the windowsbug labels 2026-02-16 18:09:20 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Jan 31, 2026):

This issue appears to be related to other opencode attach --dir problems with remote servers. Please check these related issues to ensure they're not duplicates or related:

  • #11046: opencode attach --dir does not use project commands
  • #5380: TUI referencing local directory when using attach --dir to connect to a remote server
  • #8981: Bug: attach --dir works incorrectly when using with remote server

The root cause might be shared across these issues, so it could be helpful to review them together.

@github-actions[bot] commented on GitHub (Jan 31, 2026): This issue appears to be related to other `opencode attach --dir` problems with remote servers. Please check these related issues to ensure they're not duplicates or related: - #11046: `opencode attach --dir` does not use project commands - #5380: TUI referencing local directory when using attach --dir to connect to a remote server - #8981: Bug: attach --dir works incorrectly when using with remote server The root cause might be shared across these issues, so it could be helpful to review them together.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#8175