Skip to content

agentHost: centralize session and chat catalog metadata - #332410

Open
Sandeep Somavarapu (sandy081) wants to merge 53 commits into
mainfrom
sandy081/agents/session-db-data-migration-plan
Open

agentHost: centralize session and chat catalog metadata#332410
Sandeep Somavarapu (sandy081) wants to merge 53 commits into
mainfrom
sandy081/agents/session-db-data-migration-plan

Conversation

@sandy081

@sandy081 Sandeep Somavarapu (sandy081) commented Aug 24, 2026

Copy link
Copy Markdown
Member

1. What this PR changes

Today, listSessions often enumerates providers and opens many individual session.db files to obtain titles, workspace information, read state, changes, and chats.

This PR makes agent-host.db the central index for session-list data:

  • sessions_v2: authoritative session identity, provider, timestamps, registration source, external state, and chat-backing identity.
  • Central chat membership: authoritative chat list, ordering, routing, and origin information.
  • Rebuildable list payload: title, read/archive state, project presentation, Git/GitHub summaries, aggregate changes, artifacts, and lightweight chat summaries.

Full conversation data—including turns, drafts, attachments, annotations, and detailed edits—remains isolated in individual session and chat databases.

2. Listing and synchronization

Normal listSessions calls now read verified payloads directly from agent-host.db instead of opening every conversation database.

If one payload is missing, stale, or invalid:

  • Only that session uses the fallback path.
  • Other valid central rows remain fast.
  • The invalid row is scheduled for background repair.
  • Provider unavailability does not discard the last valid cached representation.

Changes to titles, read state, workspace information, changes, or chats mark the payload dirty. Background reconciliation uses revisions and compare-and-set operations so delayed work cannot overwrite newer state.

3. Migration and compatibility

Existing sessions are imported from the legacy registry and provider discovery. Migration is resumable, tracked per provider, and normally runs in the background so the first list does not wait for the full migration.

The PR also protects upgrade and downgrade scenarios:

  • Central chat membership is temporarily mirrored into legacy peerChats.
  • Changes made by an older build are imported when a newer build starts again.
  • Tombstones prevent deleted sessions from being rediscovered.
  • Invalid provider entries are isolated and retried.
  • Title precedence remains consistent before and after opening a session.
  • Oversized summaries are bounded without changing provider-native data.

All product schema changes are introduced in one new v5 migration, after upstream’s existing v4 migration. A separate normalizer handles databases produced by earlier versions of this draft PR.

4. Testing

Coverage includes:

  • Fresh databases and existing profiles
  • Partial and interrupted migration
  • Restarts and crash recovery
  • Concurrent Agent Host processes
  • Session and chat deletion
  • Provider failures and retries
  • Corrupt or stale payload fallback
  • Title and background-update races
  • Old → new → old → new build cycles
  • Oversized metadata and Unicode truncation
  • Pre-release schema normalization

The affected unit suites pass, and the real-process compatibility matrix passed 20/20 scenarios.

5. Performance

Real AHP measurements used equivalent pre-migration profile data, three fresh processes per target, and 60 warm calls per target:

Metric origin/main This PR Improvement
Cold mean 1,314.9 ms 123.4 ms 90.6% faster
Cold median 1,259.8 ms 34.1 ms 97.3% faster
Warm mean 431.6 ms 80.0 ms 81.5% faster
Warm median 342.7 ms 53.1 ms 84.5% faster
Warm p95 711.3 ms 174.2 ms 75.5% faster

The PR returned 32 sessions versus 26 on origin/main, so it was faster while producing a larger result.

6. PR size

The PR adds 11,782 lines, but approximately 6,717 lines—57%—are tests.

The remaining approximately 5K lines implement the database schema, catalog projection, migration, synchronization, reconciliation, chat membership, compatibility handling, and Agent Service integration. The size reflects the reliability work required for a persistence migration rather than the amount of data being moved.

