Keep freebuff session alive when browsing /history#515
Conversation
Rendering ChatHistoryScreen at the App level unmounted AuthedSurface, which triggered useFreebuffSession cleanup (DELETE + clear session) and sent the user back to the waiting room on return. Move the history screen inside AuthedSurface so the session stays mounted.
Greptile SummaryThis PR fixes a freebuff session lifecycle bug where navigating to
Confidence Score: 5/5Safe to merge — targeted single-file fix with correct reasoning and no regressions for non-freebuff users. The change is minimal and well-understood: it lifts ChatHistoryScreen inside AuthedSurface so the freebuff session hook is never unmounted during history browsing. The freebuff gate guards are correctly placed before the ChatHistoryScreen check, preserving the waiting-room experience for non-admitted users. Non-freebuff users are unaffected. No security, data-loss, or logic concerns identified. No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant App
participant AuthedSurface
participant useFreebuffSession
participant ChatHistoryScreen
Note over App,ChatHistoryScreen: Before fix — history unmounts AuthedSurface
User->>App: opens /history
App-->>AuthedSurface: unmounts (early return)
AuthedSurface-->>useFreebuffSession: cleanup → DELETE session
App->>ChatHistoryScreen: renders at App level
User->>ChatHistoryScreen: selects chat / cancels
ChatHistoryScreen-->>App: callback
App->>AuthedSurface: remounts
AuthedSurface->>useFreebuffSession: POST → lands in waiting room
Note over App,ChatHistoryScreen: After fix — history renders inside AuthedSurface
User->>App: opens /history
App->>AuthedSurface: stays mounted (showChatHistory=true passed as prop)
AuthedSurface->>useFreebuffSession: session stays alive (no unmount)
AuthedSurface->>ChatHistoryScreen: renders inside (after freebuff gate)
User->>ChatHistoryScreen: selects chat / cancels
ChatHistoryScreen-->>AuthedSurface: onSelectChat / onCancel callback
AuthedSurface->>App: propagates action
Note over AuthedSurface: Session intact — no waiting room
Reviews (1): Last reviewed commit: "Keep freebuff session alive when browsin..." | Re-trigger Greptile |
Summary
/history(and then selecting a chat or canceling) sent the user back to the waiting room.ChatHistoryScreenat theApplevel unmountedAuthedSurface, which ranuseFreebuffSessioncleanup (DELETE + clear session). The next render POSTed again and landed in the waiting room.ChatHistoryScreeninsideAuthedSurface(after the freebuff gate) so the session stays mounted across history browsing.Test plan
/history, select a previous chat — verify you land directly in the resumed chat and not back in the waiting room.🤖 Generated with Claude Code