Skip to content

Persist session ID in sessionStorage for tab identity - #8162

Open
cstns wants to merge 4 commits into
mainfrom
feat/add-a-tab-session-id-to-the-context-store
Open

Persist session ID in sessionStorage for tab identity#8162
cstns wants to merge 4 commits into
mainfrom
feat/add-a-tab-session-id-to-the-context-store

Conversation

@cstns

@cstns cstns commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Description

The agent stores, expert store, and post-message service are all untouched. Chat session IDs remain as they are.

Addendum: reuse account-auth session ID instead of a new tabSessionId

The original approach added a new tabSessionId to the context store. After further discussion, we realized the account-auth.js store already has a per-tab sessionId (generated via getSessionId(), used by the fe-team MQTT connection for broker client uniqueness). The only problem was that it was stored in-memory, so it died on page refresh.

By persisting it to sessionStorage, it becomes exactly what tabSessionId was supposed to be: per-tab, stable across refreshes, unique across tabs. This also means we can reuse the existing fe-team MQTT connection for presence topics on the backend, so there's no need for a separate MQTT connection or a new client identity for MCP presence. The tabSessionId addition to the context store was reverted.

The change simplifies to: persist the existing account-auth session ID in sessionStorage (split the persist config into an array with localStorage for redirectUrlAfterLogin and sessionStorage for sessionId).

Related Issue(s)

closes #8157

Checklist

  • I have read the contribution guidelines
  • Suitable unit/system level tests have been added and they pass
  • Documentation has been updated
    • Upgrade instructions
    • Configuration details
    • Concepts
  • Changes flowforge.yml?
    • Issue/PR raised on FlowFuse/helm to update ConfigMap Template
    • Issue/PR raised on FlowFuse/CloudProject to update values for Staging/Production
  • Link to Changelog Entry PR, or note why one is not needed.

Labels

  • Includes a DB migration? -> add the area:migration label

@cstns cstns self-assigned this Aug 10, 2026
@cstns
cstns requested a review from Steve-Mcl August 10, 2026 15:10
@codecov

codecov Bot commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 76.19%. Comparing base (9515085) to head (5d62084).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8162   +/-   ##
=======================================
  Coverage   76.19%   76.19%           
=======================================
  Files         441      441           
  Lines       23619    23619           
  Branches     6289     6289           
=======================================
  Hits        17996    17996           
  Misses       5623     5623           
Flag Coverage Δ
backend 76.19% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cstns

cstns commented Aug 11, 2026

Copy link
Copy Markdown
Contributor Author

see #8157 (comment)

@cstns
cstns requested a review from n-lark August 11, 2026 03:43
@cstns cstns changed the title Add tabSessionId to context store with persistence using sessionStorage Persist session ID in sessionStorage for tab identity Aug 11, 2026
@cstns
cstns deployed to staging August 11, 2026 03:47 — with GitHub Actions Active
@cstns
cstns deployed to staging August 11, 2026 04:02 — with GitHub Actions Active
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.

Add a tab session ID to the context store for third-party MCP targeting

1 participant