Add a backward-compatible sessions_v2 catalog, legacy-first synchronization receipts, reconciliation, shadow validation, central fallback reads, and durable chat metadata while retaining open-only content in per-session databases.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adapt the sessions_v2 catalog and reconciliation work to the latest Agent Host composition, adoption, metadata, and test infrastructure changes.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Make sessions_v2 an independent current registry, import directly from current, legacy, and provider sources, mirror runtime identities for downgrade compatibility, and reconcile cross-version changes with durable exclusions and versioned markers.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move catalog source resolution and downgrade-compatible peer chat persistence out of AgentService into focused helpers without changing migration or runtime behavior.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings August 24, 2026 19:08

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.

Pull request overview

Introduces a centralized, verified sessions_v2 catalog for efficient Agent Host session listing, migration, downgrade compatibility, and recovery.

Changes:

  • Adds catalog schemas, canonical projections, synchronization receipts, migration, reconciliation, and shadow validation.
  • Integrates central listing with session mutations, peer chats, Git state, titles, and legacy adoption.
  • Adds extensive persistence, compatibility, recovery, and rollout tests.
Show a summary per file
File Description
src/vs/platform/agentHost/common/agent.ts Extends adoption results with recovered list metadata.
src/vs/platform/agentHost/common/sessionDataService.ts Defines catalog synchronization receipt APIs.
src/vs/platform/agentHost/node/agentHostBootstrap.ts Wires catalog persistence into bootstrap.
src/vs/platform/agentHost/node/agentHostCatalogListReader.ts Converts verified catalog rows into list metadata.
src/vs/platform/agentHost/node/agentHostCatalogProjection.ts Implements canonical bounded projections and hashing.
src/vs/platform/agentHost/node/agentHostCatalogReconciliationService.ts Repairs interrupted or stale synchronization.
src/vs/platform/agentHost/node/agentHostCatalogShadowValidator.ts Compares central and legacy listing results.
src/vs/platform/agentHost/node/agentHostCatalogSourceResolver.ts Resolves canonical catalog source metadata.
src/vs/platform/agentHost/node/agentHostCatalogSyncService.ts Coordinates local-first catalog synchronization.
src/vs/platform/agentHost/node/agentHostDatabase.ts Adds sessions_v2, exclusions, and compatibility migrations.
src/vs/platform/agentHost/node/agentHostGitStateService.ts Persists Git summaries through the catalog path.
src/vs/platform/agentHost/node/agentHostPeerChatStore.ts Persists downgrade-compatible peer-chat membership.
src/vs/platform/agentHost/node/agentHostServices.ts Registers catalog-aware persistence dependencies.
src/vs/platform/agentHost/node/agentHostSessionTitleController.ts Routes title metadata through catalog synchronization.
src/vs/platform/agentHost/node/agentHostSessionsV2MigrationService.ts Implements direct, resumable v2 migration.
src/vs/platform/agentHost/node/agentService.ts Integrates migration, listing, synchronization, and peer chats.
src/vs/platform/agentHost/node/agentServiceComposition.ts Supplies catalog persistence callbacks.
src/vs/platform/agentHost/node/agentSessionRegistry.ts Adds dual-registry compatibility behavior.
src/vs/platform/agentHost/node/agentSideEffects.ts Persists list-visible state changes centrally.
src/vs/platform/agentHost/node/copilot/copilotAgent.ts Updates legacy adoption and metadata recovery.
src/vs/platform/agentHost/node/localCommands/localChatCommand.ts Extends coordinated metadata persistence.
src/vs/platform/agentHost/node/localCommands/renameLocalCommand.ts Persists title and title-source metadata together.
src/vs/platform/agentHost/node/sessionCoordination.ts Integrates catalog-aware session coordination.
src/vs/platform/agentHost/node/sessionDatabase.ts Adds synchronization snapshot storage and transactions.
src/vs/platform/agentHost/test/common/sessionTestHelpers.ts Extends test database helpers for receipts.
src/vs/platform/agentHost/test/node/agentHostCatalogListReader.test.ts Tests central row conversion and eligibility.
src/vs/platform/agentHost/test/node/agentHostCatalogProjection.test.ts Tests canonicalization, limits, and verification.
src/vs/platform/agentHost/test/node/agentHostCatalogReconciliationService.test.ts Tests repair and interrupted-write recovery.
src/vs/platform/agentHost/test/node/agentHostCatalogShadowValidator.test.ts Tests shadow mismatch classification.
src/vs/platform/agentHost/test/node/agentHostCatalogSourceResolver.test.ts Tests source and legacy metadata resolution.
src/vs/platform/agentHost/test/node/agentHostCatalogSyncService.test.ts Tests synchronization ordering and recovery.
src/vs/platform/agentHost/test/node/agentHostDatabase.test.ts Tests v2 schema and compatibility behavior.
src/vs/platform/agentHost/test/node/agentHostGitStateService.test.ts Tests catalog-backed Git persistence.
src/vs/platform/agentHost/test/node/agentHostPeerChatStore.test.ts Tests peer-chat storage and malformed data handling.
src/vs/platform/agentHost/test/node/agentHostServices.test.ts Tests service dependency registration.
src/vs/platform/agentHost/test/node/agentHostSessionTitleController.test.ts Tests coordinated title persistence.
src/vs/platform/agentHost/test/node/agentHostTurnTelemetry.test.ts Updates telemetry fixtures for persistence wiring.
src/vs/platform/agentHost/test/node/agentService.test.ts Tests rollout modes, migration, compatibility, and adoption.
src/vs/platform/agentHost/test/node/agentServiceTestUtils.ts Extends AgentService database test doubles.
src/vs/platform/agentHost/test/node/agentSessionRegistry.test.ts Tests dual-registry session lifecycle behavior.
src/vs/platform/agentHost/test/node/agentSideEffects.test.ts Tests catalog persistence from state changes.
src/vs/platform/agentHost/test/node/copilotAgent.test.ts Tests legacy adoption metadata behavior.
src/vs/platform/agentHost/test/node/sessionCoordination.test.ts Tests catalog-aware coordination behavior.
src/vs/platform/agentHost/test/node/sessionDatabase.test.ts Tests receipt migration and atomic persistence.
src/vs/sessions/contrib/providers/agentHost/AGENT_HOST_SESSIONS_PROVIDER.md Documents the centralized catalog architecture.

