Skip to content

fix(usage): batch live session refresh - #58

Merged
fkesheh merged 2 commits into
mainfrom
fix/smart-usage-refresh
Aug 7, 2026
Merged

fix(usage): batch live session refresh#58
fkesheh merged 2 commits into
mainfrom
fix/smart-usage-refresh

Conversation

@fkesheh

@fkesheh fkesheh commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • replace one get_session_usage RPC per running session with one get_sessions_usage batch per bridge
  • poll only running sessions with a structured usage source
  • coalesce running-set changes for one second instead of repolling the whole set immediately on every addition
  • pause usage traffic while the dashboard tab is hidden and refresh once when it becomes visible
  • retain the single-session usage command for CLI and compatibility
  • cap batches at 200 IDs and bump ftown-bridge to 0.19.7

Root cause

The UI mapped a per-session RPC across every running session. Both each running-ID-set change and a 15-second interval invoked that unbounded fan-out. One prior E2E bridge run recorded 217 usage commands in roughly three and a half minutes.

Result

For N eligible sessions on one bridge, a normal refresh now emits one bridge command instead of N. Shell, Cursor, completed sessions, sessions without a native transcript ID, and hidden tabs emit no periodic usage requests.

Validation

  • bridge: 534 tests passed
  • UI: 132 tests passed
  • bridge TypeScript build passed
  • UI TypeScript check passed
  • package dry-run produced ftown-bridge-0.19.7.tgz

@vercel

vercel Bot commented Aug 7, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
ftown Ready Ready Preview Aug 7, 2026 8:27am

Request Review

@fkesheh
fkesheh merged commit 813789f into main Aug 7, 2026
6 checks passed
@fkesheh
fkesheh deleted the fix/smart-usage-refresh branch August 7, 2026 09:00
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.

1 participant