Skip to content

Cap External Agent Sessions to 30 Days (replace all, enforce ingest/prune retention) - #331635

Merged
Benjamin Christopher Simmonds (benibenj) merged 8 commits into
mainfrom
copilot/update-agent-sessions-filter
Aug 20, 2026
Merged

Cap External Agent Sessions to 30 Days (replace all, enforce ingest/prune retention)#331635
Benjamin Christopher Simmonds (benibenj) merged 8 commits into
mainfrom
copilot/update-agent-sessions-filter

Conversation

Copilot AI commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Description

This changes external-session visibility from unbounded to a strict 30-day retention model to reduce slow session surfacing/filtering and keep catalog size bounded. The all mode is removed from user-facing options and behavior, while legacy persisted all values are migrated/treated as last30Days.

  • Mode and settings surface

    • Replaced ChatExternalSessionsMode.All with ChatExternalSessionsMode.Last30Days.
    • Updated external session picker/menu labels and ordering to use Last 30 Days as the terminal option.
    • Updated Agent Host schema and chat configuration enums/descriptions accordingly.
  • Backward compatibility for persisted config

    • Added settings migration: chat.agentSessions.showExternal = "all""last30Days".
    • Added runtime fallback in Agent Host root-config read path so legacy stored "all" is interpreted as Last30Days.
  • Single shared retention constant

    • Introduced EXTERNAL_SESSION_MAX_AGE_MS = 30 * DAY_MS and reused it across:
      • visibility filtering (Last30Days mode),
      • external discovery/migration ingestion cutoffs.
  • Ingestion hard cap

    • External/provider-discovered sessions older than 30 days are skipped at registration time (adoptable-legacy exclusions preserved).
  • Deferred stale-row pruning

    • Added delayed post-startup prune routine for stale external registry rows (never local, never adoptable-legacy).
    • Prune result count is logged at info level.
    • Reconciliation/list invalidation is triggered only when rows are actually removed.
  • Targeted coverage updates

    • Updated mode-dependent tests from AllLast30Days.
    • Added coverage for:
      • Last30Days boundary semantics,
      • ingestion skip for >30-day external sessions,
      • prune behavior keeping adoptable-legacy rows intact.
const EXTERNAL_SESSION_MAX_AGE_MS = 30 * DAY_MS;

case AgentHostExternalSessionsMode.Last30Days:
	return session.modifiedTime >= now - EXTERNAL_SESSION_MAX_AGE_MS;

Copilot AI balanced review requested due to automatic review settings August 19, 2026 12:03

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.

Co-authored-by: benibenj <44439583+benibenj@users.noreply.github.com>
Copilot AI changed the title [WIP] Update external sessions filter to show last 30 days only Cap External Agent Sessions to 30 Days (replace all, enforce ingest/prune retention) Aug 19, 2026
@benibenj

Copy link
Copy Markdown
Contributor

Copilot fix merge conflicts

Co-authored-by: benibenj <44439583+benibenj@users.noreply.github.com>

Copilot AI commented Aug 19, 2026

Copy link
Copy Markdown
Contributor Author

Copilot fix merge conflicts

Fixed and merged main into this branch, resolving the conflicts in commit 8216b0564ea.

@benibenj

Copy link
Copy Markdown
Contributor

Copilot resolve the merge conflicts in this pull request

…sessions-filter

# Conflicts:
#	src/vs/platform/agentHost/node/agentService.ts

Co-authored-by: benibenj <44439583+benibenj@users.noreply.github.com>

Copilot AI commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

Copilot resolve the merge conflicts in this pull request

Resolved by merging latest origin/main and fixing the conflict in src/vs/platform/agentHost/node/agentService.ts in commit 0d2a9d2432c.

Co-authored-by: benibenj <44439583+benibenj@users.noreply.github.com>
@benibenj

Copy link
Copy Markdown
Contributor

Copilot remove the eslint changes

This reverts commit 9190dc5.

Co-authored-by: benibenj <44439583+benibenj@users.noreply.github.com>

Copilot AI commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

Copilot remove the eslint changes

Done in 55fb1621: I reverted the ESLint-related changes (build/eslint.ts and build/lib/test/eslint.test.ts) and validated with node --test build/lib/test/eslint.test.ts.

@benibenj

Copy link
Copy Markdown
Contributor

Copilot fix tests and merge conflict

@benibenj

Copy link
Copy Markdown
Contributor

Copilot resolve the merge conflicts in this pull request

Copilot AI and others added 2 commits August 20, 2026 11:31
…sessions-filter

# Conflicts:
#	src/vs/sessions/contrib/providers/agentHost/AGENT_HOST_SESSIONS_PROVIDER.md

Co-authored-by: benibenj <44439583+benibenj@users.noreply.github.com>
Co-authored-by: benibenj <44439583+benibenj@users.noreply.github.com>

Copilot AI commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

Copilot fix tests and merge conflict

Fixed in b375ce1437b: merged latest origin/main, resolved the conflict in src/vs/sessions/contrib/providers/agentHost/AGENT_HOST_SESSIONS_PROVIDER.md, and fixed the failing test by replacing remaining AgentHostExternalSessionsMode.All references with Last30Days in src/vs/platform/agentHost/test/node/agentService.test.ts. Verified with npm run transpile-client and npm run test-node -- --run src/vs/platform/agentHost/test/node/agentService.test.ts.

Copilot AI commented Aug 20, 2026

Copy link
Copy Markdown
Contributor Author

Copilot resolve the merge conflicts in this pull request

I verified this branch against origin/main and there are no remaining merge conflicts (git merge origin/main reports "Already up to date"). If GitHub is still showing a conflict, please share the specific file/path it reports and I’ll resolve it right away.

@benibenj
Benjamin Christopher Simmonds (benibenj) merged commit 32b97f5 into main Aug 20, 2026
28 checks passed
@benibenj
Benjamin Christopher Simmonds (benibenj) deleted the copilot/update-agent-sessions-filter branch August 20, 2026 16:37
@vs-code-engineering vs-code-engineering Bot added this to the 1.135.0 milestone Aug 20, 2026
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.

7 participants