Skip to content

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

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
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