Skip to content

feat(session): add configurable TTL-based session expiry#18

Merged
TuYv merged 4 commits into
TuYv:masterfrom
genni613:feat/session-ttl-expiry
Apr 17, 2026
Merged

feat(session): add configurable TTL-based session expiry#18
TuYv merged 4 commits into
TuYv:masterfrom
genni613:feat/session-ttl-expiry

Conversation

@genni613

Copy link
Copy Markdown
Collaborator

摘要

支持 Session 过期时间可配置,在加载会话时自动清理超出 TTL 的 Session。

变更

  • SessionStoreSessionData 新增 lastAccessedAt 时间戳;新增 evictExpiredSessions(ttlDays) 扫描并删除过期 Session
  • ChatService:项目打开恢复 Session 前触发过期清理
  • SettingsState / SettingsFormState:新增 sessionTtlDays 字段(默认 30 天,0 = 永不过期)
  • PluginSettingsConfigurable:Chat/Commit 标签页新增 TTL 天数设置控件

测试计划

  • 打开已有 Session 的项目,验证会话正常恢复
  • 将 TTL 设为 1 天,手动将某 Session 文件的 lastAccessedAt 改为 2 天前,重新打开项目,验证该 Session 被清理
  • 将 TTL 设为 0,验证无论多久未访问的 Session 都不会被清理
  • 验证设置页面的 TTL 控件数值在 IDE 重启后正确持久化

yuang.peng and others added 4 commits April 16, 2026 23:56
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add LRU-style eviction for persisted sessions. Sessions older than
the configured TTL (default 30 days) are automatically deleted when
any project session is restored. TTL is configurable via Settings
(Chat/Commit tab), set to 0 to disable expiry.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@genni613 genni613 requested a review from TuYv April 17, 2026 03:29
@TuYv TuYv merged commit c82d1f8 into TuYv:master Apr 17, 2026
4 checks passed
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.

2 participants