Repository navigation
Add opt-in auto-archive/delete inactive sessions with merged pull requests - #334341
Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Multi-PR sessions may be archived while an associated pull request remains open.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review tier: Balanced
Findings: 1
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
src/vs/sessions/contrib/github/browser/github.contribution.ts — Evaluate the lifecycle decision once per session rather than once per pull request.… |
What changed in this PR
Adds configurable automatic archival for inactive sessions with merged pull requests, including a one-time opt-in notification.
Changes:
- Registers inactivity-window settings and periodic eligibility checks.
- Adds archival, active-session safeguards, prompting, and tests.
| File | Description |
|---|---|
github.contribution.ts |
Implements configuration, prompting, and automatic archival. |
githubContribution.test.ts |
Tests archival eligibility and prompting. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Base:
|
64a5c36 to
597a753
Compare
roblourens
left a comment
There was a problem hiding this comment.
[Experimental performance review bot]
Automated experimental performance review.
(Written by Copilot)
roblourens
left a comment
There was a problem hiding this comment.
[Experimental performance review bot]
Automated experimental performance review.
(Written by Copilot)
7e6d141 to
0b7eb20
Compare
Co-authored-by: Copilot <[email protected]> Copilot-Session: 85ad2220-1132-4b10-86b1-266e38e2ba29
Co-authored-by: Copilot <[email protected]> Copilot-Session: 85ad2220-1132-4b10-86b1-266e38e2ba29
Co-authored-by: Copilot <[email protected]> Copilot-Session: 85ad2220-1132-4b10-86b1-266e38e2ba29
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Retain automatically archived sessions for a second grace period, then use the existing deletion lifecycle after authoritative PR and session revalidation. Preserve manually archived sessions and retained worktrees, and serialize the final safety checks with deletion. Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]> Copilot-Session: 314ea45a-b321-4127-9f67-91b50794644d
Co-authored-by: Copilot <[email protected]> Copilot-Session: 314ea45a-b321-4127-9f67-91b50794644d
Clarify that archival and permanent deletion use independent retention periods, and link each setting to the other in Settings. Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]> Copilot-Session: 557c3448-77ae-43aa-9ac8-785c2c42b9a7
Co-authored-by: Copilot <[email protected]> Copilot-Session: 557c3448-77ae-43aa-9ac8-785c2c42b9a7
0b7eb20 to
2e7a3d6
Compare
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]> Copilot-Session: 9600876a-8143-4338-b588-d956e3ada89b
Co-authored-by: Copilot <[email protected]> Copilot-Session: 9600876a-8143-4338-b588-d956e3ada89b
Co-authored-by: Copilot <[email protected]> Copilot-Session: 9600876a-8143-4338-b588-d956e3ada89b
roblourens
left a comment
There was a problem hiding this comment.
[Experimental performance review bot]
Automated experimental performance review.
(Written by Copilot)
Co-authored-by: Copilot <[email protected]> Copilot-Session: 9600876a-8143-4338-b588-d956e3ada89b
📬 CODENOTIFYThe following users are being notified based on files changed in this PR: Ulugbek Abdullaev (@ulugbekna)Matched files:
|
Co-authored-by: Copilot <[email protected]> Copilot-Session: 9600876a-8143-4338-b588-d956e3ada89b
Co-authored-by: Copilot <[email protected]> Copilot-Session: 9600876a-8143-4338-b588-d956e3ada89b
Co-authored-by: Copilot <[email protected]> Copilot-Session: 9600876a-8143-4338-b588-d956e3ada89b
Co-authored-by: Copilot <[email protected]>
## Summary - enable VS Code's preview merged agent session auto-archive setting with the recommended 15-day threshold - enable the matching auto-delete grace period so automatically archived merged sessions are cleaned up after 15 more days ## Why VS Code added safe lifecycle settings for inactive agent sessions with merged pull requests in microsoft/vscode#334341. Enabling them keeps completed agent sessions and their eligible worktrees from accumulating in this workspace. ## Validation - `Get-Content -Raw .\.vscode\settings.json | ConvertFrom-Json` Documentation/configuration-only change; no .NET build or test run was needed. Co-authored-by: Copilot <[email protected]>

Summary
This PR adds two application-scoped Preview settings for inactive agent sessions that have at least one merged pull request and no open related pull requests:
chat.agentSessions.autoArchiveMergedSessionsAfterDays0)chat.agentSessions.autoDeleteArchivedMergedSessionsAfterDays0)Worktree cleanup is part of archiving rather than a separate setting. If a retained worktree is still present when permanent deletion becomes eligible, deletion applies the same safe cleanup first.
Lifecycle behavior
Worktree cleanup safety
Archiving or deleting an eligible session removes its worktree only when Git reports all of the following:
Incoming commits do not block cleanup. Missing or unknown Git state fails closed. Cleanup uses ordinary, non-force
git worktree remove, so Git performs a final dirty-worktree check as well. The lifecycle does not commit local changes or force-remove the worktree.Removing a worktree is reversible for an archived session: the checkout can be recreated when the session is unarchived.
User experience
Both settings default to disabled, so sessions remain visible, are not automatically archived, and are not permanently deleted.
The existing one-time Turn On Session Cleanup notification appears for an eligible merged-PR session after 15 days of inactivity while both settings are disabled. Its actions are:
chat.agentSessions.auto*settingsValidation
git diff --checkFixes #334334
Fixes #334352