Skip to content

fix(agents): migrate policy-disabled Claude and Codex chats - #340702

Merged
Giuseppe Cianci (Giuspepe) merged 16 commits into
mainfrom
agents/investigate-codex-claude-session-filtering
Oct 14, 2026
Merged

Giuseppe Cianci (Giuspepe) merged 16 commits into
mainfrom
agents/investigate-codex-claude-session-filtering

Conversation

@Giuspepe

@Giuspepe Giuseppe Cianci (Giuspepe) commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor
code-oss-automatic-policy-migration.mp4

Claude and Codex Agent Host chats disappear from the sidebar when enterprise policy disables their agents. This keeps them listed, shows their saved transcripts, and lets users continue in Copilot.

When managed settings require Copilot, a visible, idle chat moves automatically, matching Local migration in #340779. This also covers policy arriving while the chat is open. The Copilot copy keeps the transcript, original title, and unsent draft with its attachments. Nothing is sent automatically.

After the Copilot copy opens, the original moves to Archived and stays readable. A source session stays in the active list while it has uncopied public conversations. Archiving changes saved metadata only, so source worktrees and private tool history remain intact. Continue in Copilot reuses the existing copy after a completed migration. If that copy is deleted, the original can be migrated again.

The shared import also fixes Local title loss in #341029. Other policy disablements retain Continue in Copilot. Managed checkouts and folders that need trust also use the manual action so the user can choose an independent workspace or grant trust.

Saved-history access

Recovery intentionally uses the disabled provider’s installed code to read history. Claude uses its SDK’s local history utilities without starting a query. Codex starts its installed app-server with a temporary home and copied indexes, then makes history requests. It does not create or resume a native thread or send a model request. Neither reader downloads an SDK. New Claude and Codex sessions and messages remain blocked, and Copilot follows the current organization policy.

Scope and limits

  • Covers cataloged local Agent Host chats. Standalone OpenAI and Anthropic extension chats and remote sessions are outside this change.
  • Missing or unreadable history leaves the source available with an error. Codex native managed configuration, selected profiles, and unsupported storage arguments can prevent saved-history access.
  • Continuation copies the selected conversation. Uncommitted files stay in the source checkout.

Validation

  • Code OSS checks cover both providers through policy changes, cold reopen, real Copilot replies, unsent drafts, readable originals, sibling retention and archival, missing history, cancellation, and deleted-copy recovery. The Local title also survives a real reply and reopen.
  • 2,653 affected Electron unit tests pass on macOS, with 34 skipped.
  • Client type checking, scoped lint, hygiene, and layer checks pass.

Keep Claude and Codex Agent Host history visible when enterprise policy disables their providers. Open these sessions read-only and preserve loaded history and drafts through policy changes.

Cancel obsolete provider resolutions during recovery so late results cannot replace the current chat model.
Copilot AI balanced review requested due to automatic review settings October 9, 2026 10:27

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.

🟡 Changes recommended

Failed root snapshots can incorrectly remove all existing local agent and sidebar registrations during configuration changes.

2 open findings
What changed in this PR

Retains policy-disabled local Claude and Codex sessions as read-only history while preserving loaded transcripts and drafts.

Changes:

  • Separates history visibility from executable provider registration.
  • Preserves and reloads models across policy/provider transitions.
  • Adds policy, cancellation, and read-only regression coverage.
