feat: auto-end conversation sessions after inactivity (#40)#87
Open
feat: auto-end conversation sessions after inactivity (#40)#87
Conversation
Introduce a configurable session timeout so idle chat conversations are released automatically. This prevents conversations from staying locked when the user leaves the tab or stops interacting. Session timeout and countdown - Add CHAT_SESSION_TIMEOUT_MINUTES (default 5). Same value is used for server-side stale release and for the in-app countdown. - Show an "Ends in M:SS" countdown next to "Back to projects". It only resets when the user clicks the refresh (Continue) button or returns to the tab; automatic heartbeats do not reset it. - When the countdown reaches zero, the client POSTs to the conversation finish endpoint and redirects to the project list. Heartbeat and visibility - Heartbeats are sent only when the tab is visible. If the user switches to the project list or another tab, heartbeats stop and the session can be released after the timeout. - Stale release on the server only considers conversations that have no EditSession with status Running (no extra DB column). Countdown behaviour - While the agent is working: countdown is reset to full and frozen; it resumes when the agent is done and the user can enter new orders. - When the user types in the instruction field: countdown is reset to full so the session does not end while they are composing a message. Implementation - Chat controller dispatches custom events (agent-work-started, agent-work-finished, user-typed); conversation heartbeat controller listens and adjusts countdown and freeze state accordingly. Closes #40
…lock-timeout Co-authored-by: Cursor <cursoragent@cursor.com> # Conflicts: # src/ChatBasedContentEditor/Presentation/Controller/ChatBasedContentEditorController.php # src/ChatBasedContentEditor/Presentation/Resources/assets/controllers/chat_based_content_editor_controller.ts # src/ChatBasedContentEditor/Presentation/Resources/templates/chat_based_content_editor.twig
…Name match expressions Post-merge fix: the new enum cases introduced on main were not handled in maxContextTokens(), inputCostPer1M(), outputCostPer1M(), and isImageGenerationModel(), causing PHPStan errors. Co-authored-by: Cursor <cursoragent@cursor.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Introduce a configurable session timeout so idle chat conversations are released automatically. This prevents conversations from staying locked when the user leaves the tab or stops interacting.
Session timeout and countdown
Heartbeat and visibility
Countdown behaviour
Implementation
Closes #40