Repository navigation
Description
Follow-up from #331567, which lists PR/issue sessions as one of the session capabilities that VS Code doesn't expose to the agent yet.
Scenario
In the Agents window, I start a session with "help me review https://github.com/owner/repo/pull/123". Today the agent can't switch its environment to that pull request. It reads the diff remotely, or it runs git fetch/gh pr checkout in whatever folder the session happens to be in. That can mix the PR with the user's local changes or with another task's worktree.
The agent should have a tool that turns this request into a proper PR review session: the PR checked out, the session linked to the PR, and the PR context attached.
What exists today
- The UI already has New Session from Pull Request (
workbench.agentSessions.newSessionFromPullRequest, in the session section's new-session menu). It creates a session with thepullRequestUrlsession config. The agent host then fetches the PR into its own worktree on apr-<number>branch (worktreeIsolation.ts,_resolvePullRequestWorkingDirectory), links the session to the PR, and attaches the PR context. - The agent's session tools (
SessionServerToolName:create_session,set_workspace,isolate_session,move_session, …) have no way to pass a pull request. So the agent can't reach the flow above.
Proposal
Add a session server tool, for example open_pr_session (name to be decided; copilotd already shows a label for a tool with that name), that takes a PR URL (or owner/repo#number) and:
- Resolves the PR and the local repository for it (the current session's repository, or a known project for that repo).
- Creates a session from the PR, reusing the existing
pullRequestUrlpath, so it gets the same worktree, branch, PR link and context as the UI command. Then it either:- starts a new independent session with the user's prompt (like
create_session), or - moves the current chat into the PR worktree (like
isolate_session/set_workspace), so the conversation continues in place.
- starts a new independent session with the user's prompt (like
- Follows the existing confirmation flow, since it fetches and creates a worktree.
Open questions
- New session or move the current chat? Moving keeps the "help me review" conversation; a new session matches the UI command.
- Should there be an option to check out the PR in the current folder, without a worktree? That's riskier with uncommitted changes. The worktree should probably be the default, with in-place checkout only when the user asks for it and the folder is clean.
- Should the same tool cover issues ("work on Improve the explorer view to match full VS design #123") or should that be a separate tool?
- Remote and cloud hosts: what should happen when the PR's repository isn't available locally?
🤖 Authored with GitHub Copilot on behalf of Alexandru Dima (@alexdima).
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsNo status
Activity