Copilot CLI 1.0.116 refuses session.metadata.setWorkingDirectory calls from extensions

未關閉
#5,599 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
52/100
Issue 類型
文件
描述清晰度
基本清楚
活躍度
活躍
技術堆疊
javascript, node.js, typescript

研究方向

Read the bundled SDK documentation in copilot-sdk/extension.js and the declarations in copilot-sdk/generated/rpc.d.ts for metadata.setWorkingDirectory; compare their wording with the extension restrictions described for gitHubFetch.* and gitHubRelease.downloadAsset. Document the extension restriction there and in the release notes if the refusal is intentional. The issue does not identify a release notes file, so first locate the project's release notes entry point.

由索引模型根據 Issue 內容生成。

描述

area:permissions area:plugins
Describe the bug

In Copilot CLI 1.0.116, calling session.rpc.metadata.setWorkingDirectory({ workingDirectory }) from a user extension fails with an RPC error and emits a refusal warning:

✗ Command /start failed: Request session.metadata.setWorkingDirectory failed with message: Relaxing session permissions is not available to extensions

! Refused session.metadata.setWorkingDirectory from extension user:start: Relaxing session permissions is not available to extensions. The session owner must make this change; an extension author should remove this call.

The call failed with Allow All enabled for the session (/allow-all), after the extension's folder-trust check (session.rpc.permissions.folderTrust.isTrusted) passed. The target directory was the session's startup working directory, unchanged between session start and the call.

In copilot-sdk/extension.js and copilot-sdk/generated/rpc.d.ts, the bundled 1.0.116 @microsoft/copilot-sdk JSDoc for metadata.setWorkingDirectory describes host use and does not state that calls from extensions are refused. Some other extension-restricted methods in copilot-sdk/extension.js, such as gitHubFetch.* and gitHubRelease.downloadAsset, state Refused for extensions. or Extensions cannot use this method. in their JSDoc comments.

Related issue: #3035 (where a commenter noted an extension calling session.rpc.metadata.setWorkingDirectory as a workaround in the desktop app with CLI 1.0.94-3).

Affected version

GitHub Copilot CLI 1.0.116

Steps to reproduce the behavior

Reproduction outline:

  1. Enable experimental extensions ("experimental": true in ~/.copilot/settings.json).
  2. Create ~/.copilot/extensions/repro-cwd/extension.mjs registering a /repro-cwd slash command via joinSession from @microsoft/copilot-sdk/extension, with a handler reading the session's absolute workingDirectory via session.rpc.metadata.snapshot() and calling await session.rpc.metadata.setWorkingDirectory({ workingDirectory }).
  3. In Copilot CLI 1.0.116 started in a trusted folder, enable /allow-all for the session and run /repro-cwd.

The output above came from an interactive run of a user extension named user:start. Running /repro-cwd from the outline above is expected to fail with Request session.metadata.setWorkingDirectory failed with message: Relaxing session permissions is not available to extensions and a Refused session.metadata.setWorkingDirectory from extension user:repro-cwd warning.

Expected behavior

If refusing session.metadata.setWorkingDirectory for extensions is intentional:

  • Document the restriction in the release notes and in the bundled @microsoft/copilot-sdk JSDoc for metadata.setWorkingDirectory.
  • Consider either allowing a same-directory call to succeed without modifying session permissions or the permission primary directory, or providing a host-mediated working-directory change with explicit session-owner confirmation.
Additional context
  • Operating system: SUSE Linux Enterprise Server 15 SP6 (Linux 6.4.0-150600.23.81-default)
  • CPU architecture: x86_64
  • Package-content comparison (not a runtime test of older releases): The strings Relaxing session permissions is not available to extensions and extension_refused are absent from cached 1.0.113 and 1.0.114 prebuilds/linux-x64/runtime.node, and present in 1.0.115 and 1.0.116.
主要語言
Python
星號
11.5k
分支
2k
平均合併
6 小時 34 分鐘
30 天內合併 PR
3

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

github/copilot-cli 的其他 Issue

查看 github/copilot-cli 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。