[Agent] Interactive recovery runs shell commands in the install folder, not the user's folder

オープン 初心者向け
#1,486 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
78/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
csharp
領域
backend, cli

調査の方向性

AgentLauncher、EnvironmentProber、ChatAgent.BuildSessionConfigAsyncから始め、Copilot SDKでSessionConfig.WorkingDirectoryがどのように設定されるかを確認します。AZCLIPS_CALLER_CWDがセッションに届く経路を追い、未設定の場合のフォールバックを確認します。インタラクティブな復旧で、呼び出し元のフォルダーを基準にシェルとファイルの相対パスが解決されれば完了です。issueのparams.jsonの手順で再現してください。

索引モデルが issue の本文から書いたものです。

説明

act-experience-enablement-squad bug
Affected surface

Agent (interactive recovery: powershell / bash / view tool calls)

Describe the bug

This behavior already exists on main.

The Copilot session runs in the agent install folder instead of the folder where the user ran az. Shell commands and file reads that the agent runs with a relative path therefore resolve against the install folder.

  1. AgentLauncher starts the agent process with WorkingDirectory set to the agent install folder. .NET needs this to resolve relative probing paths. The user's folder is forwarded in AZCLIPS_CALLER_CWD.
  2. EnvironmentProber reads AZCLIPS_CALLER_CWD and reports it as cwd in the injected <environment> block, so the model is told the right folder.
  3. ChatAgent.BuildSessionConfigAsync doesn't set SessionConfig.WorkingDirectory, so the Copilot session, and every shell tool it runs, uses the agent process folder.

Repro (interactive mode, packaged build):

  1. In C:\work, create params.json and run az config get --key @params.json.
  2. Run az troubleshoot recover --style interactive and approve the plan.
  3. The <environment> block shows cwd: C:\work. The session's cwd is ...\Programs\azcli\. The agent runs Get-ChildItem -Path .\params.json, which fails with exit code 1 although the file exists in C:\work.

One-shot recovery isn't affected: the plan's relative paths are run by the user from their own folder. Reading files that the failed command names isn't affected either, because FailedCommandFiles resolves them against AZCLIPS_CALLER_CWD.

Expected behavior

The Copilot session runs in the user's folder, so relative paths in agent commands resolve the same way as in the user's failed command.

Additional context

Possible fix: set SessionConfig.WorkingDirectory (a GitHub Copilot SDK option) to the AZCLIPS_CALLER_CWD value, and fall back to the current behavior when it is unset.

Found while testing #1457, which doesn't change this path. Priority: P2.

主要言語
C#
スター
18
フォーク
10
平均マージ
1日 20時間
マージ済み PR(30日)
157

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Azure/azclips のほかの issue

Azure/azclips の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。