Skip to content

fix(session): poll sidebar session list to surface externally created sessions#1551

Closed
Formatted wants to merge 1 commit intodifferent-ai:devfrom
Formatted:fix/automated-runs-visibility
Closed

fix(session): poll sidebar session list to surface externally created sessions#1551
Formatted wants to merge 1 commit intodifferent-ai:devfrom
Formatted:fix/automated-runs-visibility

Conversation

@Formatted
Copy link
Copy Markdown

Summary

  • Add a 30s polling interval that refreshes the sidebar session list when the tab is visible
  • The existing refreshInFlightRef guard prevents overlapping calls, so this does not interfere with user-triggered refreshes
  • Only fires when document.visibilityState === "visible" to avoid unnecessary network requests

Problem

Automated runs, messaging bot sessions (Slack/Telegram), and other externally created sessions were invisible in the sidebar until the user triggered an indirect refresh (e.g. renaming a session). This is because refreshRouteState() was only called on explicit user actions and visibility change events, with no periodic refresh mechanism.

Solution

Added a lightweight useEffect in session-route.tsx that calls refreshRouteState() every 30 seconds when the tab is visible. The existing dedup guard in refreshRouteState ensures overlapping calls are skipped, so this integrates safely with all existing refresh paths.

Files Changed

  • apps/app/src/react-app/shell/session-route.tsx — added periodic polling useEffect

Issue

Fixes #1262

… sessions

Automated runs, messaging bot sessions, and other externally created
sessions were invisible in the sidebar until the user triggered an
indirect refresh (e.g. renaming a session). Add a lightweight 30s
polling interval that calls refreshRouteState() when the tab is
visible. The existing refreshInFlightRef guard prevents overlapping
calls.

Fixes different-ai#1262
@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 24, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
openwork-landing Ready Ready Preview, Comment, Open in v0 Apr 24, 2026 4:30am

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Apr 24, 2026

@Formatted is attempting to deploy a commit to the Different AI Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@src-opn
Copy link
Copy Markdown
Collaborator

src-opn commented Apr 27, 2026

we're moving more to query caching, and having an interval in a useEffect is generally not great practice
closing for now, to be implemented with query caching system

@src-opn src-opn closed this Apr 27, 2026
@Formatted Formatted deleted the fix/automated-runs-visibility branch April 28, 2026 03:31
Formatted added a commit to Formatted/openwork that referenced this pull request Apr 28, 2026
…ternally created sessions

Automated runs, messaging bot sessions (Slack/Telegram), and other externally
created sessions were invisible in the sidebar until the user triggered an
indirect refresh (e.g. renaming a session).

Replaces the closed useEffect+setInterval approach (PR different-ai#1551) with a
visibility-aware polling hook backed by TanStack Query caching:

- New session-list-cache.ts module with query key factory and useSessionListPolling hook
- Session lists written to TanStack Query cache alongside imperative state
- Lightweight refreshSessionLists callback avoids heavy refreshRouteState work
- Existing refreshInFlightRef dedup guard prevents overlapping calls
- Only fires when tab is visible; also fires immediately on visibility change

Fixes different-ai#1262
@Formatted
Copy link
Copy Markdown
Author

Formatted commented Apr 28, 2026

Hi @src-opn — thanks for the feedback. I've opened a replacement PR #1584 that addresses the query caching concern:

  • Session lists are now written to the TanStack Query cache
  • Polling is extracted to a reusable hook with a query key pattern
  • Uses a lightweight session-only refresh instead of the heavy refreshRouteState
  • Still respects the existing refreshInFlightRef dedup guard

Let me know if this approach works better!

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]: Automated Runs not visible until Session renamed

2 participants