fix(tui): deliver live events for sessions resumed with -s across directories#30278
Open
sjawhar wants to merge 1 commit into
Open
fix(tui): deliver live events for sessions resumed with -s across directories#30278sjawhar wants to merge 1 commit into
sjawhar wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #28581
Type of change
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()incontext/event.ts), andproject.project()is resolved from the launch directory. A session resumed via-scan 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.validateSessionalready fetches the session, so this returns itsprojectID(no extra request) and threads it throughargsinto the event filter, which now also delivers events whose project matches the resumed session. The working directory is not changed, so-skeeps 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) andbun run typecheckinpackages/opencode— both green.Checklist