github / github/copilot-sdk

Add per-session env overrides for built-in shell tool child processes

Đang mở
#2,040 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
enhancement vs-code
Ngôn ngữ chính
Java
Star
10.5k
Fork
1.5k
Merge trung bình
1 ngày 11 giờ
Pull request đã merge (30 ngày)
128

Mô tả

Follow up to #1911. The `initScripts` half of that ask shipped through the runtime in github/copilot-agent-runtime#12710, but the per-session `env` part was deferred out of that PR.

Context: https://github.com/microsoft/vscode/issues/323164

`initScripts` covers the Python activation case since the host can materialize a shell-specific activation file and have the runtime source it before each command. An explicit env map is still worth having for hosts that just want to set or unset a few variables without generating script files, and without dealing with per-shell quoting.

Current wire shape:

```ts
export interface ShellOptions {
initProfile?: "none" | "non-interactive";
initScripts?: ShellInitScript[];
processFlags?: string[];
}
```

Add the `env` map from the original proposal:

```ts
export interface ShellOptions {
/** Env applied to built-in shell tool child processes. `null` unsets/removes. */
env?: Record;
}
```

The reason this was deferred is that the update semantics should be pinned down before the wire shape ships:

- Whether `session.rpc.options.update` with `shell.env` replaces the whole overlay or merges per key. Replace seems right: it stays idempotent and a host can revert a variable to the inherited value by omitting it. With merge there is no way to un-touch a variable once set.
- Precedence: overlay applied to the spawned process env first, `initScripts` sourced after, so scripts can override.
- `null` meaning remove-from-env vs revert-to-inherited.
- Whether the overlay persists across resume or the host re-sends it, matching how the rest of `shell` behaves today.

(generated by copilot)

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Start by tracing the ShellOptions wire shape and session.rpc.options.update handling described in the issue. Review how shell and initScripts behave across updates and resume, then pin down replacement, precedence, null-removal, and persistence semantics; done means the env overlay is represented and applied consistently to built-in shell child processes.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
shell, typescript
Lĩnh vực
api, cli
Loại issue
Tính năng
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Khá rõ ràng
Mức phù hợp với người mới
45/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.