GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(app): keep terminal mounted when switching session tabs in a workspace by Hona · Pull Request #34852 · anomalyco/opencode

Conversation

@Hona

@Hona Hona commented Jul 2, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Problem

Since #34254, TargetSessionRoute wraps the session route subtree in a <Show> keyed by serverKey + sessionId. Switching between session tabs — even within the same workspace — disposes and recreates everything below it, including TerminalProvider and the ghostty Terminal: the PTY WebSocket is closed, the buffer serialized, then reconnected and restored on every tab switch (visible as the terminal handoff placeholder flash). It also re-created SDKProvider/DirectoryDataProvider/FileProvider/PromptProvider and re-ran their queries on every same-workspace switch. Terminal state is intentionally workspace-scoped and server PTYs survive disconnects, so the remount is pure churn.

#34254's goal was error containment. Its first commit implemented the inner panel boundary with a reactive reset (createEffect(on(sessionKey, reset, { defer: true }))); the later route-level boundary used a keyed remount for the same "reset on tab switch" bullet — which is what introduced the regression. The keyed Show contributes nothing to error isolation itself; the ErrorBoundary does.

Fix

Each identity boundary is owned in exactly one place:

  • Server → remount: owned by app.tsx TargetSessionRoute (keyed around the server-scoped providers). No duplicate keying in session.tsx.
  • Workspace → remount: owned by TargetSessionPage (scope\0directory keyed) — terminal and directory providers live under it and survive same-workspace tab switches.
  • Session → reactive state + scoped error reset: the route-level error boundary (extracted to src/pages/session/route-boundary.ts, context/JSX-free for direct testability) resets when sessionID changes — the same pattern Page already uses for its inner panel boundary. All of fix(app): scope session page errors #34254's behavior is preserved (route failures render inside the session panel frame, stackless not-found panel, Close Tab, error clears on tab switch).

Because #34838 (createSessionLineage) resolved lineage once per mount and relied on the per-session remount, it is reworked to follow in-place session ID changes (src/pages/session/session-lineage.ts): the effect is only a trigger that starts resolution for the current target, each run cancels the previous via onCleanup so late results from abandoned targets are dropped, and the memo is a pure derivation that only trusts settlement for the current target. The transition constraint from #34838 (no resource inside the router navigation transition) is preserved, as are its deleted-session semantics.

Tests

