Skip to content

agentHost: isolate created sessions across projects - #333745

Merged
Sandeep Somavarapu (sandy081) merged 1 commit into
mainfrom
sandy081/agents/create-session-tool-worktree-isolation
Sep 1, 2026
Merged

agentHost: isolate created sessions across projects#333745
Sandeep Somavarapu (sandy081) merged 1 commit into
mainfrom
sandy081/agents/create-session-tool-worktree-isolation

Conversation

@sandy081

Copy link
Copy Markdown
Member

What changed

  • carry the source session project root into create_session defaults
  • inherit isolation only when the requested workspace matches that project root
  • default cross-project and workspace-less creation to worktree isolation
  • preserve existing folder fallback when the target cannot support worktrees

Why

A Quick Chat or a session working in another repository should not cause newly delegated work to run directly in the target folder. Isolation inheritance is only appropriate when both sessions belong to the same project.

Validation

  • npm run hygiene
  • npm run typecheck-client
  • focused Agent Host unit tests (14 passing)

Only inherit the source session's isolation when the requested workspace matches its project root. Default cross-project and workspace-less session creation to worktree isolation while preserving existing validation for unsupported folders.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings September 1, 2026 09:53
@sandy081 Sandeep Somavarapu (sandy081) added this to the 1.137.0 milestone Sep 1, 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.

Copilot review overview

Review tier: Balanced
Findings: None

What changed in this PR

This PR prevents delegated Agent Host sessions from directly modifying unrelated projects.

Changes:

  • Propagates the source session’s project root into creation defaults.
  • Inherits isolation only for matching projects; otherwise defaults to worktree isolation.
  • Updates focused tests for same-project, cross-project, and workspace-less creation.
File Description
src/​vs/​platform/​agentHost/​node/​shared/​sessionServerTools.ts Selects isolation based on project equality.
src/​vs/​platform/​agentHost/​node/​agentService.ts Exposes the source project in creation defaults.
src/​vs/​platform/​agentHost/​test/​node/​sessionServerTools.test.ts Tests project-aware isolation selection.
src/​vs/​platform/​agentHost/​test/​node/​agentService.test.ts Updates end-to-end creation expectations.

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

@sandy081
Sandeep Somavarapu (sandy081) merged commit 8098ed8 into main Sep 1, 2026
41 checks passed
@sandy081
Sandeep Somavarapu (sandy081) deleted the sandy081/agents/create-session-tool-worktree-isolation branch September 1, 2026 10:36
Bhavya U (bhavyaus) pushed a commit that referenced this pull request Sep 1, 2026
Only inherit the source session's isolation when the requested workspace matches its project root. Default cross-project and workspace-less session creation to worktree isolation while preserving existing validation for unsupported folders.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants