Skip to content

fix(ui): handle session created SSE events#562

Merged
shantur merged 1 commit into
devfrom
fork-session-missing
Jun 18, 2026
Merged

fix(ui): handle session created SSE events#562
shantur merged 1 commit into
devfrom
fork-session-missing

Conversation

@shantur

@shantur shantur commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • Route session.created SSE events through the existing session update handler.
  • Prepend newly-created root sessions to the session list pagination ids so they appear in the sidebar immediately.

Fixes #560

Validation

  • npm run typecheck --workspace packages/ui

Route session.created events through the existing session update handler so sessions emitted by newer OpenCode servers are normalized and stored instead of being logged as unknown SSE events.

When a created session is a root session, prepend it to the session pagination id list so the sidebar renders it immediately without waiting for a full session refetch. Child sessions continue to use the existing parent-thread behavior.

Validated with npm run typecheck --workspace packages/ui.
@shantur

shantur commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator Author

@CodeNomadBot

I want you to perform the gatekeeper checks for latest PR state

check for regressions
check for better possible implementations
Be the PR gatekeeper
Be ruthless about code quality

@codenomadbot

codenomadbot Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

Gatekeeper review for latest PR state complete.

What I understood
The request was to review PR #562 strictly for regressions and implementation quality, not to change code. I treated the PR scope as: route session.created SSE events through existing session update handling and make newly-created root sessions appear immediately in the sidebar pagination list.

Findings
No blocking regressions found in the current patch.

Quality Notes

  • packages/ui/src/lib/sse-manager.ts:157-158 casts a session.created event to EventSessionUpdated. Runtime behavior is fine because the handler only needs properties.info, but this is a type lie. A cleaner implementation would make the callback accept EventSessionUpdated | EventSessionCreated, or introduce a shared local type for “session info event” instead of pretending session.created is session.updated.
  • There is no direct regression test for the new session.created flow. Existing pagination tests cover de-duping/page append behavior, but not the SSE path that prepends a newly-created root session. If this area keeps regressing, add a small test around the session event handler or SSE dispatch path.
  • packages/ui/src/stores/session-events.ts is about 810 lines, over the repo’s stated target limit. This PR only touches the file minimally, so I would not block on that, but future changes here should consider extracting event-specific handlers.

Regression Checks

  • Verified the PR diff is tight: 2 files, 9 added lines, 1 changed import.
  • Checked duplicate insertion risk: prependSessionListId filters the existing id before prepending, so an HTTP-created session followed by an SSE echo does not duplicate the sidebar id.
  • Checked child-session behavior: child sessions are not prepended to the root pagination list, preserving existing thread/root-list semantics.
  • Checked pagination reset/append behavior: prepending only mutates the current id list and keeps cursor/hasMore state intact.

Validation

  • npm ci completed successfully from the lockfile.
  • npm run typecheck --workspace packages/ui passed.
  • node --test packages/ui/src/stores/session-pagination.test.ts passed.
  • git diff --check origin/dev...HEAD passed.

Verdict: approve from a gatekeeper perspective, with the type-cast cleanup and direct SSE regression test as follow-up-quality improvements rather than blockers.

--
Yours,
CodeNomadBot

@shantur shantur merged commit 8bd7bc3 into dev Jun 18, 2026
10 of 11 checks passed
@shantur shantur deleted the fork-session-missing branch June 18, 2026 20:08
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.

[Bug]: forked Sessions are not displayed in the UI

1 participant