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_

貢獻指南

開啟貢獻指南

研究方向

Start by reproducing the issue with two sessionStart or subagentStart hooks that each emit different additionalContext values. Trace how hook outputs are collected and injected, then verify that the completed behavior makes both values available to the agent rather than only the last one.

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

評估

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

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

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