Review details

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

  • Files reviewed: 44/45 changed files
  • Comments generated: 7
  • Review effort level: Balanced

Comment thread src/vs/platform/agentHost/test/node/agentHostCatalogSyncService.test.ts Outdated
Comment thread src/vs/platform/agentHost/test/node/agentHostCatalogShadowValidator.test.ts Outdated
Comment thread src/vs/platform/agentHost/node/agentService.ts Outdated
Comment thread src/vs/platform/agentHost/node/copilot/copilotAgent.ts Outdated
Comment thread src/vs/platform/agentHost/node/agentHostSessionsV2MigrationService.ts Outdated
Comment thread src/vs/platform/agentHost/node/agentService.ts Outdated
Comment thread src/vs/platform/agentHost/node/agentService.ts Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adopts the upstream Agent Host provider-service and chat-contribution
refactors while keeping the session-catalog (Option D) work:

- Rebases the durable `sessions.modified_time` column onto the sessions_v2
  chain as migration 9, and adds `sessions_v2.modified_time` as migration
  10 so the authoritative registry owns recency in both tables.
- Threads `modifiedTime` through every sessions_v2 read, registration,
  envelope upsert and receipt, and makes `updateSessionModifiedTime`
  advance both registries in one transaction.
- Moves provider registration onto `IAgentHostProviderService` while
  preserving catalog reconciliation scheduling and serialized discovery
  registrations, and routes deferred provider catalogs through the
  sessions_v2 importer.
- Renames the catalog payload's artifact flag to `isArtifact` and adopts
  the upstream artifact parse contract.
- Lets the catalog list reader serve the fresher of the payload and
  registry recency, and withholds the readable-catalog marker when an
  import pass leaves candidates unimported.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sandy081 Sandeep Somavarapu (sandy081) changed the title agentHost: centralize session list metadata in sessions_v2 agentHost: centralize session and chat catalog metadata Aug 28, 2026
