github / github/copilot-cli

When multiple `sessionStart`/`subagentStart` hooks output `additionalContext`, only the last one is injected into the context

未关闭
#3,589 1 条评论 2 个 reaction 已指派 0 人 在 GitHub 查看
area:context-memory area:plugins
主要语言
Shell
星标
11.2k
派生
1.9k
平均合并
14 小时 16 分钟
30 天内合并 PR
6

描述

### Describe the bug

I have multiple sessionStart/subagentStart hooks, and each of them prints `{"additionalContext":"some value"}` to stdout. I observed, that only the last emitted value is actually injected into the context. I validated this by simulating this with 2 synthetic hooks that inject different things and then asking the agent about them (or telling it to spawn a sub-agent and ask it). In all cases, only one of the two values is known to the agent.

To be clear, the hooks are all called (I validated this by adding an `echo >> /tmp/test.txt` to each hook), so the problem is not that only one of them is run. All are run, but only the last output is injected.

### Affected version

GitHub Copilot CLI 1.0.56.

### Steps to reproduce the behavior

1. Define multiple `sessionStart`/`subagentStart` hooks that each print `additionalContext` to stdout
2. Start a new copilot instance
3. Ask it about both the injected contexts.

### Expected behavior

If multiple hooks return additional context, they should all be concatenated.

### Additional context

_No response_

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。