github / github/copilot-cli

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

オープン
#3,589 コメント 1 件 リアクション 2 件 担当者 0 名 GitHub で見る
area:context-memory area:plugins
主要言語
Shell
スター
11.2k
フォーク
1.9k
平均マージ
14時間 16分
マージ済み PR(30日)
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_

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

まず、それぞれ異なる additionalContext 値を出力する2つの sessionStart または subagentStart フックで問題を再現します。フックの出力がどのように収集され、注入されるかを追跡し、完了した動作によって最後の値だけでなく両方の値がエージェントから利用可能になることを確認します。

索引モデルが issue の本文から書いたものです。

評価

領域
cli
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
活発
明瞭さ
おおむね明確
初心者へのやさしさ
52/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。