File Description
chatService.test.ts Tests retained read-only models and drafts.
chatEditorInput.test.ts Tests editor reload cancellation and preservation.
cloudSandboxSessionHandler.test.ts Adapts tests for optional history actions.
chatSessionsService.test.ts Tests cancellation during provider replacement.
agentHostChatContribution.test.ts Tests policy-only registrations and disposal.
chatServiceImpl.ts Makes policy-revoked models persistently read-only.
chatEditorInput.ts Adds cancellable resolution and model release.
chatEditor.ts Reloads editors after provider replacement.
chatSessions.contribution.ts Cancels pending provider resolutions.
agentHostSessionListStore.ts Retains policy-hidden provider entries.
agentHostSessionListContribution.ts Registers history-only sidebar controllers.
agentHostSessionHandler.ts Rejects mutations after disposal.
agentHostPolicyUnavailableSession.ts Implements inert policy-disabled content.
agentHostChatContribution.ts Registers history-only content providers.
chatGroupsView.test.ts Tests read-only draft and banner presentation.
localAgentHostSessionsProvider.test.ts Covers policy transitions and retained sessions.
localAgentHostSessionsProvider.ts Exposes policy-disabled saved sessions read-only.
baseAgentHostSessionsProvider.ts Gates mutations and passive restoration by policy.
chatView.test.ts Tests Sessions model retention and reloads.
chatView.ts Preserves models during provider replacement.
chatGroupView.ts Displays read-only drafts as transcripts.
chatSessionHistory.ts Makes recovery actions optional.
agentService.ts Adds local-provider policy helpers.

🧠 Review effort: Balanced


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

Reproduce lost registrations after a root-subscription failure and the missing editor loading indicator while policy recovery waits for history.
@Giuspepe Giuseppe Cianci (Giuspepe) changed the title fix(agents): retain sessions disabled by enterprise policy fix(agents): view and continue policy-disabled Claude and Codex chats Oct 12, 2026

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.

🟡 Changes recommended

Cancellation can still create abandoned local chat models, and the new capability bypasses the established typed metadata boundary.

2 open findings
2 resolved since last review

🧠 Review effort: Balanced

Preserve passive history reads with recorded chat ownership and current session-list contracts. Stop cancelled Local editor opens after account-policy waits and move the saved-chat capability into the typed metadata boundary.
Add failing regression coverage for automatic Claude/Codex migration, copy completion ordering, imported titles, draft handoff, and empty saved peer workspace metadata.
Automatically continue visible idle chats when managed settings require
Copilot. Preserve transcript, title, and unsent draft, then archive only
after the copy opens. Keep uncopied public siblings accessible.

Record completed continuations for retries, recover deleted copies, and
serialize archive and restore operations without source-provider execution
or worktree cleanup. Preserve imported Local chat titles too.
@Giuspepe Giuseppe Cianci (Giuspepe) changed the title fix(agents): view and continue policy-disabled Claude and Codex chats fix(agents): migrate policy-disabled Claude and Codex chats Oct 14, 2026
@Giuspepe
Giuseppe Cianci (Giuspepe) requested a balanced review from Copilot October 14, 2026 14:01

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

The change spans protocol, persistence, provider recovery, archival, workspace lifecycle, and two UI surfaces, so final human validation is warranted.

1 open finding
2 resolved since last review

🧠 Review effort: Balanced

@Giuspepe
Giuseppe Cianci (Giuspepe) marked this pull request as ready for review October 14, 2026 14:28
@vs-code-engineering

Copy link
Copy Markdown
Contributor

📬 CODENOTIFY

The following users are being notified based on files changed in this PR:

TylerLeonhardt

Matched files:

  • src/vs/platform/agentHost/node/claude/claudeAgentSdkService.ts
  • src/vs/platform/agentHost/node/claude/claudeSavedChatReader.ts

Benjamin Christopher Simmonds (@benibenj)

Matched files:

  • src/vs/sessions/browser/parts/chatGroupView.ts

@Giuspepe
Giuseppe Cianci (Giuspepe) merged commit f9eda24 into main Oct 14, 2026
36 checks passed
@Giuspepe
Giuseppe Cianci (Giuspepe) deleted the agents/investigate-codex-claude-session-filtering branch October 14, 2026 15:44
@vs-code-engineering vs-code-engineering Bot added this to the 1.143.0 milestone Oct 14, 2026
@IWorkbenchLayoutService private readonly layoutService: IWorkbenchLayoutService,
@IManagedSettingsService managedSettingsService: IManagedSettingsService,
@ICommandService private readonly commandService: ICommandService,
@IAgentHostPolicyContinuationService private readonly policyContinuationService: IAgentHostPolicyContinuationService,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Misses registration for Web? Only Desktop has?

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.

4 participants