github / github/copilot-cli

~/.bash_history is truncated after copilot executes a Bash command

未關閉
#2,317 2 則留言 9 個 reaction 已指派 0 人 在 GitHub 檢視
area:tools
主要語言
Shell
星號
11.2k
分支
1.9k
平均合併
14 小時 16 分鐘
30 天內合併 PR
6

描述

### Describe the bug

See: https://github.com/github/copilot-cli/issues/501 for additional context. I believe that #501 should be re-opened, as the fixes mentioned in it are incomplete.

TL;DR: When Copilot executes a Bash command, it truncates the user's `~/.bash_history`, ignoring the user's `HISTFILESIZE`. This is a consequence of the manner in which Bash is invoked (an interactive shell spawned with `bash --norc --noprofile`)

### Affected version

v1.0.11

### Steps to reproduce the behavior

1. Observe `wc -l ~/.bash_history`
2. Instruct copilot to run a Bash command
3. Observe `wc -l ~/.bash_history`

### Expected behavior

Copilot does not modify `~/.bash_history` in any way, especially not truncation.

### Additional context

This issue can be worked around by adding the following shim to your `~/.bashrc`.

```
copilot() {
HISTFILE=/dev/null command copilot "$@"
}
```

貢獻指南

開啟貢獻指南

研究方向

首先,在 v1.0.11 上按照列出的 wc -l ~/.bash_history 步驟重現此問題,然後檢查 Copilot 如何使用 --norc --noprofile 呼叫 Bash,以及 HISTFILESIZE 的處理方式。完成的標準是執行 Bash 命令不再修改或截斷 ~/.bash_history,同時現有的替代方案可提供比較。

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

評估

技術堆疊
bash
領域
cli
Issue 類型
缺陷
難度
3/5
預估耗時
1-2 天
活躍度
冷清
描述清晰度
基本清楚
新手友好度
55/100

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

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