github / github/copilot-cli

userPromptTransformed hook is skipped for steering messages

Aperta
#4,640 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

triage
Lingua principale
Shell
Stelle
11.2k
Fork
1.9k
Merge medio
14h 16m
PR unite (30g)
6

Descrizione

[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.

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia tracciando addImmediateMessagesIfProcessing() e runImmediatePromptPreRequest(), quindi confronta quel percorso con il normale percorso di costruzione del turno che invoca userPromptTransformed. Riproduci lo scenario di steering-message dell’Issue e verifica che l’hook venga eseguito, emetta un evento e inserisca il marker nel contesto del modello prima che il messaggio venga aggiunto alla richiesta.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
shell
Ambito
cli
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Attiva
Chiarezza
Abbastanza chiara
Idoneità per principianti
65/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.