Skip to content

[1.142] agentHost: preserve writable session downgrade compatibility - #341086

Merged
roblourens merged 1 commit into
release/1.142from
roblou/agents/native-session-storage-compat-release-142
Oct 12, 2026
Merged

roblourens merged 1 commit into
release/1.142from
roblou/agents/native-session-storage-compat-release-142

Conversation

@roblourens

Copy link
Copy Markdown
Member

Summary

Backport the complete session-storage compatibility fix from #340980 to release/1.142.

New local Agent Host sessions use provider-neutral ahp-session runtime identities. Older stable clients infer provider routing from persisted schemes, so native-only storage can make sessions unopenable after downgrade. This preserves writable downgrade/re-upgrade without changing the protocol identity.

  • Write newly allocated and genuinely first-seen SDK sessions in stable-readable form through the existing orchestrator and per-session databases.
  • Retain readers for both native and compatibility representations; preserve historical addresses and existing native data.
  • Apply the same boundary to catalogs, tombstones, peer directories, identity-bearing metadata, drafts, and checksums.
  • Retain legacy-readable chat authority during the compatibility window so older-build membership edits survive re-upgrade.
  • Separate frontend summary-cache generations from stable's cache, preventing conflicting cached backend identities.
  • Include every Opus 5.5 and Copilot follow-up: tombstone preservation, allocation/deletion serialization, native discovery preservation, durable cold-receipt hashes, filesystem-error handling, and expanded architecture documentation.

Backport notes

  • Based on origin/release/1.142 at ae69b41c5bd0f9fabd0a4c9a54c78819572a3903.
  • Applies only the final compatibility delta from the main PR, not unrelated main commits or the main version/dependency bump.
  • Preserves the release branch's non-destructive providerAbsent catalog retention, including our checksum bridge across exclusion/revival.
  • Core database/service code and compatibility regressions match the validated main PR.
  • The compatibility reader remains when the allocation writer switches to native storage after the approximately six-month window. Existing compatibility-backed sessions retain their established disk addresses.

Validation

Executed on this release branch after refreshing its dependencies:

  • npm run build-fast -- --client-only — passed.
  • npm run typecheck-client — passed.
  • npm run valid-layers-check — passed.
  • npm run eslint -- src/vs/platform/agentHost/node/{sessionStorageIdentity,compatibleAgentHostDatabase,compatibleSessionDatabase,agentHostDatabase,agentHostBootstrap,agentService,sessionDataService,agentHostPeerChatStore}.ts src/vs/platform/agentHost/test/node/sessionStorageIdentity.test.ts src/vs/sessions/contrib/providers/agentHost/browser/localAgentHostSessionsProvider.ts src/vs/sessions/contrib/providers/agentHost/test/browser/localAgentHostSessionsProvider.test.ts src/vs/sessions/contrib/providers/remoteAgentHost/browser/remoteAgentHostSessionsProvider.ts src/vs/sessions/contrib/providers/remoteAgentHost/test/browser/remoteAgentHostSessionsProvider.test.ts — passed without warnings.
  • git diff --cached --check — passed.
  • Commit-time hygiene — passed.

Affected test selection — 4,040 passed, 28 existing skips:

env -u COPILOT_HOME ./scripts/test.sh --reporter dot \
  --run src/vs/platform/agentHost/test/node/sessionStorageIdentity.test.ts \
  --run src/vs/platform/agentHost/test/node/agentHostPeerChatStore.test.ts \
  --run src/vs/platform/agentHost/test/node/agentHostDatabase.test.ts \
  --run src/vs/platform/agentHost/test/node/sessionDatabase.test.ts \
  --run src/vs/platform/agentHost/test/node/sessionDataService.test.ts \
  --run src/vs/platform/agentHost/test/node/agentHostCatalogSyncService.test.ts \
  --run src/vs/platform/agentHost/test/node/agentHostCatalogReconciliationService.test.ts \
  --run src/vs/platform/agentHost/test/node/agentHostCatalogListReader.test.ts \
  --run src/vs/platform/agentHost/test/node/agentHostCatalogSourceResolver.test.ts \
  --run src/vs/platform/agentHost/test/node/agentSessionRegistry.test.ts \
  --run src/vs/platform/agentHost/test/node/agentService.test.ts \
  --run src/vs/platform/agentHost/test/node/agentHostBootstrap.test.ts \
  --run src/vs/platform/agentHost/test/node/copilotAgent.test.ts \
  --run src/vs/platform/agentHost/test/node/copilotAgentSession.test.ts \
  --run src/vs/platform/agentHost/test/node/claudeAgent.test.ts \
  --run src/vs/platform/agentHost/test/node/codex/codexAgent.test.ts \
  --run src/vs/sessions/contrib/providers/agentHost/test/browser/localAgentHostSessionsProvider.test.ts \
  --run src/vs/sessions/contrib/providers/remoteAgentHost/test/browser/remoteAgentHostSessionsProvider.test.ts

Downgrade evidence and limits

The implementation was also exercised current → unchanged stable 1.141.0 → current in an isolated, independently built worktree with mock SDK providers. Stable could list and restore sessions for Copilot CLI, Claude, and Codex; turn records, titles, drafts, peer additions/archive state, deletion, and historical addresses survived re-upgrade.

That round trip used the earlier implementation checkout; the final release backport is covered by the release-specific suite above. Authenticated real-provider SDKs, GUI downgrade/re-upgrade, and older stable versions were not exercised. The storage contract does not add wire aliases for older clients connected to newer hosts.

(Written by Copilot)

Backport the complete writable session downgrade fix from #340980 to release/1.142, including review fixes, filesystem-error guards, and documentation. Preserve providerAbsent catalog data and its checksum bridge across revival.

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 12, 2026 16:27
@roblourens
roblourens enabled auto-merge (squash) October 12, 2026 16:29
@github-actions

Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: ae69b41c Current: eebe33b6

Changed (1)

sessions/chatCompositeBar/MixedStatuses/Light
Before After
before after

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.

🔵 Needs a closer look

Cross-version database compatibility is high-risk, and authenticated providers plus GUI downgrade round trips remain unvalidated.

0 open findings

What changed in this PR

Backports writable Agent Host session downgrade compatibility to release 1.142 while retaining provider-neutral runtime identities.

Changes:

  • Adds runtime-to-storage identity translation across Agent Host databases, metadata, drafts, catalogs, and peer chats.
  • Isolates current frontend caches from stable cache generations.
  • Adds architecture documentation and comprehensive downgrade regression coverage.
File Description
agentHostBootstrap.ts Initializes compatibility-aware storage.
agentHostDatabase.ts Persists identity and checksum metadata.
agentHostPeerChatStore.ts Preserves archived peer state.
agentService.ts Selects compatible storage safely.
compatibleAgentHostDatabase.ts Translates orchestrator persistence.
compatibleSessionDatabase.ts Translates per-session persistence.
serviceBootstrapping.md Documents storage initialization ownership.
sessionDataService.ts Applies storage identity mapping.
sessionStorageIdentity.ts Implements identity translation.
sessionStorageIdentity.test.ts Covers compatibility and concurrency cases.
AGENT_HOST_SESSIONS_PROVIDER.md Documents the persistence contract.
localAgentHostSessionsProvider.ts Advances the local cache generation.
localAgentHostSessionsProvider.test.ts Tests local cache isolation.
remoteAgentHostSessionsProvider.ts Advances remote cache generations.
remoteAgentHostSessionsProvider.test.ts Tests remote cache isolation.

🧠 Review effort: Balanced


💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@roblourens
roblourens merged commit 858942d into release/1.142 Oct 12, 2026
36 checks passed
@roblourens
roblourens deleted the roblou/agents/native-session-storage-compat-release-142 branch October 12, 2026 16:53
@vs-code-engineering vs-code-engineering Bot added this to the 1.142.0 milestone Oct 12, 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.

3 participants