Comment thread src/vs/platform/agentHost/node/agentHostDatabase.ts
Comment thread src/vs/platform/agentHost/node/agentHostDatabase.ts
Comment thread src/vs/platform/agentHost/node/agentHostCatalogSourceResolver.ts Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Base: 0af2bfdd Current: 726ef00b

No screenshot changes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Only rewrite chat-local compatibility metadata for added or changed peers on normal mutations, while retaining full repair for legacy imports and stale mirrors.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vijayupadya

Copy link
Copy Markdown
Contributor

Sandeep Somavarapu (@sandy081)

Attaching the repro video. For the example missing session, notice the first two sessions named 'Sept 4-*" that shows up at the top initially, which disappear after pressing back button. Most of 800 sessions also disappear.

migration-repro.mp4

@roblourens roblourens left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[Experimental performance review bot]

Automated experimental performance review.

(Written by Copilot)

Comment thread src/vs/platform/agentHost/node/agentService.ts Outdated
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Recreate the released turn-delegation table alongside the catalog snapshot so databases produced by the earlier catalog-only v10 migration converge after updating.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Keep unadopted legacy sessions out of Agent Host title generation so list-only migration cannot create local session storage and prematurely transfer provider ownership.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sandy081

Sandeep Somavarapu (sandy081) commented Sep 5, 2026

Copy link
Copy Markdown
Member Author

Update: This earlier title-generation fix was not the complete fix for the 800-session disappearance. Runtime discovery had another storage-creation path, now fixed in 892b6e0bc83 and verified with the supplied dataset in a real window (797 sessions retained). See the confirmed reproduction and fix. The affected old profiles mentioned below are PR test profiles only; these changes are not in production, and a production recovery migration is not required.


Vijay Upadya (@vijayupadya) Thanks for the video — it exposed a concrete ownership bug. I reproduced it with a focused test: an untitled ehcliAdoptable legacy session was incorrectly entering Agent Host external-title generation. Persisting that generated title creates agentSessionData/<session-id>, so the legacy provider stops listing it while Agent Host still hides it as unadopted. The test failed with the adoptable session present in scheduledTitles and now passes after 3392bf9d61d; Agent Host filters adoptable rows before and during title generation. The full AgentService suite and type check pass.

Could you please rerun using a fresh user-data profile (or an uncontaminated copy of the legacy dataset) at the latest head? Existing agentSessionData/<id> directories created by earlier builds will remain on disk and can continue to hide those sessions in the old profile even though new migration runs no longer create them. Please keep the affected old profile intact so we can add a safe recovery path separately rather than deleting potentially valid Agent Host data.

@roblourens roblourens left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[Experimental performance review bot]

Automated experimental performance review.

(Written by Copilot)

Comment thread src/vs/platform/agentHost/node/agentService.ts Outdated
Keep one active synchronization and one merged trailing projection per session so summary bursts do not build an unbounded SQLite write backlog.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Use type-safe property access in the payload decoder and the database sequencing test so full-repository ESLint passes.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@roblourens roblourens left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[Experimental performance review bot]

Automated experimental performance review.

(Written by Copilot)

Comment thread src/vs/platform/agentHost/node/agentService.ts Outdated
Publish passive metadata without awaiting full catalog synchronization, batch discovery timestamp and dirty-marker updates, and rotate persisted bounded verification samples instead of rescanning every catalog row on each startup.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Retain central catalog ownership and bounded synchronization. Adapt the new peer workspace-transition test to central chat creation and verify listing does not read transition history.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@roblourens roblourens left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[Experimental performance review bot]

Automated experimental performance review.

(Written by Copilot)

Comment thread src/vs/platform/agentHost/node/agentHostDatabase.ts
Batch parameterized chat inserts within the existing revision-checked transaction. Cover bounded SQLite statement counts and atomic rollback after a later batch fails.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

@roblourens roblourens left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[Experimental performance review bot]

