Skip to content

fix(code): Preserve session state on idle-kill and guard against killing active sessions#1458

Closed
charlesvien wants to merge 1 commit intomainfrom
fix/session-idle-kill-preserves-state
Closed

fix(code): Preserve session state on idle-kill and guard against killing active sessions#1458
charlesvien wants to merge 1 commit intomainfrom
fix/session-idle-kill-preserves-state

Conversation

@charlesvien
Copy link
Copy Markdown
Member

@charlesvien charlesvien commented Apr 2, 2026

Idle-killed sessions destroy all chat history, leaving users with a blank screen and no context on retry. Sessions with in-flight MCP tool calls can also be killed since killIdleSession only checks promptPending.

  1. Add inFlightMcpToolCalls.size > 0 check to killIdleSession so sessions with active MCP tools are never idle-killed
  2. Add same check to hasActiveSessions for consistency
  3. Replace teardownSession with handleIdleKill that preserves events, logUrl and config via updateSession instead of removing the session
  4. Add tests for idle-kill guard when MCP tool calls are in-flight

Test plan

  • All 558 existing tests pass
  • New tests for inFlightMcpToolCalls idle-kill guard
  • Manual: trigger idle-kill → verify error overlay with history preserved → Retry reconnects with context

@charlesvien charlesvien changed the title fix(code): Preserve session state on idle-kill instead of destroying it fix: Preserve session state on idle-kill instead of destroying it Apr 2, 2026
@charlesvien charlesvien changed the title fix: Preserve session state on idle-kill instead of destroying it fix(code): Preserve session state on idle-kill and guard against killing active sessions Apr 2, 2026
@charlesvien charlesvien closed this Apr 2, 2026
@charlesvien charlesvien deleted the fix/session-idle-kill-preserves-state branch April 2, 2026 16:53
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