Skip to content

fix(sidechat): preserve independent native chat tabs - #1115

Closed
pennxiang wants to merge 3 commits into
omdsh-dev:devfrom
pennxiang:fix/sidechat-multiple-native-tabs
Closed

pennxiang wants to merge 3 commits into
omdsh-dev:devfrom
pennxiang:fix/sidechat-multiple-native-tabs

Conversation

@pennxiang

@pennxiang pennxiang commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Why

Side Chat intends one tab per conversation, but the native sidebar currently behaves as a singleton:

  1. Open + → Side Chat in the native tab strip.
  2. Open + → Side Chat again: the first tab is focused instead of a second one being created.
  3. Use the + below the composer: a new thread is created, but its binding replaces the existing native tab.

The descriptor factory's unique plugin id is not the host page identity. Without multiple: true, the host uses sidebar://sidechat and dedupes it even when revealIfOpened: false. Independently, the view's last/newest-thread fallback makes a fresh unbound tab reuse an old thread.

Scope

  • Opt Side Chat into independent native page occurrences; leave other tab kinds unchanged.
  • Separate fresh creation from exact occurrence restoration. Persist only the thread id/title under parent session + native contentId, never transcripts or drafts.
  • Pass new/history thread bindings explicitly and dedupe them across the native sidebar and bottom workbench, including queued opens replayed after a session switch.
  • Keep restored, unvisited tabs addressable for programmatic close. Register native close cleanup with the host service lifecycle; teardown/reload does not archive threads.
  • Isolate concurrent creations in different parent sessions and clean up a creation that finishes after its tab was closed.
  • Add component, adapter and real-host browser regressions; adapt the image-composer restore test to exact occurrence identity.

Originally based on dev at 09b83cc; now merged with dev at 11e6c8e, including upstream's v0.30.0 / DSH 0.2.2-rc.1 adaptation. The image-input, GenUI and #949 archive-button guard remain intact. No DSH source changes, dependency changes, version bump, or unrelated terminal changes.

Tradeoffs / lifecycle

Upstream merge / conflict resolution — 2026-11-04

Merged dev at 11e6c8e without rewriting the contribution branch. The only textual conflict was the changelog's unreleased section: retained the four Side Chat bullets, the upstream settings navigation icon entry, and the complete v0.30.0 release section. Source and test overlaps merged automatically; an independent read-only review found no lost upstream changes or blockers.

Revalidated with upstream's DSH 0.2.2-rc.1 dependencies:

  • Typecheck, repository-wide lint, build, consumer declarations and pack: pass.
  • Full suite: 247 files / 3044 tests passed, 17 skipped, 0 failed.
  • Selected real-host Chromium cases: 4/4 passed (43.5 s), using the same filter documented below and a new scratch profile.
  • Engine probes: ripgrep passed; fd skipped (not installed).

The first test run before recording the merge hit the history smoke test's expectation that HEAD has a non-empty diff: HEAD was the empty mergeability-refresh commit. After recording the actual merge, the unchanged test and full suite passed; no test was weakened or skipped to resolve it. Windows remains unverified locally.

Initial verification (before the upstream merge)

  • pnpm typecheck — pass.
  • pnpm lint — pass (whole repository).
  • pnpm build and pnpm pack — pass.
  • pnpm test --maxWorkers=2 — 247 files passed; 3047 tests passed, 17 skipped, 0 failed on macOS/Node 22.
  • pnpm check:consumer-types — pass.
  • pnpm check:engines — pass for installed ripgrep; fd checks skipped because fd is not installed.
  • Discriminating regressions: the original v0.28.2 fails the three fresh-create/composer-binding/cross-session-create cases. The additional queued-open and unvisited-close tests were also observed failing before their fixes, then passing.
  • Browser validation on the official DSH 0.2.1-rc.1 baseline: 4/4 passed, using a scratch profile and the packed artifact. Selected cases: both Side Chat plus buttons + independent reload, built-in tab sweep, bottom terminal/no duplicate host terminal, and in-page native entry replacement. Command: bash scripts/e2e-mount.sh --grep 'sidechat multi-instance|plugin mounts into|bottom workbench opens|native tab types survive'.

The browser multi-instance test runs real host registration, layout and plugin rendering, but stubs Side Chat transport: it proves independent bindings and reload behavior, not concurrent model execution. Windows is left to the repository's CI lane.

Design and compatibility notes

Menghuan1918 added a commit that referenced this pull request Nov 15, 2026
Keep the contributor independent-page implementation, but make it opt-in: the default is still one shared page with the session last/newest reattach, and Settings -> Side card -> Side chat can switch to one native page per thread. The descriptor gains a dynamic multiple predicate, native sync re-registers on a flip, and occurrence bindings are read/written only for sidebar://sidechat/<uuid> contentIds so the shared page can never be captured by an old binding.
@Menghuan1918

Copy link
Copy Markdown
Collaborator

Thanks @pennxiang! I rebased the contribution onto current dev and kept your commit (ba6f3a34) as the first-parent contributor commit.

I then added one maintainer commit (04412493) to make the page mode configurable per the product decision:

  • the default remains the shared page (one native page, session last/newest reattach);
  • Settings → Side card → Side chat can switch to one page per thread;
  • the multiple predicate is dynamic and native re-registration follows a flip;
  • occurrence bindings are read/written only for sidebar://sidechat/<uuid>, so the shared page cannot be captured by an old binding;
  • switching affects later opens only; open tabs keep their identity.

Verification: full suite 303 files / 3,518 tests passed (17 skipped) on rc.2; typecheck, lint, build and consumer declarations pass; real-host Chromium mounts pass on both 0.2.2-rc.2 and 0.2.2-rc.3 (26 passed / 6 skipped each), including the repeated-shared-open and three-independent-thread reload cases.

Merged into dev (current dev head 2647fbac). Since I cannot push to your fork, I'm closing the PR with this note; your commit and authorship are preserved in the first-parent history. Thanks for the thorough work!

@pennxiang
pennxiang deleted the fix/sidechat-multiple-native-tabs branch November 16, 2026 06:44
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.

2 participants