Unit (test-browser/, real solid reactivity under happy-dom):

  • session-route-boundary.test.ts: session switches do not remount the subtree; route errors clear on navigation to another session.
  • session-lineage.test.ts: resolves uncached targets; re-resolves on in-place session change (red against fix(app): resolve target session lineage outside router transition #34838's mount-once behavior); ignores stale failures from abandoned targets; re-resolves pruned revisits; still throws not-found when a settled session is deleted.

E2E (playwright, red-validated against the old keyed-remount behavior):

  • New e2e/regression/terminal-tab-switch.spec.ts: opens a terminal, switches session tabs in the same workspace, asserts the terminal DOM node identity is preserved and exactly one PTY WebSocket connection is ever made. Fails under the previous per-session remount (probe lost, reconnect observed).
  • e2e/regression/subagent-child-navigation.spec.ts (from fix(app): resolve target session lineage outside router transition #34838) passes: parent → child in-place navigation resolves, deleted-session fallback still shows.
  • Full local e2e suite: 66/66 passed.

bun run test (530 pass) and bun typecheck from packages/app; full turbo typecheck via pre-push hook.

Known limitation (pre-existing)

If a tab's session lineage is not yet in the sync cache, directory() is briefly undefined and the workspace subtree remounts while it resolves — same as behavior prior to #34254.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Copilot AI review requested due to automatic review settings July 2, 2026 04:39
@Hona
Hona requested a review from Brendonovich as a code owner July 2, 2026 04:39
Copilot started reviewing on behalf of Hona July 2, 2026 04:39
View session
Copilot AI reviewed Jul 2, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes unnecessary remount churn in the session route subtree when switching between session tabs within the same workspace/server, which was introduced by per-session route keying in #34254. It restores the intended “workspace-scoped terminal persists across same-server session switches” behavior while still ensuring route-level errors clear when navigating to a different session.

Changes:

  • Introduces a new SessionRouteBoundary keyed per server (not session) and moves route-level error scoping/reset behavior into a reactive ErrorBoundary reset tied to sessionID.
  • Refactors TargetSessionRoute to use SessionRouteBoundary and a extracted SessionRouteFallback renderer.
  • Adds browser-condition tests that lock in both “no remount on same-server session switch” and “error clears on session navigation” behaviors.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
packages/app/test-browser/session-route-boundary.test.ts Adds browser tests to assert subtree mount stability across same-server session changes and to ensure stale route errors clear on session navigation.
packages/app/src/pages/session/route-boundary.ts Adds the new structural route boundary component keyed per server and implements reactive error reset on sessionID changes.
packages/app/src/pages/session.tsx Switches the session route to use SessionRouteBoundary and factors fallback rendering into SessionRouteFallback.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Hona added 4 commits July 2, 2026 15:18
@Hona
fix(app): keep terminal mounted when switching session tabs in a work…
d9e62f4
…space
@Hona
refactor(app): drop redundant server keying from session route boundary
a09f6a8
@Hona
fix(app): resolve session lineage across in-place session changes
0eb31eb
@Hona
test(app): cover terminal survival across session tab switches
b2e76a1
@Hona
Hona force-pushed the session-tab-remount branch from 8b12051 to b2e76a1 Compare July 2, 2026 05:48
@Hona
fix(app): gate session lineage by store identity and tidy route boundary
cd06ecb
@Hona Hona added the beta label Jul 2, 2026
@Brendonovich
simplify session keying
cecdc09
opencode-agent Bot added a commit that referenced this pull request Jul 2, 2026
@opencode-agent
Apply PR #34852: fix(app): keep terminal mounted when switching sessi…
cf42c82
…on tabs in a workspace
@Brendonovich
Merge branch 'dev' into session-tab-remount
1adac68
opencode-agent Bot added a commit that referenced this pull request Jul 2, 2026
@opencode-agent
Apply PR #34852: fix(app): keep terminal mounted when switching sessi…
a41ac85
…on tabs in a workspace
@Brendonovich
Brendonovich merged commit 4a42cae into anomalyco:dev Jul 2, 2026
8 checks passed

Uh oh!

There was an error while loading. Please reload this page.

Wiktor102 pushed a commit to Wiktor102/opencode that referenced this pull request Jul 5, 2026
@Hona @Brendonovich @Wiktor102
fix(app): keep terminal mounted when switching session tabs in a work…
cbefe88
…space (anomalyco#34852)

Co-authored-by: Brendan Allan <[email protected]>
github-actions Bot added a commit to wallentx/opencode-termux that referenced this pull request Jul 6, 2026
@github-actions @wallentx
opencode @vglafirov @opencode-agent @adamdotdevin @fwang @Hona @usrnk1 @jayair @rekram1-node @Brendonovich @arvsrn @StarpTech @kitlangton @jlongster @simonklee
Termux v1.17.13 (#4)
768e090
* ci: Add Android build and publish workflow with APK artifact upload

Signed-off-by: wallentx <[email protected]>

* ci: Allow publish workflow to run with android_only input

Signed-off-by: wallentx <[email protected]>

* ci: Use github.token instead of committer output in publish workflow

Signed-off-by: wallentx <[email protected]>

* feat: Add aarch64-linux-android target to sidecar binaries

Signed-off-by: wallentx <[email protected]>

* ci: Simplify publish workflow and fix Android build conditions

Signed-off-by: wallentx <[email protected]>

* feat: Refactor app initialization and add WSL path conversion

Signed-off-by: wallentx <[email protected]>

* ci: Fix Android-only workflow condition and update dependencies

Signed-off-by: wallentx <[email protected]>

* sync release versions for v1.17.13

* chore: bump gitlab-ai-provider to 6.10.0 (anomalyco#34756)

* chore: update nix node_modules hashes

* feat(stats): redesign lab hero

* feat(stats): add lab overview

* feat(stats): redesign lab usage

* feat(data): another redesigned lab section

* feat(stats): use catalog descriptions

* chore: generate

* fix(stats): refine lab page tooltips

* fix(stats): include locale header in vary (anomalyco#34789)

* zen: new inference

* fix(desktop): keep window tabs across app close (anomalyco#34807)

* fix(app): stabilize session timeline layout continuity (anomalyco#34533)

* feat(desktop): refine session tab preview popover (anomalyco#34792)

* fix(ui): raise v2 tooltip layer (anomalyco#34455)

Co-authored-by: Jay <[email protected]>
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>

* chore: update nix node_modules hashes

* fix(opencode): update Cerebras SDK reasoning replay (anomalyco#34826)

Co-authored-by: Aiden Cline <[email protected]>

* chore: update nix node_modules hashes

* fix(app): resolve target session lineage outside router transition (anomalyco#34838)

* chore: generate

* fix(opencode): filter session list by resolved instance directory (anomalyco#34842)

* fix(app): only allow \(...\) syntax for inline latex (anomalyco#34850)

* test(opencode): cover Windows session list directory spellings (anomalyco#34857)

* fix(app): scope session tab indicators to the tab's server (anomalyco#34861)

* chore: generate

* fix(app): clear original prompt after retarget (anomalyco#34863)

* fix(app): seed session status before warming session info (anomalyco#34864)

* feat(app): v2 review panel overhaul (anomalyco#31882)

Co-authored-by: LukeParkerDev <[email protected]>

* fix(app): keep terminal mounted when switching session tabs in a workspace (anomalyco#34852)

Co-authored-by: Brendan Allan <[email protected]>

* fix(ui): resolve toast icon inside the toast component (anomalyco#34874)

* fix(copilot): honor advertised model endpoints (anomalyco#34958)

* fix(stats): polish lab pages

* feat(stats): redesign model hero

* chore: generate

* feat(tui): add debug info dialog with copy to clipboard (anomalyco#35004)

* zen: new inference

* zen: new inference

* feat(app): navigate tabs on mousedown in new layout (anomalyco#35042)

* zen: new inference

* zen: new inference

* fix(app): keep v2 review pane mounted across session tab switches (anomalyco#35074)

* feat: experimental codemode (anomalyco#34677)

* chore: generate

* fix(ci): setup Node 24 before bun install for node-gyp (anomalyco#35076)

* revert: back out experimental codemode (anomalyco#35077)

* feat(codemode): add confined execution package (anomalyco#35079)

* chore: generate

* chore: update nix node_modules hashes

* chore: remove root node-gyp pin after Node 24 setup (anomalyco#35092)

* feat(desktop): add recently closed projects to home (anomalyco#34926)

* feat(app): align subagent UI with v2 (anomalyco#34931)

Co-authored-by: Luke Parker <[email protected]>

* chore: generate

* feat(desktop): papercut fixes (anomalyco#34939)

* refactor(opencode): expose MCP tools in native shape from the service (anomalyco#35103)

* feat(app): improvements to model search (anomalyco#34954)

* chore: generate

* feat(opencode): add code-mode MCP adapter (anomalyco#35085)

* chore: generate

* chore: update nix node_modules hashes

* feat(app): dropdown search fix (anomalyco#34961)

Co-authored-by: Brendan Allan <[email protected]>

* fix(opencode): provide Observability beneath all route service graphs (anomalyco#35171)

* chore: upgrade turbo (anomalyco#35173)

* feat(stats): add model momentum section

* chore: generate

* fix(core): rewrite replacements while hoisting layers (anomalyco#35175)

* fix(stats): link market share labs

* chore: artifacts

* chore: generate

* feat(tui): render code-mode execute tool with child calls (anomalyco#35113)

* refactor(opencode): fail the execute tool on program failure (anomalyco#35180)

* fix(tui): align execute child calls with task indentation (anomalyco#35190)

* refactor(core): move path resolve into fs service (anomalyco#35202)

* feat(opencode): gate execute tool behind code mode flag (anomalyco#35185)

* chore: generate

* cleanup: tweak compaction prompt (anomalyco#35220)

Co-authored-by: Aiden Cline <[email protected]>
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>

* fix(app): restore unfocused composer typing (anomalyco#35249)

* fix(app): delay initial tab preview (anomalyco#35266)

Co-authored-by: Jay <[email protected]>

* fix(desktop): stabilize esm shim injection (anomalyco#35270)

* fix(app): match new session panel corners (anomalyco#35257)

* tui: preserve spinner registration (anomalyco#35292)

* feat: Add aarch64-linux-android target to sidecar binaries

Signed-off-by: wallentx <[email protected]>

* chore(ci): Improve workflow portability and add Android build support

Signed-off-by: wallentx <[email protected]>

* feat(ci): Add Android artifact build workflow and guidance

Signed-off-by: wallentx <[email protected]>

* fix(opencode): use NDK sysroot for Android artifact build

* fix(opencode): pass Android NDK libc paths to Zig

* fix(opencode): patch OpenTUI Android system libs

* fix(opencode): rely on NDK libc config for Android

* fix(opencode): resolve Android OpenTUI loader relatively

* chore(ci): add Android Bun compile smoke target

* fix(opencode): relocate Android Bun payload pointer

* chore(ci): build Android Bun runtime from source

* fix(ci): install LLVM for Android Bun source build

* fix(ci): bootstrap LLVM 21 for Android Bun build

* fix(ci): keep Bun Android build inside source tree

* fix(ci): link Android NDK runtimes for Bun build

* fix(ci): use Android strip for Bun runtime build

* chore(termux): add release mirror workflows

* chore(termux): align app token variables

* chore(termux): use app client id input

* chore(termux): fall back to github token

* chore(termux): prepare v1.17.13

---------

Signed-off-by: wallentx <[email protected]>
Co-authored-by: wallentx <[email protected]>
Co-authored-by: opencode <[email protected]>
Co-authored-by: Vladimir Glafirov <[email protected]>
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
Co-authored-by: Adam <[email protected]>
Co-authored-by: Frank <[email protected]>
Co-authored-by: Luke Parker <[email protected]>
Co-authored-by: usrnk1 <[email protected]>
Co-authored-by: opencode-agent[bot] <219766164+opencode-agent[bot]@users.noreply.github.com>
Co-authored-by: Jay <[email protected]>
Co-authored-by: Aiden Cline <[email protected]>
Co-authored-by: Brendan Allan <[email protected]>
Co-authored-by: Aarav Sareen <[email protected]>
Co-authored-by: Brendan Allan <[email protected]>
Co-authored-by: Dustin Deus <[email protected]>
Co-authored-by: Kit Langton <[email protected]>
Co-authored-by: James Long <[email protected]>
Co-authored-by: Simon Klee <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
drewr pushed a commit to drewr/opencode that referenced this pull request Jul 7, 2026
@Hona @Brendonovich @drewr
fix(app): keep terminal mounted when switching session tabs in a work…
1b9648d
…space (anomalyco#34852)

Co-authored-by: Brendan Allan <[email protected]>
MarsQiu007 referenced this pull request in MarsQiu007/openNovel Jul 31, 2026
@Hona @Brendonovich
fix(app): keep terminal mounted when switching session tabs in a work…
ac80475
…space (#34852)

Co-authored-by: Brendan Allan <[email protected]>
rldona pushed a commit to plazoleta-dev/FlupCode that referenced this pull request Sep 24, 2026
@Hona @Brendonovich
fix(app): keep terminal mounted when switching session tabs in a work…
ac53c35
…space (anomalyco#34852)

Co-authored-by: Brendan Allan <[email protected]>
Ichinose-Kazuki pushed a commit to Ichinose-Kazuki/opencode that referenced this pull request Oct 7, 2026
@Hona @Brendonovich
fix(app): keep terminal mounted when switching session tabs in a work…
8cccb63
…space (anomalyco#34852)

Co-authored-by: Brendan Allan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments
@Brendonovich Brendonovich Awaiting requested review from Brendonovich

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

beta

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@Hona @Brendonovich
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.