feat(core): rotate sessions after idle inactivity#400
feat(core): rotate sessions after idle inactivity#400xukp20 wants to merge 1 commit intochenhg5:mainfrom
Conversation
|
Follow-up on two ideas mentioned in the issue:
I intentionally implemented this as a project-level option instead of a per-platform option. My reasoning is that this behavior is really about cc-connect session lifecycle, not about a specific platform capability. If a project is connected to multiple platforms, a per-platform idle reset policy would make session semantics much harder to reason about:
So for this first version, project-level scope felt much cleaner and more consistent.
I think this is a reasonable follow-up idea, but I did not include it in this PR because it adds a lot of extra interaction complexity:
For this PR, I intentionally kept the behavior minimal and deterministic:
If maintainers think confirmation is important, I would suggest treating that as a follow-up enhancement, for example with a separate mode such as:
|
chenhg5
left a comment
There was a problem hiding this comment.
LGTM. Smart design for idle session rotation.
Review summary:
- ✅ Safer than auto-/new (preserves old session for /list / /switch)
- ✅ User-facing notice before processing
- ✅ Config validation
- ✅ Documentation updated
- ✅ CI passes
- ✅ Fixes #390
Good feature for maintaining fresh agent contexts.
Summary
Add project-level
reset_on_idle_minsto automatically rotate to a fresh session after prolonged user inactivity.This addresses #390, but uses a safer behavior than literally auto-running the current
/newimplementation.Fixes #390
What changed
reset_on_idle_minsconfig.example.tomlWhy this design
The original issue suggests “execute
/newautomatically after inactivity”.Current
/newinmaindoes more than just create a new active session: it also clears the oldsession’s backend binding and history.
That would be too destructive for automatic idle rotation.
This PR therefore uses a safer behavior:
/list//switchSo this behaves more like:
rather than:
Validation
pnpm install --frozen-lockfile && pnpm buildinweb/go build ./...go test ./... -v -racego test ./... -coverprofile=coverage.out -covermode=atomicactionlint -colorgo test -v -tags=smoke,no_web ./tests/e2e/...go test -v -tags=regression,no_web ./tests/e2e/...go test -bench=. -benchmem -tags=performance,no_web ./tests/performance/...reset_on_idle_mins = 1