github / github/copilot-cli

userPromptTransformed hook is skipped for steering messages

オープン
#4,640 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

triage
主要言語
Shell
スター
11.2k
フォーク
1.9k
平均マージ
14時間 16分
マージ済み PR(30日)
6

説明

[Filed by Copilot on behalf of @bghgary]

Describe the bug

When a session receives a user message while the agent is already processing, the message is delivered to the model as steering, but the userPromptTransformed hook is not invoked. Hooks that inject standing instructions therefore apply to ordinary and queued turns but not to corrections or redirections delivered mid-turn.

Affected version

GitHub Copilot CLI 1.0.80

Steps to reproduce the behavior
  1. Configure a userPromptTransformed command hook that adds a unique marker to modifiedTransformedPrompt and logs each invocation.
  2. Start a session and send an ordinary prompt. Confirm that the hook runs and the marker reaches the model context.
  3. Start a long-running tool call, then send another user message before the tool call completes.
  4. Inspect the session events and hook log.

The second message is recorded with delivery: "steering", but it has no userPromptTransformed hook events, the hook log has no corresponding invocation, and the marker is absent from the model context.

Expected behavior

userPromptTransformed should run before every user message is added to a model request, including messages delivered while the session is processing.

Additional context

In a clean Windows x64 reproduction, the ordinary prompt invoked the hook while the in-flight steering prompt did not. In a larger sample of 984 user-message turns, the injected marker was present on 96.6% of idle deliveries and 100% of queued deliveries, but only 4.9% of steering deliveries; the hook's own 1,859-entry log contained no failures.

The installed implementation has separate paths: ordinary turn construction calls userPromptTransformed, while an in-flight send() queues the message through addImmediateMessagesIfProcessing() and runImmediatePromptPreRequest() later appends it directly to the model request without applying the hook.

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

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

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

まず addImmediateMessagesIfProcessing() と runImmediatePromptPreRequest() を追跡し、次に userPromptTransformed を呼び出す通常のターン構築パスとそのパスを比較します。Issue にある steering-message のシナリオを再現し、hook が実行され、イベントを発行し、メッセージがリクエストに追加される前にモデルコンテキストへマーカーを配置することを確認します。

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

評価

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

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

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