userPromptTransformed hook is skipped for steering messages
还没有人认领这个 Issue。
- 主要语言
- Shell
- 星标
- 11.2k
- 派生
- 1.9k
- 平均合并
- 14 小时 16 分钟
- 30 天内合并 PR
- 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
- Configure a
userPromptTransformedcommand hook that adds a unique marker tomodifiedTransformedPromptand logs each invocation. - Start a session and send an ordinary prompt. Confirm that the hook runs and the marker reaches the model context.
- Start a long-running tool call, then send another user message before the tool call completes.
- 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.
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先跟踪 addImmediateMessagesIfProcessing() 和 runImmediatePromptPreRequest(),然后将该路径与调用 userPromptTransformed 的普通轮次构建路径进行比较。重现 Issue 中的 steering-message 场景,并验证 hook 会运行、发出事件,并在消息添加到请求之前将 marker 放入模型上下文中。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- shell
- 领域
- cli
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 活跃
- 描述清晰度
- 基本清楚
- 新手友好度
- 65/100