Automated experimental performance review.

(Written by Copilot)

Comment thread src/vs/platform/agentHost/node/agentService.ts Outdated
Avoid creating local session storage for adoptable legacy chats discovered after migration is enabled. Directory creation makes the legacy provider hide sessions before explicit adoption. Preserve existing compatibility synchronization for locally stored sessions and non-legacy discovery.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sandy081

Copy link
Copy Markdown
Member Author

Vijay Upadya (@vijayupadya) I have now reproduced the disappearance in a real Code OSS window using a macOS port of your supplied 800-session generator and the migration-OFF -> full restart with migration-ON sequence. The confirmed fix is pushed in 892b6e0.

Root cause: the initial importer already avoided creating storage for unopened legacy sessions, but runtime discovery still used the storage-creating catalog synchronization path. An empty import completed with migration OFF leaves a persisted marker; after enabling migration, legacy sessions arrive through runtime discovery. That path created agentSessionData/<id>/session.db before adoption. The legacy provider then hid them because the directory existed, while Agent Host still hid them as unadopted (ehcliAdoptable). The collapse also reproduced just by waiting for discovery, without requiring a failed open.

Fix: runtime discovery of adoptable legacy sessions now uses the non-creating catalog synchronization path. Absent local storage stays absent; existing local databases retain the coordinated compatibility/receipt path. Other runtime discovery behavior is unchanged.

Live validation with fresh, isolated profiles:

Step Before this fix After this fix
Migration OFF baseline 797 visible 797 visible
Migration ON after full restart and discovery 514, then 7 visible 797 visible
Legacy open/Back, external open/Back, wait and refresh Collapsed list remained 797 visible

After the fix, only the three explicitly opened ordinary legacy sessions acquired local Agent Host databases; unopened legacy sessions did not. The five external fixtures retained their normal separate discovery behavior. All 800 original conversation histories remained intact.

Added a regression test for runtime discovery after a completed empty import: it fails before this change and passes afterward. Validation: 529 relevant unit tests passed, 16 skipped; targeted ESLint and commit hygiene passed.

Correction to my earlier update: the title-generation fix in 3392bf9 addressed a real additional path, but its focused test did not reproduce or fully fix this 800-session runtime-discovery collapse. The above results are from the actual supplied dataset flow.

These changes are not in production. The lingering bad state discussed earlier applies only to test profiles run against earlier buggy builds of this PR, not production users. Please retest with a fresh isolated user-data profile and regenerated dataset; retaining the old affected profile for diagnosis is fine, and no production recovery migration is required for this PR-only bug.

The reported untitled-* "Session is not an adoptable legacy chat" subscription error is separate and is not fixed by this commit.

Compare summary status deltas against the notifier's previous snapshot and only queue catalog persistence when persisted fields change. Activity-only and transient status updates avoid database work while read/archive changes and explicit field clears remain synchronized.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Merge main through 58ba154, retaining central registry and peer membership authority, central-only legacy discovery, and projected summary synchronization. Adopt upstream automation service construction and cover batched artifact persistence and database-free catalog listing after restart.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Stop reconciliation scheduling and drain accepted dispatches and catalog synchronization before shutting down providers and closing the central database. This preserves read/archive updates already published to clients across an immediate host restart without blocking normal passive notifications on catalog work.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Wait for asynchronous tool completions before normal SDK idle clears the active turn. Preserve immediate abort handling and original tool-result attribution when a replacement turn starts while file-edit persistence is pending. Add deterministic delayed-completion, abort, and replacement-turn regressions.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sandy081

Copy link
Copy Markdown
Member Author

