Skip to content

feat: tangent - keep track of open tabs while switching sessions inside project - #2729

Open
maxy-shpfy wants to merge 1 commit into
09-16-feat_tangent_-_remote_agent_for_runview_and_editorfrom
09-16-feat_tangent_-_keep_track_of_open_tabs_while_switching_sessions_inside_project
Open

maxy-shpfy wants to merge 1 commit into
09-16-feat_tangent_-_remote_agent_for_runview_and_editorfrom
09-16-feat_tangent_-_keep_track_of_open_tabs_while_switching_sessions_inside_project

Conversation

@maxy-shpfy

@maxy-shpfy maxy-shpfy commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator

Description

Workarea tabs and session tabs are now scoped per-session rather than being reset on every session switch. When the active session changes, the previously open tabs for that session are restored instead of cleared. Backgrounded sessions' tabs unmount naturally, cleaning up their environment/bridge/store registrations without any explicit teardown.

Key changes:

  • useTangentSessionTabs now accepts a sessionId and stores tab state in a bySession map keyed by session ID. Switching sessions automatically restores the correct tab state. resetTabs is replaced by dropSession, which removes a specific session's entry from the map.
  • TangentProjectContext introduces workareaTabsBySessionRef and workareaActiveBySessionRef as the per-session source of truth for workarea tabs. The existing workareaTabs state and refs mirror only the active session. On session switch, the incoming session's tabs are restored from these maps rather than wiping everything.
  • setSessionTabs and setSessionActiveTabId helpers ensure all tab mutations are written to both the per-session maps and the active-session mirror atomically.
  • activeSessionId is derived before useTangentSessionTabs is called so the hook always receives the correct session ID.
  • syncActiveTabRefs extracts the ref-sync logic shared between the session-switch restore path and the useEffect that tracks active tab changes. It also improves the lastEditorTabIdRef fallback: if the last known editor tab is still open it is kept; otherwise the newest pipeline tab is used.
  • When an empty session is discarded, its entries are removed from both per-session maps and dropSession is called to clean up the tab hook's state.

Screen Recording 2026-09-18 at 12.34.48 PM.mov (uploaded via Graphite)

Test Instructions

  1. Open a Tangent project with multiple attached sessions.
  2. Open sub-agent tabs and workarea tabs in session A.
  3. Switch to session B — verify it starts with a clean slate.
  4. Open different tabs in session B.
  5. Switch back to session A — verify its previously open tabs are restored exactly as left.
  6. Discard an empty session and confirm its tab state is fully cleaned up with no lingering entries.
  7. Verify that switching sessions does not leave orphaned environment, bridge, or store registrations.

@github-actions

github-actions Bot commented Sep 17, 2026

Copy link
Copy Markdown

🎩 Preview

A preview build has been created at: 09-16-feat_tangent_-_keep_track_of_open_tabs_while_switching_sessions_inside_project/69346a0

maxy-shpfy commented Sep 17, 2026

Copy link
Copy Markdown
Collaborator Author

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@Mbeaulne
Mbeaulne added this pull request to stack #2782 September 22, 2026 14:59
@camielvs
camielvs force-pushed the 09-16-feat_tangent_-_keep_track_of_open_tabs_while_switching_sessions_inside_project branch from b799a06 to f02add5 Compare September 23, 2026 22:22
@camielvs
camielvs force-pushed the 09-16-feat_tangent_-_keep_track_of_open_tabs_while_switching_sessions_inside_project branch from f02add5 to e75392b Compare September 23, 2026 22:35
@camielvs
camielvs force-pushed the 09-16-feat_tangent_-_keep_track_of_open_tabs_while_switching_sessions_inside_project branch from e75392b to 69346a0 Compare September 23, 2026 23:37

This branch has not been deployed

No deployments
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