Skip to content

fix(tui): deliver live events for sessions resumed with -s across directories#30278

Open
sjawhar wants to merge 1 commit into
anomalyco:devfrom
sjawhar:fix/tui-resumed-session-events
Open

fix(tui): deliver live events for sessions resumed with -s across directories#30278
sjawhar wants to merge 1 commit into
anomalyco:devfrom
sjawhar:fix/tui-resumed-session-events

Conversation

@sjawhar
Copy link
Copy Markdown

@sjawhar sjawhar commented Jun 1, 2026

Issue for this PR

Closes #28581

Type of change

  • Bug fix

What does this PR do?

opencode -s <sessionID> launched from a directory other than the sessions stored directory stops live-rendering: the message list never updates while the agent keeps running in the background. Quitting and reopening the TUI shows the work actually happened.

Root cause: the TUI event stream is scoped by project (event.project === project.project() in context/event.ts), and project.project() is resolved from the launch directory. A session resumed via -s can belong to a different project, so its events are filtered out. The session is still processed server-side; only the TUIs live updates are dropped.

validateSession already fetches the session, so this returns its projectID (no extra request) and threads it through args into the event filter, which now also delivers events whose project matches the resumed session. The working directory is not changed, so -s keeps working from any directory.

How did you verify your code works?

bun test test/cli/tui/use-event.test.tsx (added two cases: delivers the resumed sessions project events from another directory; still ignores unrelated projects) and bun run typecheck in packages/opencode — both green.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@sjawhar sjawhar marked this pull request as ready for review June 1, 2026 19: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.

opencode -s resumes sessions from the launch directory instead of the stored session directory

1 participant