Fixed the failing Electron checks with two ordering fixes:

  • ca1b69ad07d: shutdown drains accepted dispatches and catalog synchronization before closing the central database. The read/archive restart failure was reproducible deterministically by blocking catalog synchronization: shutdown previously completed with the old flags still in the catalog. Normal passive notifications remain non-blocking. Validation: 538 relevant unit tests; the restart E2E passed twice each for Copilot, Codex, and Claude. CI on this commit completed with 32 passing checks, including all three Electron platforms.
  • b095443a4fb: normal Copilot SDK idle waits for asynchronous tool-completion processing before clearing the active turn. Delaying file-edit persistence reproduced the missing file-edit result assertion seen on Linux. Added permanent deferred-completion, immediate-abort, and replacement-turn tests; tool results retain their original turn ID. Validation: all 436 Copilot session unit tests and both focused file-edit replay scenarios passed, along with type-check, ESLint, and hygiene. CI is rerunning for this final commit.

No tests were disabled, fixtures rewritten, or timeouts increased.

@roblourens roblourens left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[Experimental performance review bot]

Automated experimental performance review.

(Written by Copilot)

if (!e.data.aborted && pendingToolCompletions.size > 0) {
const pendingTurn = this._currentTurn.value;
// File-edit persistence must finish before idle clears the turn and its tool results.
await Promise.allSettled(pendingToolCompletions);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

[Experimental performance review bot]

Severity: medium

Tool completion callbacks are now tracked in one set for the lifetime of the session wrapper, and every normal idle waits for all entries in that set, regardless of which turn created them.

After aborting an edit and immediately sending a replacement prompt, the replacement turn can appear stuck at completion until unrelated cleanup from the cancelled turn finishes, increasing end-of-turn latency in proportion to the slowest outstanding prior edit.

Suggested fix: Track completion promises by their captured turn and await only the current turn's set. On abort, detach that turn's entries from the idle barrier while still allowing their cleanup/persistence promises to settle.

(Written by Copilot)

@vijayupadya

Copy link
Copy Markdown
Contributor

Sandeep Somavarapu (@sandy081)
Sessions disappearing from the list seems to be resolved now with the latest changes.
I see one issue:
-click on legacy session, which triggers migration

  • Press back button to bring up session list
  • I see this error in console log (Developer: Toggle developer Tools)
    Session is not an adoptable legacy chat: copilotcli:/untitled-5b87d1e2-cea0-48b9-8929-6e8f71d97160

Do not subscribe to untitled UI identities when Back returns to the new-chat input. Wait for the existing provisional-session service to publish a backend and follow its mapping changes, releasing obsolete subscriptions. Cover Back, provisioning, replacement, retirement, and return to a started session.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@sandy081

Copy link
Copy Markdown
Member Author

Vijay Upadya (@vijayupadya) Thanks for confirming that the disappearing sessions issue is resolved. I reproduced your new console error on the latest head in a real Code OSS window using your generated legacy dataset: all three legacy-open -> Back attempts produced Session is not an adoptable legacy chat: copilotcli:/untitled-*.

The cause was the chat input metadata pills: Back creates a new untitled UI draft, and the pills converted that UI identity directly to a backend URI and subscribed to it before a corresponding backend existed. A debugger breakpoint confirmed AgentHostSessionInputPills as the caller, and the AHP logs confirmed the failed subscribe requests. The error refers to the new empty draft, not the legacy session just migrated.

Fixed and pushed in 3ec5b68. The pills now wait for an existing provisional backend mapping, use that backend URI, and follow mapping replacement/retirement without subscribing to an untitled UI identity. No database/adoption behavior was changed.

Validation:

  • Regression test fails before the fix and passes afterward; also covers provisioning, replacement, retirement, subscription disposal, and returning to an existing session.
  • 62 pills/provisional-session tests passed; client type-check, ESLint, and hygiene passed.
  • Repeated three actual legacy migrations and Back actions in the same live reproduction profile after the fix: zero untitled subscriptions and zero adoption errors in the protocol log.

Please retry on this head; the earlier affected test profile can be used to verify this particular console-error fix.

Merge main through 0af2bfd while retaining central session identity, peer membership, compatibility receipts, non-creating legacy discovery, shutdown drains, and provisional draft subscriptions. Adopt upstream per-turn edit-completion tracking and coverage. Verify restricted pull-request association changes persist to the central catalog and remain database-free on restarted listings; align architecture documentation.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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