Skip to content

Comments

feat: auto-end conversation sessions after inactivity (#40)#87

Open
C-Koelbl wants to merge 3 commits intomainfrom
feat/40-conversation-lock-timeout
Open

feat: auto-end conversation sessions after inactivity (#40)#87
C-Koelbl wants to merge 3 commits intomainfrom
feat/40-conversation-lock-timeout

Conversation

@C-Koelbl
Copy link

@C-Koelbl C-Koelbl commented Feb 9, 2026

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

C-Koelbl and others added 3 commits February 9, 2026 16:43
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>
@C-Koelbl C-Koelbl marked this pull request as ready for review February 12, 2026 15:54
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.

Feature Request: Add "conversation lock timeout" even for users that stay on the editor page, but idle for more than 5 minutes

1 participant