-
Notifications
You must be signed in to change notification settings - Fork 942
Description
Summary
When using the OnUserPromptSubmitted hook and returning a UserPromptSubmittedHookOutput with AdditionalContext set, the context is not injected into the conversation for the model. The hook fires correctly (confirmed via logging), but the model does not receive the additional context.
Using ModifiedPrompt on the same hook output works as expected — the model sees the modified prompt. This suggests the issue is specifically with AdditionalContext handling in the CLI runtime.
Reproduction
Minimal reproduction here: https://gist.github.com/nathan815/264d78ff877435932bd42f28b97f07e2
- Configure a BYOK provider (Azure OpenAI):
var session = await client.CreateSessionAsync(new SessionConfig
{
Model = "gpt-5.2-chat",
Provider = new ProviderConfig
{
Type = "azure",
BaseUrl = "https://<endpoint>.openai.azure.com/openai/deployments/gpt-5.2-chat",
ApiKey = "<key>",
Azure = new AzureOptions { ApiVersion = "2025-03-01-preview" },
},
Streaming = true,
Hooks = new SessionHooks
{
OnUserPromptSubmitted = (input, invocation) =>
{
Console.WriteLine($"Hook fired: {invocation.SessionId}");
return Task.FromResult<UserPromptSubmittedHookOutput?>(
new UserPromptSubmittedHookOutput
{
AdditionalContext = "The user is currently viewing resource abc123 in region eastus2",
}
);
},
},
});
await session.SendAsync(new MessageOptions { Prompt = "What am I looking at?" });- The hook fires (confirmed via console output).
- The model responds as if it has no additional context.
Expected behavior
The AdditionalContext string should be injected into the conversation so the model can see it, as documented:
AdditionalContext- Additional context to inject into the conversation for the language model.
Environment
- SDK:
GitHub.Copilot.SDK0.1.32 (.NET) - Provider: Azure OpenAI (BYOK)
- Model: gpt-5.2-chat
- OS: Windows 11