Skip to content

Fix restored private subagent catalog admission - #340284

Merged
Sandeep Somavarapu (sandy081) merged 10 commits into
mainfrom
agents/try-again-now
Oct 7, 2026
Merged

Sandeep Somavarapu (sandy081) merged 10 commits into
mainfrom
agents/try-again-now

Conversation

@sandy081

Copy link
Copy Markdown
Member

Summary

Fix restored historical private subagents being materialized in memory without durable normalized catalog membership, which caused later metadata updates such as workspace pinning to fail with Missing normalized chat.

The repair:

  • admits already-materialized historical subagents into the private normalized catalog while preserving hidden/private lineage and lazy restored history;
  • retries legacy-authority admission from the latest verified catalog source without overwriting unopened peers, titles, tombstones, or newer ownership;
  • fences queued retries to the owning session incarnation;
  • validates admission lifetimes at the actual central and per-session SQLite write/commit boundaries so removal or same-URI reload rolls back stale child, header, metadata, and pending-receipt writes atomically.

This does not change AHP protocol behavior, add readiness behavior, repair live profile databases, or import the separate move/foundation work.

Validation

  • Regression proof before the final write-boundary fixes:
    • ./scripts/test.sh --run src/vs/platform/agentHost/test/node/agentService.test.ts --grep 'catalog revision update|local receipt commit' — 0 passing, 2 failing, reproducing the stale child/header commit and stale local receipt commit.
  • The same command after the fixes — 2 passing.
  • ./scripts/test.sh --reporter dot --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/agentHostCatalogSyncService.test.ts --run src/vs/platform/agentHost/test/node/agentHostPeerChatStore.test.ts --run src/vs/platform/agentHost/test/node/sessionArtifactRemoval.test.ts — 312 passing.
  • ./scripts/test.sh --reporter dot --run src/vs/platform/agentHost/test/node/agentService.test.ts --grep 'restored subagent|historical subagent|legacy owner|catalog revision update|local receipt commit' — 13 passing.
  • npm run build-fast -- --client-only — passed.
  • npm run typecheck-client — passed.
  • npm run eslint -- src/vs/platform/agentHost/common/sessionDataService.ts src/vs/platform/agentHost/node/agentHostCatalogSyncService.ts src/vs/platform/agentHost/node/agentHostDatabase.ts src/vs/platform/agentHost/node/sessionDatabase.ts src/vs/platform/agentHost/test/common/sessionTestHelpers.ts src/vs/platform/agentHost/test/node/agentHostCatalogSyncService.test.ts src/vs/platform/agentHost/test/node/agentService.test.ts src/vs/platform/agentHost/test/node/sessionArtifactRemoval.test.ts src/vs/platform/agentHost/test/node/sessionDatabase.test.ts — passed.
  • git diff --check — passed.
  • Normal pre-commit hygiene — passed.
  • Independent read-only review of the full signed five-commit chain completed with no remaining high-confidence findings. The reviewer inspected the source and regression seams; the runtime results above are the author's validation evidence.

Stage historical private chats when normalized catalog authority activates, preserve existing catalog membership and dirty revisions, and retry transient restore admission before inherited workspace metadata is updated.

Co-authored-by: Copilot <[email protected]>
Rebuild staged historical chat membership under the catalog migration lock and cancel retained admission retries when their owning session incarnation is removed.

Co-authored-by: Copilot <[email protected]>
Carry restored-session lifetime validation through queued private metadata hydration, catalog synchronization, and transactional normalized writes so an evicted owner cannot persist stale historical children into a same-URI reload.

Co-authored-by: Copilot <[email protected]>
Validate restored-admission lifetimes inside central and local SQLite transactions so owner reloads roll back private chat and pending catalog receipt writes before commit.

Co-authored-by: Copilot <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 7, 2026 13:45
@sandy081
Sandeep Somavarapu (sandy081) marked this pull request as ready for review October 7, 2026 13:46
@sandy081 Sandeep Somavarapu (sandy081) added this to the 1.142.0 milestone Oct 7, 2026
Preserve upstream normalized-peer legacy projection while keeping restored-admission lifetime validation as the final pre-commit transaction boundary.

Co-authored-by: Copilot <[email protected]>

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 review overview

🔵 Needs a closer look

The multi-database transactional and session-lifetime concurrency changes warrant final human review.

Review effort: Balanced
Findings: None

What changed in this PR

Fixes durable catalog admission for restored private subagents while fencing stale writes across session incarnations.

Changes:

  • Persists restored subagents with hidden lineage and legacy-catalog reconciliation.
  • Adds transaction-boundary lifetime validation and cancellation outcomes.
  • Adds regression coverage for retries, reloads, and rollback behavior.
File Description
common/​sessionDataService.ts Adds cancellable catalog-write contracts.
node/​agentService.ts Implements restored-subagent admission and retries.
node/​agentHostCatalogSyncService.ts Propagates write validators through synchronization.
node/​agentHostChatCatalogMigration.ts Fences catalog migration writes.
node/​agentHostDatabase.ts Rolls back stale central database transactions.
node/​sessionDatabase.ts Rolls back stale per-session transactions.
node/​agentHostPeerChatStore.ts Supports cancellable private-chat persistence.
test/​common/​sessionTestHelpers.ts Updates test database contracts.
test/​node/​agentService.test.ts Covers admission, retries, and reload races.
test/​node/​agentHostCatalogSyncService.test.ts Updates synchronization test doubles.
test/​node/​sessionArtifactRemoval.test.ts Forwards validators in test databases.
test/​node/​sessionDatabase.test.ts Updates transition-result assertions.

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

Cancel restored catalog activation when the owning session is reloaded while normalized peers are projected to the legacy mirror.

Co-authored-by: Copilot <[email protected]>
@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Screenshot Changes

Base: d6c4a1de Current: c242ebdd

Changed (1)

sessions/chatCompositeBar/MixedStatuses/Light
Before After
before after

Capture list-visible state before entering the deferred synchronization queue so shutdown and adoption cleanup cannot invalidate an already-requested catalog write. Keep restored migration requests deriving their source under the migration lock.

Co-authored-by: Copilot <[email protected]>
Carry immutable session snapshots through queued, coalesced, and ordered catalog writes so residency eviction cannot drop a requested mutation. Keep restored migration source resolution inside its migration lock.

Co-authored-by: Copilot <[email protected]>
Install ordered catalog writes as request-time barriers in the existing per-session queue. Later coalesced state snapshots now replay after the ordered mutation while eviction-safe snapshots and background error isolation remain intact.

Co-authored-by: Copilot <[email protected]>
@sandy081
Sandeep Somavarapu (sandy081) merged commit 56bc26f into main Oct 7, 2026
55 of 56 checks passed
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